Error - free_upper_bound + pytorch_used_bytes

Hi there, I’m using comfyUI for stable diffusion image generation and the below message keeps occurring when using a VAE encoder and advised to raise with pytorch directly - Any help would be greatly appreciated.
Error occurred when executing VAEEncode:

free_upper_bound + pytorch_used_bytes[device] <= device_total INTERNAL ASSERT FAILED at “…\c10\cuda\CUDAMallocAsyncAllocator.cpp”:540, please report a bug to PyTorch.

File “C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\execution.py”, line 153, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\execution.py”, line 83, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\execution.py”, line 76, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\nodes.py”, line 304, in encode
t = vae.encode(pixels[:,:,:,:3])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\comfy\sd.py”, line 258, in encode
samples[x:x+batch_number] = self.first_stage_model.encode(pixels_in).cpu().float()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\comfy\ldm\models\autoencoder.py”, line 180, in encode
z = self.encoder(x)
^^^^^^^^^^^^^^^
File “C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py”, line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py”, line 1527, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\comfy\ldm\modules\diffusionmodules\model.py”, line 522, in forward
h = self.down[i_level].block[i_block](h, temb)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py”, line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py”, line 1527, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\comfy\ldm\modules\diffusionmodules\model.py”, line 141, in forward
h = self.conv1(h)
^^^^^^^^^^^^^
File “C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py”, line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py”, line 1527, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Do you use Animatediff evolved ? I’m having the same issue though it only happens to me when I connect the animatediff custom node to the KSampler

Got a similar error when using comfyUI for MuseV:
RuntimeError: free_upper_bound + pytorch_used_bytes[device] <= device_total INTERNAL ASSERT FAILED at “…\c10\cuda\CUDAMallocAsyncAllocator.cpp”:541, please report a bug to PyTorch.
I’ve tried everything I can find online to fix this but always get this error. Installing an old version of Nvidia driver, installing different versions of cuda(11.8 and 12.1) and corresponding torch. None of these works.
If I have the solution for this, I will share it here. Please let me know if you have solved this.

I am having this same issue for MuseV. I’ve tried everything but nothing works.

I guess it was a matter of hardware. Now I have given up MuseV.
Additionally, I have also tried another WebUI package for MuseV. It could only process images of a very small scale and the outcome was terrible. By the way, I am using a laptop with 16GB RAM + 3060