Kosinkadink / ComfyUI-VideoHelperSuite

Nodes related to video workflows
GNU General Public License v3.0
434 stars 76 forks source link

error occurred when executing vhs_videocombine: unable to allocate 10.0 gib for an array with shape (2433, 720, 512, 3) and data type float32 #167

Open faria2077 opened 4 months ago

faria2077 commented 4 months ago

How to fix this? error occurred when executing vhs_videocombine: unable to allocate 10.0 gib for an array with shape (2433, 720, 512, 3) and data type float32 file "c:\comfyui-aki-v1.2\execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) file "c:\comfyui-aki-v1.2\execution.py", line 82, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.function, allow_interrupt=true) file "c:\comfyui-aki-v1.2\execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(slice_dict(input_data_all, i))) file "c:\comfyui-aki-v1.2\custom_nodes\comfyui-videohelpersuite\videohelpersuite\nodes.py", line 326, in combine_video images = tensor_to_bytes(images) file "c:\comfyui-aki-v1.2\custom_nodes\comfyui-videohelpersuite\videohelpersuite\nodes.py", line 93, in tensor_to_bytes return tensor_to_int(tensor, 8).astype(np.uint8) file "c:\comfyui-aki-v1.2\custom_nodes\comfyui-videohelpersuite\videohelpersuite\nodes.py", line 89, in tensor_to_int return np.clip(tensor, 0, (2bits-1)) file "<__array_function__ internals>", line 180, in clip file "c:\comfyui-aki-v1.2\python\lib\site-packages\numpy\core\fromnumeric.py", line 2154, in clip return _wrapfunc(a, 'clip', a_min, a_max, out=out, kwargs) file "c:\comfyui-aki-v1.2\python\lib\site-packages\numpy\core\fromnumeric.py", line 57, in _wrapfunc return bound(*args, *kwds) file "c:\comfyui-aki-v1.2\python\lib\site-packages\numpy\core_methods.py", line 160, in _clip return _clip_dep_invoke_with_casting( file "c:\comfyui-aki-v1.2\python\lib\site-packages\numpy\core_methods.py", line 114, in _clip_dep_invoke_with_casting return ufunc(args, out=out, kwargs)

AustinMroz commented 4 months ago

Currently, there are a number of workarounds. Most of the memory optimizations so far have been on the input side, but I'm working on a set of changes which include memory optimizations for the combine side.

If your workflow allows it, I'd first recommend adding a Batch Manager node with a frames_per_batch of 500. Connect it to both input and output nodes like so image