ComfyUI-WanVideoWrapper icon indicating copy to clipboard operation
ComfyUI-WanVideoWrapper copied to clipboard

Wan 2.2 5B example workflow

Open erosDiffusion opened this issue 1 year ago • 12 comments

Hi Kijai, thanks for the tremendous work. would you have a 5B workflow example as well ?

thanks.

erosDiffusion avatar Jul 29 '25 11:07 erosDiffusion

+1 , seems to ask for double the size in dim 0 ? (at any resolution) If you replace 14b i2v model and try to use it directly But does work with EmptyEmbeds , so something is wrong with 2.2 vae maybe or how it's used

Image

siraxe avatar Jul 29 '25 14:07 siraxe

me too. Sizes of tensors must match except in dimension 0. Expected size 88 but got size 44 for tensor number 1 in the list.

poechia avatar Jul 29 '25 14:07 poechia

I modified nodes.py on my machine to get the expected tensor size to match, but then I just get an error that it expected 48 channels but got 100 when it gets to the sampler. I also noticed that, in the output, it says it detected a 5B model, but then in the very next line, it says "Model variant detected: 14B". It seems like it needs some work to make the 5B model compatible.

RockTheCosmos avatar Jul 29 '25 16:07 RockTheCosmos

It's not finished but you can use the extra_latents in the empty embeds node to pass the image, the image encode node is not used. Basically it's same workflow as the Pusa example currently, just without Pusa LoRA and using the new VAE with 5B model.

kijai avatar Jul 29 '25 17:07 kijai

Getting a tensor size mismatch error on the sampler when using the empty embeds node.

RockTheCosmos avatar Jul 29 '25 19:07 RockTheCosmos

It's not finished but you can use the extra_latents in the empty embeds node to pass the image, the image encode node is not used. Basically it's same workflow as the Pusa example currently, just without Pusa LoRA and using the new VAE with 5B model.

here is the working worklfow according to the instructions (with some small tweaks).

5b_working (1).json

it was quite slow due to memory usage which is the problem I actually wanted to solve (3000sec on 3080 10gb vram). I could not avoid swapping to dram.

the result is also a bit wierd with these blue flashes of possibly not denoised islands.

https://github.com/user-attachments/assets/1715608d-4765-416d-b307-7a2b4242fbad

erosDiffusion avatar Jul 29 '25 21:07 erosDiffusion

There was a slight bug that causes the first frame flash, fixed that now and tested some myself, it's pretty decent at high res:

https://github.com/user-attachments/assets/315ac8b9-94f1-41ea-9135-aa608e0cca1c

kijai avatar Jul 29 '25 21:07 kijai

but no see Wan2_2_VAE_bf16 files on huggingface.

ioritree avatar Jul 29 '25 23:07 ioritree

but no see Wan2_2_VAE_bf16 files on huggingface.

https://huggingface.co/Kijai/WanVideo_comfy/blob/main/Wan2_2_VAE_bf16.safetensors

kijai avatar Jul 30 '25 06:07 kijai

There was a slight bug that causes the first frame flash, fixed that now and tested some myself, it's pretty decent at high res:

WanVideoWrapper_5BI2V_00003.mp4

thanks. i see you added the example as well.

ComfyUI-WanVideoWrapper/example_workflows /wanvideo_2_2_5B_I2V_example_WIP.json

I'm still having some issues but I think it's due to my install.

I believe this can be closed. Thanks for the prompt answers and fixes.

erosDiffusion avatar Jul 30 '25 07:07 erosDiffusion

example workflow issure

