akatz-ai / ComfyUI-DepthCrafter-Nodes

A port of tencent/DepthCrafter into ComfyUI
Other
164 stars 5 forks source link

[BUG] Input type (struct c10::Half) and bias type (float) should be the same #2

Closed brayevalerien closed 1 week ago

brayevalerien commented 2 weeks ago

Here is the full ComfyUI report when I run my workflow (simple depthcrafter workflow with rife interpolation to avoid using depthcrafter for all frames).

ComfyUI Error Report

Error Details

## System Information
- **ComfyUI Version:** v0.2.3-23-g83ca891
- **Arguments:** main.py
- **OS:** nt
- **Python Version:** 3.10.11 | packaged by Anaconda, Inc. | (main, May 16 2023, 00:55:32) [MSC v.1916 64 bit (AMD64)]
- **Embedded Python:** false
- **PyTorch Version:** 2.4.1+cu124
## Devices

- **Name:** cuda:0 Quadro RTX 6000 : cudaMallocAsync
  - **Type:** cuda
  - **VRAM Total:** 25769476096
  - **VRAM Free:** 19642512896
  - **Torch VRAM Total:** 4798283776
  - **Torch VRAM Free:** 60356096

## Logs

[...]

2024-10-21 16:50:06,115 - root - INFO - got prompt 2024-10-21 16:50:33,291 - root - ERROR - !!! Exception during processing !!! Input type (struct c10::Half) and bias type (float) should be the same 2024-10-21 16:50:33,293 - root - ERROR - Traceback (most recent call last): File "C:...\ComfyUI\execution.py", line 323, 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:...\ComfyUI\execution.py", line 198, 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:...\ComfyUI\execution.py", line 169, in _map_node_over_list process_inputs(input_dict, i) File "C:...\ComfyUI\execution.py", line 158, in process_inputs results.append(getattr(obj, func)(inputs)) File "C:...\comfyui\custom_nodes\ComfyUI-DepthCrafter-Nodes\nodes.py", line 181, in process result = pipe( File "C:...\anaconda3\envs\comfyui\lib\site-packages\torch\utils_contextlib.py", line 116, in decorate_context return func(args, kwargs) File "C:...\comfyui\custom_nodes\ComfyUI-DepthCrafter-Nodes\depthcrafter\depth_crafter_ppl.py", line 359, in call frames = self.decode_latents(latents_all, num_frames, decode_chunk_size) File "C:...\anaconda3\envs\comfyui\lib\site-packages\diffusers\pipelines\stable_video_diffusion\pipeline_stable_video_diffusion.py", line 300, in decode_latents frame = self.vae.decode(latents[i : i + decode_chunk_size], decode_kwargs).sample File "C:...\anaconda3\envs\comfyui\lib\site-packages\diffusers\utils\accelerate_utils.py", line 46, in wrapper return method(self, args, kwargs) File "C:...\anaconda3\envs\comfyui\lib\site-packages\diffusers\models\autoencoders\autoencoder_kl_temporal_decoder.py", line 366, in decode decoded = self.decoder(z, num_frames=num_frames, image_only_indicator=image_only_indicator) File "C:...\anaconda3\envs\comfyui\lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl return self._call_impl(*args, kwargs) File "C:...\anaconda3\envs\comfyui\lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl return forward_call(*args, *kwargs) File "C:...\anaconda3\envs\comfyui\lib\site-packages\diffusers\models\autoencoders\autoencoder_kl_temporal_decoder.py", line 95, in forward sample = self.conv_in(sample) File "C:...\anaconda3\envs\comfyui\lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl return self._call_impl(args, kwargs) File "C:...\anaconda3\envs\comfyui\lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl return forward_call(*args, **kwargs) File "C:...\anaconda3\envs\comfyui\lib\site-packages\torch\nn\modules\conv.py", line 458, in forward return self._conv_forward(input, self.weight, self.bias) File "C:...\anaconda3\envs\comfyui\lib\site-packages\torch\nn\modules\conv.py", line 454, in _conv_forward return F.conv2d(input, weight, bias, self.stride, RuntimeError: Input type (struct c10::Half) and bias type (float) should be the same

2024-10-21 16:50:33,295 - root - INFO - Prompt executed in 27.06 seconds

## Attached Workflow
You can try loading my workflow after saving it as a json file. My video is a 10 seconds long mp4 file.

{"last_node_id":15,"last_link_id":17,"nodes":[{"id":12,"type":"VHS_LoadVideo","pos":{"0":240,"1":480},"size":[400,500],"flags":{},"order":0,"mode":0,"inputs":[{"name":"meta_batch","type":"VHS_BatchManager","link":null,"shape":7},{"name":"vae","type":"VAE","link":null,"shape":7}],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[14]},{"name":"frame_count","type":"INT","links":null},{"name":"audio","type":"AUDIO","links":null},{"name":"video_info","type":"VHS_VIDEOINFO","links":null}],"properties":{"Node name for S&R":"VHS_LoadVideo","ttNbgOverride":{"color":"rgba(0,0,0,.8)","groupcolor":"#444"}},"widgets_values":{"video":"mouse_heads_01.mp4","force_rate":0,"force_size":"Disabled","custom_width":512,"custom_height":512,"frame_load_cap":50,"skip_first_frames":0,"select_every_nth":3,"choose video to upload":"image","videopreview":{"hidden":false,"paused":false,"params":{"frame_load_cap":50,"skip_first_frames":0,"force_rate":0,"select_every_nth":3,"filename":"mouse_heads_01.mp4","type":"input","format":"video/mp4"},"muted":false}},"color":"rgba(0,0,0,.8)"},{"id":13,"type":"VHS_VideoCombine","pos":{"0":1460,"1":480},"size":[440,320],"flags":{},"order":4,"mode":0,"inputs":[{"name":"images","type":"IMAGE","link":17},{"name":"audio","type":"AUDIO","link":null,"shape":7},{"name":"meta_batch","type":"VHS_BatchManager","link":null,"shape":7},{"name":"vae","type":"VAE","link":null,"shape":7}],"outputs":[{"name":"Filenames","type":"VHS_FILENAMES","links":null}],"properties":{"Node name for S&R":"VHS_VideoCombine","ttNbgOverride":{"color":"rgba(0,0,0,.8)","groupcolor":"#444"}},"widgets_values":{"frame_rate":24,"loop_count":0,"filename_prefix":"DepthCrafter/mouse_heads_depth","format":"video/h265-mp4","pix_fmt":"yuv420p10le","crf":22,"save_metadata":true,"pingpong":false,"save_output":true,"videopreview":{"hidden":false,"paused":false,"params":{},"muted":false}},"color":"rgba(0,0,0,.8)"},{"id":15,"type":"RIFE VFI","pos":{"0":1060,"1":480},"size":[380,200],"flags":{},"order":3,"mode":0,"inputs":[{"name":"frames","type":"IMAGE","link":16},{"name":"optional_interpolation_states","type":"INTERPOLATION_STATES","link":null,"shape":7}],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[17],"slot_index":0}],"properties":{"Node name for S&R":"RIFE VFI","ttNbgOverride":{"color":"rgba(0,0,0,.8)","groupcolor":"#444"}},"widgets_values":["rife49.pth",10,3,true,true,1],"color":"rgba(0,0,0,.8)"},{"id":11,"type":"DownloadAndLoadDepthCrafterModel","pos":{"0":680,"1":480},"size":[360,40],"flags":{},"order":1,"mode":0,"inputs":[],"outputs":[{"name":"depthcrafter_model","type":"DEPTHCRAFTER_MODEL","links":[13],"slot_index":0}],"properties":{"Node name for S&R":"DownloadAndLoadDepthCrafterModel","ttNbgOverride":{"color":"rgba(0,0,0,.8)","groupcolor":"#444"}},"color":"rgba(0,0,0,.8)"},{"id":14,"type":"DepthCrafter","pos":{"0":679.9232788085938,"1":567.9940185546875},"size":{"0":360,"1":180},"flags":{},"order":2,"mode":0,"inputs":[{"name":"depthcrafter_model","type":"DEPTHCRAFTER_MODEL","link":13},{"name":"images","type":"IMAGE","link":14}],"outputs":[{"name":"depth_maps","type":"IMAGE","links":[16],"slot_index":0}],"properties":{"Node name for S&R":"DepthCrafter","ttNbgOverride":{"color":"rgba(0,0,0,.8)","groupcolor":"#444"}},"widgets_values":[512,10,1.2,110,25],"color":"rgba(0,0,0,.8)"}],"links":[[13,11,0,14,0,"DEPTHCRAFTER_MODEL"],[14,12,0,14,1,"IMAGE"],[16,14,0,15,0,"IMAGE"],[17,15,0,13,0,"IMAGE"]],"groups":[],"config":{},"extra":{"ds":{"scale":1.283902517749503,"offset":[-284.34608746345356,-311.5175631633613]}},"version":0.4}

akatz-ai commented 2 weeks ago

Hi @brayevalerien thank you for the detailed write up. I was not immediately able to reproduce the error with the provided workflow but I have encountered the same bug infrequently in previous testing. Will update here once I've come up with a possible fix.

brayevalerien commented 2 weeks ago

I must admit that I did not try to disable all my custom nodes and see if the issue still hapened. But it looks like it's a DepthCrafter issue more than a node issue.

akatz-ai commented 1 week ago

Hi @brayevalerien , I just merged in #3 which attempts to fix the precision mismatch error above. Please try the workflow again and let me know if you run into the same issue.

brayevalerien commented 1 week ago

Hello @akatz-ai, sorry for the late answer.

Just tested it, same workflow, same input, and the issue is gone. Thanks a lot for the fix!