kijai / ComfyUI-DepthAnythingV2

Simple DepthAnythingV2 inference node for monocular depth estimation
167 stars 12 forks source link

OOM error after updating comfy #18

Closed tristan22mc closed 2 weeks ago

tristan22mc commented 2 weeks ago

Did this break with the newest comfy update? Seems that no matter what I do im getting an out of memory error. Even when just loading a workflow with nothing but depth anything v2 in it. I have a 4090 so shouldnt have any issues and previously was running just fine.

Error occurred when executing DepthAnything_V2:

Allocation on device

File "C:\Users\trist\Documents\ComfyUI_windows_portable\ComfyUI\execution.py", line 317, in execute output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\trist\Documents\ComfyUI_windows_portable\ComfyUI\execution.py", line 192, in get_output_data return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\trist\Documents\ComfyUI_windows_portable\ComfyUI\execution.py", line 169, in _map_node_over_list process_inputs(input_dict, i) File "C:\Users\trist\Documents\ComfyUI_windows_portable\ComfyUI\execution.py", line 158, in process_inputs results.append(getattr(obj, func)(inputs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\trist\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DepthAnythingV2\nodes.py", line 159, in process depth = model(img.unsqueeze(0).to(device)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\trist\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl return self._call_impl(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\trist\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl return forward_call(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\trist\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DepthAnythingV2\depth_anything_v2\dpt.py", line 191, in forward features = self.pretrained.get_intermediate_layers(x, self.intermediate_layer_idx[self.encoder], return_class_token=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\trist\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DepthAnythingV2\depth_anything_v2\dinov2.py", line 308, in get_intermediate_layers outputs = self._get_intermediate_layers_not_chunked(x, n) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\trist\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DepthAnythingV2\depth_anything_v2\dinov2.py", line 277, in _get_intermediate_layers_not_chunked x = blk(x) ^^^^^^ File "C:\Users\trist\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl return self._call_impl(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\trist\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl return forward_call(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\trist\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DepthAnythingV2\depth_anything_v2\dinov2_layers\block.py", line 247, in forward return super().forward(x_or_x_list) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\trist\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DepthAnythingV2\depth_anything_v2\dinov2_layers\block.py", line 105, in forward x = x + attn_residual_func(x) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\trist\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DepthAnythingV2\depth_anything_v2\dinov2_layers\block.py", line 84, in attn_residual_func return self.ls1(self.attn(self.norm1(x))) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\trist\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl return self._call_impl(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\trist\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\trist\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DepthAnythingV2\depth_anything_v2\dinov2_layers\attention.py", line 70, in forward return super().forward(x) ^^^^^^^^^^^^^^^^^^ File "C:\Users\trist\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DepthAnythingV2\depth_anything_v2\dinov2_layers\attention.py", line 55, in forward attn = q @ k.transpose(-2, -1) ^~~~~~~

tristan22mc commented 2 weeks ago

Didint realize I was passing in a huge image my bad. problem solved