!!! Exception during processing !!! Given groups=1, weight of size [256, 16, 3, 3], expected input[1, 48, 44, 80] to have 16 channels, but got 48 channels instead Traceback (most recent call last): File "G:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 427, in execute output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 270, in get_output_data return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 244, in _async_map_node_over_list await process_inputs(input_dict, i) File "G:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 232, in process_inputs result = f(**inputs) ^^^^^^^^^^^ File "G:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-WanVideoWrapper\nodes.py", line 2863, in process callback(idx, callback_latent, None, len(timesteps)) File "G:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-WanVideoWrapper\latent_preview.py", line 111, in callback preview_bytes = previewer.decode_latent_to_preview_image(preview_format, x0) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-WanVideoWrapper\latent_preview.py", line 165, in decode_latent_to_preview_image num_images)).run() ^^^^^ File "threading.py", line 1012, in run File "G:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-WanVideoWrapper\latent_preview.py", line 170, in process_previews image_tensor = self.decode_latent_to_preview(image_tensor) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-WanVideoWrapper\latent_preview.py", line 222, in decode_latent_to_preview x_sample = self.taesd.decode_video(x0, parallel=False, show_progress_bar=False)[0].permute(0, 2, 3, 1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-WanVideoWrapper\taehv\taehv.py", line 218, in decode_video x = apply_model_with_memblocks(self.decoder, x, self.parallel, show_progress_bar) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-WanVideoWrapper\taehv\taehv.py", line 141, in apply_model_with_memblocks xt = b(xt) ^^^^^ File "G:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1751, in _wrapped_call_impl return self._call_impl(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1762, in _call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\conv.py", line 554, in forward return self._conv_forward(input, self.weight, self.bias) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\conv.py", line 549, in _conv_forward return F.conv2d( ^^^^^^^^^ RuntimeError: Given groups=1, weight of size [256, 16, 3, 3], expected input[1, 48, 44, 80] to have 16 channels, but got 48 channels instead

ioritree avatar Jul 30 '25 08:07 ioritree

example workflow issure

!!! Exception during processing !!! Given groups=1, weight of size [256, 16, 3, 3], expected input[1, 48, 44, 80] to have 16 channels, but got 48 channels instead Traceback (most recent call last): File "G:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 427, in execute output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 270, in get_output_data return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 244, in _async_map_node_over_list await process_inputs(input_dict, i) File "G:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 232, in process_inputs result = f(**inputs) ^^^^^^^^^^^ File "G:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-WanVideoWrapper\nodes.py", line 2863, in process callback(idx, callback_latent, None, len(timesteps)) File "G:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-WanVideoWrapper\latent_preview.py", line 111, in callback preview_bytes = previewer.decode_latent_to_preview_image(preview_format, x0) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-WanVideoWrapper\latent_preview.py", line 165, in decode_latent_to_preview_image num_images)).run() ^^^^^ File "threading.py", line 1012, in run File "G:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-WanVideoWrapper\latent_preview.py", line 170, in process_previews image_tensor = self.decode_latent_to_preview(image_tensor) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-WanVideoWrapper\latent_preview.py", line 222, in decode_latent_to_preview x_sample = self.taesd.decode_video(x0, parallel=False, show_progress_bar=False)[0].permute(0, 2, 3, 1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-WanVideoWrapper\taehv\taehv.py", line 218, in decode_video x = apply_model_with_memblocks(self.decoder, x, self.parallel, show_progress_bar) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-WanVideoWrapper\taehv\taehv.py", line 141, in apply_model_with_memblocks xt = b(xt) ^^^^^ File "G:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1751, in _wrapped_call_impl return self._call_impl(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1762, in _call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\conv.py", line 554, in forward return self._conv_forward(input, self.weight, self.bias) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\conv.py", line 549, in _conv_forward return F.conv2d( ^^^^^^^^^ RuntimeError: Given groups=1, weight of size [256, 16, 3, 3], expected input[1, 48, 44, 80] to have 16 channels, but got 48 channels instead

TAESD previews don't currently work with the 5B model because we don't have a tiny autoencoder for the new VAE, this currently errors out and you would need to switch the preview method to latent2rgb instead.

kijai avatar Jul 30 '25 10:07 kijai