Error - free_upper_bound + pytorch_used_bytes

username: Dave_Jones1
cooked: <p>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.<br>
Error occurred when executing VAEEncode:</p>
<p>free_upper_bound + pytorch_used_bytes[device] &lt;= device_total INTERNAL ASSERT FAILED at “…\c10\cuda\CUDAMallocAsyncAllocator.cpp”:540, please report a bug to PyTorch.</p>
<p>File “C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\execution.py”, line 153, in recursive_execute<br>
output_data, output_ui = get_output_data(obj, input_data_all)<br>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>
File “C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\execution.py”, line 83, in get_output_data<br>
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)<br>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>
File “C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\execution.py”, line 76, in map_node_over_list<br>
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))<br>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>
File “C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\nodes.py”, line 304, in encode<br>
t = vae.encode(pixels[:,:,:,:3])<br>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>
File “C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\comfy\sd.py”, line 258, in encode<br>
samples[x:x+batch_number] = self.first_stage_model.encode(pixels_in).cpu().float()<br>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>
File “C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\comfy\ldm\models\autoencoder.py”, line 180, in encode<br>
z = self.encoder(x)<br>
^^^^^^^^^^^^^^^<br>
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<br>
return self._call_impl(*args, **kwargs)<br>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>
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<br>
return forward_call(*args, **kwargs)<br>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>
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<br>
h = self.down[i_level].block[i_block](h, temb)<br>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>
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<br>
return self._call_impl(*args, **kwargs)<br>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>
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<br>
return forward_call(*args, **kwargs)<br>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>
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<br>
h = self.conv1(h)<br>
^^^^^^^^^^^^^<br>
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<br>
return self._call_impl(*args, **kwargs)<br>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>
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<br>
return forward_call(*args, **kwargs)<br>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</p>

username: AiPicsStudio
cooked: <p>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</p>

username: Heimerdinger
cooked: <p>Got a similar error when using comfyUI for MuseV:<br>
RuntimeError: free_upper_bound + pytorch_used_bytes[device] &lt;= device_total INTERNAL ASSERT FAILED at “…\c10\cuda\CUDAMallocAsyncAllocator.cpp”:541, please report a bug to PyTorch.<br>
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.<br>
If I have the solution for this, I will share it here. Please let me know if you have solved this.</p>

username: Nisheeth_Gupta
cooked: <p>I am having this same issue for MuseV. I’ve tried everything but nothing works.</p>

username: Heimerdinger
cooked: <p>I guess it was a matter of hardware. Now I have given up MuseV.<br>
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</p>