WAN 2.2 5B Workflow
A workflow for WAN 2.2 5B with multiple improvements for speed, flexibility, and usability:
Auto resolution calculator – automatically adjusts resolution based on a maximum dimension.
Video length in seconds – define duration in seconds instead of frames.
Fast interrupt – integrates BlehModelPatchFastTerminate to stop WAN generations more quickly.
FastWan LoRA – accelerates sampling. Recommended settings: steps = 4–6, CFG = 1.0.
Taew2.2 Preview – extremely fast (~1s) preview decode to check quality before running the slower
wan2.2_vae.2-Step Process – first run generates a preview with
taew2_2, second run applies the full higher quality VAE decode with upscale and interpolation.
2-Step Process
The wan2.2_vae is slooooooooow...
Sometimes the VAE decode process takes longer than the generation itself.
This workflow allows partially decoding the latent video using the taew2_2 model, which is extremely fast (usually ~1 second, depending on video length and resolution), but slightly reduces video quality.
By using taew2_2 to create a preview, you can quickly decide if the video is worth keeping or if it needs prompt/setting changes before running the slow wan2.2_vae. This saves a lot of time, especially on lower-end hardware.
How to Use
Step 1: On the first run, the workflow generates the video and decodes it with the
taew2_2model (fast preview).Step 2: If nothing is changed, the next run will decode the same latent video using the full
wan2.2_vaemodel. After that, further processing (upscale/interpolation) will be applied, if enabled.
Important
The seed must be fixed. If it changes, a new video will be generated, and the workflow won’t decode the same latent with the full wan2.2_vae.
Download
Get the taew2_2 model here:
https://github.com/madebyollin/taehv/blob/main/taew2_2.pth
Place the file in:ComfyUI\models\vae_approx\
FastWan Lora
In order to use lower step count and speedup the generation, download the FastWan lora and select it on the workflow.
After enabling it, set:
Steps: 4–6
CFG: 1.0
Source: Kijai
Workflow Options
The workflow includes several features you can enable or disable to customize the output:
Enable Fast taew2_2 Preview – Uses
taew2_2for fast preview decoding.Enable Sage Attention – Enables the use of Sage Attention during generation.
Enable Two Steps Process – Runs first with
taew2_2preview, then with fullwan2.2_vaedecoding.Enable Use Tiled VAE – Uses tiled VAE decoding for handling larger resolutions.
Enable Color Correction – Calibrates video colors using the first frame as reference.
Enable Interpolate – Interpolates the video to 50 FPS for smoother motion.
Enable Upscale – Upscales the video using the model selected in the “upscale” group.
Enable Upscaled Video Show/Save – Displays and saves the upscaled video.
Description
Fixed error "SimpleMath.execute() got an unexpected keyword argument 'c'".
Added Upscale function.
Added Interpolate function.
Added option to use Sage Attention.
Added option to use Tiled VAE Decoder.
Now it uses Power Lora Loader from rgthree package to manage LORAs.
FAQ
Comments (73)
The expanded size of the tensor (46) must match the existing size (92) at non-singleton dimension 4. Target sizes: [1, 48, 1, 61, 46]. Tensor sizes: [16, 1, 122, 92]
Are you using the wan2.2_vae? I managed to reproduce a similar error message by using the wan2.1_vae.
You can download the correct VAE here: https://civitai.com/models/1817671?modelVersionId=2056931
or
https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/blob/main/split_files/vae/wan2.2_vae.safetensors
@JCB2 same wank as the op. fucking piece of shit. using the funk wan 2.2 wank and just getting that error 48 fuckery.
@draxskoal608 with "funk wan 2.2" you mean you're using the "Wan2.2-Fun-5B" (https://huggingface.co/QuantStack/Wan2.2-Fun-5B-Control-GGUF)? If that's the case, the workflow won't work, you need to get the "Wan2.2-TI2V-5B" instead (https://huggingface.co/QuantStack/Wan2.2-TI2V-5B-GGUF).
@JCB2 OH! ok MeaCulpa
16g video memory is very fast, thank you
Resolution below 1MP seems to always introduce artefacts.
Also links to smaller sized models, so it's easier on the VRAM:
Base model & VAE:
https://huggingface.co/QuantStack/Wan2.2-TI2V-5B-GGUF/tree/main
CLIP model (Change "Load CLIP" node to GGUF version):
https://huggingface.co/city96/umt5-xxl-encoder-gguf/tree/main
On 8GB 4060 Laptop: 130s for the KSampler, 85% VRAM system usage during sampling.
On 24GB 3090 Desktop: 49s KSampler, 47% VRAM.
In both cases: 4s video, 6 steps, 1 CFG, 1MP, Q8 models, using FastWan LoRA.
After KSampler the VRAM usage spiked as high as 67% on 24GB.
I never knew that I could make videos so fast with 16gb, holy moly you're the best
If it doesnt work for you just change these models :
Right click on a node click on : Fix node recreate and now you can move it around and edit it
https://prnt.sc/4qxupUHk7vje
Oh i love this. it works, but it produces a blurry image with the following log:
"got prompt
WARNING: PlaySound.IS_CHANGED() missing 1 required positional argument: 'self'
Using pytorch attention in VAE
Using pytorch attention in VAE
VAE load device: cuda:0, offload device: cpu, dtype: torch.bfloat16
Requested to load WanVAE
loaded completely 5695.0 1344.0869674682617 True
Using scaled fp8: fp8 matrix mult: False, scale input: False
CLIP/text encoder model load device: cuda:0, offload device: cpu, current: cpu, dtype: torch.float16
gguf qtypes: F16 (524), Q8_0 (300), F32 (1)
model weight dtype torch.float16, manual cast: None
model_type FLOW
[rgthree-comfy][Power Lora Loader] Lora "wan5b\Wan2_2_5B_FastWanFullAttn_lora_rank_128_bf16.safetensors" not found, skipping.
Requested to load WanTEModel
loaded completely 8445.713032531738 6419.477203369141 True
Requested to load WAN22
loaded completely 7957.637313531142 5232.9027099609375 True
Patching comfy attention to use sageattn
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 6/6 [01:51<00:00, 18.58s/it]
Restoring initial comfy attention
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 31/31 [00:01<00:00, 25.56it/s]
Processing interrupted
Prompt executed in 160.97 seconds"
Hi mrfuckinnice, it seems like you didn't download the FastWan lora or didn't selected the right path on the power lora loader:
[rgthree-comfy][Power Lora Loader] Lora "wan5b\Wan2_2_5B_FastWanFullAttn_lora_rank_128_bf16.safetensors" not found, skipping.
You can download it here: https://huggingface.co/Kijai/WanVideo_comfy/blob/main/FastWan/Wan2_2_5B_FastWanFullAttn_lora_rank_128_bf16.safetensors
Or, if you don't want to use the lora, set the steps to 20 or higher and cfg to 4.5. But keep in mind this will take longer to generate the video.
@JCB2 It works. and yes ill try to tweak these steps and cfg. im new to comfyUI + wan. Thank you so much.
@JCB2 currently its flickering and everything with 7 steps and 4.5 cfg. ill increase the step, but is there any more alternative?
@mrfuckinnice Thats a too low step count of you dont want to use the FastWan lora, set it to 20 or higher.
Or just download the FastWan Lora and select it on the lora selector. Then you can use lower step count like 4 or 6.
Edit: Just a convo about taew22 now
The workflow was designed with the use of the 'Easy Get' and 'Easy Set' nodes. They are the key to understanding the flow. Instead of following a single wire across the entire canvas, find the 'Easy Get' for the value you want (like '⬅️VIDEO_LATENT') and then see the 'Easy Set' nodes that defines it ('➡️VIDEO_LATENT' in this case). This organizes the connections logically and prevents a tangled mess of wires.
The flow for taew2_2 is straightforward: The latent generated video is fed into the BlehTAEVideoDecode node (which loads taew2_2 to decode it into visual frames), and the resulting frames are then passed to VHS_VideoCombine to create the final video output.
@JCB2 oh I didn't mean how you used easy get or easy set. For some reason when you try to open the subgraphs it won't actually show you which node is in there, even if you expand it. Thanks I was able to get the taedecode part working. Do you know if we can do this with the encode as well? That would save so much vram. Also I noticed kijai has posted a safetensors of the vae now but I can't figure out how to use it, and he didn't respond to my question
@TheNecr0mancer I don't remember using subgraphs on this version, but I might be wrong. About the TAE encoding, there is a 'BlehTAEVideoEncode' node that converts image/videos to wan22 latent, but I haven't used it nor do I know if it is compatible with the Ksampler. It could be possible, but i don't know how we would encode/create the frames other than the start frame.
About the safetensor, I think that you need to use the Kijai wan video wrapper sampler, then it shows the video preview using the taew2_2. I remember managing to get it working with wan 2.1 once some time ago, but I don't remember exactly what I did.
@JCB2 maybe the new front end is doing something weird then, because it's treating all of the easy set nodes as multiple layered subgraphs. I wonder if there is a wan 2.2vae bf16 or something out there like some models have, to reduce it's size a bit. 5b doesn't manage vram as well as 14b for some reason
@TheNecr0mancer I've also tried searching for a faster FP8 or GGUF version of the 5b's vae but found nothing. I ended up with this strategy of using the taew for faster preview, at least this way I don't have to spend time decoding bad generations
@JCB2 yeah that regular vae is pretty nightmarish. Have you even noticed a difference in the quality of tae and the vae? It's more or less indistinguishable imo
@TheNecr0mancer at lower resolutions it gets pretty rough, at higher resolutions its less noticeable. But there is always a drop in quality, sometimes its passable
@JCB2 I probably wouldn't even be able to tell the difference because I can never get a decent quality output out ofof. 5b unless I'm using a Lora designed for a specific motion, and it always warps the face ofc.
@TheNecr0mancer yeah, 5b is very finicky. I use it sometimes because is faster and uses less vram than 14b, but I noticed that now and then I spend more time trying to generate something decent in 5b than if I had generated directly in 14b...
@JCB2 the thing that baffles me is the 5b model was obviously designed with lower end hardware in mind to get a quicker output. But then when it's main strength could come into play (low resolution) it just literally doesn't work. I always get better looking 320x480 video out of the 14b than the 720 recommended settings for 5b. Have you found any tricks for keeping identity on 5b?
@JCB2 just did a side by side of Taew and vae, and I can see a huge difference. At least I don't have to wait on long decodes for testing now.
@TheNecr0mancer It depends on the loras you use and the style of your input images.
For anime-like characters, this lora sometimes help: https://civitai.com/models/1890442/wan225bloralab . For simpler videos like the ones i posted with the workflow, you can get away without using any lora.
For NSFW with more realistic-ish images the 5b loras from iPiKo works well (https://civitai.com/user/iPiKo/models?baseModels=Wan+Video+2.2+TI2V-5B). There's also a custom version of wan 5b (https://civitai.com/models/1827161?modelVersionId=2165401) which also work with 'normal' images
@JCB2 your 5b videos turned out really good. Hopefully I can figure out the trick to getting something good with this as well. Yeah ipiko has some good lora. I'll try out that custom wan now. Thanks
i can't install this in ComfyUI? Every time I try to open the workflow, it says missing node types for BlehModelPatchFastTerminate and BlehTAEVideoDecode, and install all missing nodes button doesn't do anything, it just brings up the same error every time I restart. Why can't I get these missing nodes?
You are missing the ComfyUI-bleh nodes, either install it manually (https://github.com/blepping/ComfyUI-bleh) or use the ComfyUI Manager to install it (https://github.com/Comfy-Org/ComfyUI-Manager).
I tested using the default manager included in ComfyUI to install the bleh nodes, and for some reason its not installing it correctly.
same issue while terying to o install the bleh node via default manager included in ComfyUI to install the bleh nodes how to fix
@lovefakes0808 Either manually install the nodes manually or install this ComfyUI Manager (https://github.com/Comfy-Org/ComfyUI-Manager), then installing the BLEH nodes through it on the ComfyUI GUI.
This video show how to install the (custom) ComfyUI Manager:
https://www.youtube.com/watch?v=Si6ShFRFd0o
(the video is a bit old, so the ComfyUI GUI is a little different now, the manager button appears on the top right of the ComfyUI page)
If you don't want to download the custom ComfyUI Manager and just install the BLEH nodes, repeat the steps showed in the video, but instead of the ComfyUI Manager zip, download the BLEH nodes zip from https://github.com/blepping/ComfyUI-bleh
@JCB2 I tried to install the custom comfyui manager, which was the same thing I already had, and which still doesn't find the missing bleh nodes. I went to the bleh github page, but it doesn't have the same installation files as the comfyui manager (git clone and .bat file), so I can't "repeat the steps showed in the video", and I don't see any zip file on the bleh nodes page.
@exx on the github page there's a green "<> Code" button, click there and a "Download zip" appears. Download it and extract to your custom nodes folder
I keep going from one of these kinds of errors to another (I've had the same problem on the 14B workflow and models):
"The size of tensor a (48) must match the size of tensor b (16) at non-singleton dimension 1"
The first was because of the VAE i was using (2.1 instead of 2.2) but i can't figure out what the problem with this one is. Any help is appreciated.
# ComfyUI Error Report
## Error Details
- Node ID: 199
- Node Type: KSampler
- Exception Type: RuntimeError
- Exception Message: The size of tensor a (48) must match the size of tensor b (16) at non-singleton dimension 1
Hi DirtyDiffusion, the error seems to indicate a mismatch of models. Make sure you've selected the right clip, vae, wan 2.2 5b model, and Loras
Is there a way to skip the pause and have it generate full through with a new seed every time? I usually set it to generate like 8 or 16 options and then come back to look through them. But this setup kinda gets me stuck with 1 at a time. If there a quick edit to this flow that I'm not seeing i could do to make that possible?
Hi DirtyDiffusion, you can disable the "Two steps process" option on the Toggleable featuress section
@JCB2 lol can't believe i missed that, thanks
comfy\latent_formats.py", line 503, in process_in
return (latent - latents_mean) * self.scale_factor / latents_std
RuntimeError: The size of tensor a (48) must match the size of tensor b (16) at non-singleton dimension 1
Prompt executed in 2.69 seconds
Exception in callback ProactorBasePipeTransport.call_connection_lost(None)
handle: <Handle ProactorBasePipeTransport.call_connection_lost(None)>
Traceback (most recent call last):
yes that's with the pos 2.2 vae. and the other fucking wank this POS says
Just getting that ass fuckery.
As you saw on the other posts, this error is usually related to a mismatched model. Please check if the clip/vae models are correctly selected. If that doesn't help, you'll need to share a workflow image/json of your current setup, otherwise I won't be able to help you.
No link found in parent graph for id [195] slot [0] model
How to run this workflow?
This one appears to be a error related to your version of KJNodes, as discussed here https://github.com/kijai/ComfyUI-KJNodes/issues/369. But could another incompatibility, try updating your custom nodes to the latest version
I use it on a 6GB VRAM 3050, and after preview it seems to stop. Can I press something or setup to continue? The progress bar not change.
Either just press the "Run" button again without making any change to the workflow or disable the "Enable Two steps process" on the toggleable features.
Yesterday suddenly, after 4 hours, finished with result. Today I've made another one. Unfortunatelly I can't disable two step process, it jumps back to enable. But at least, I can make videos around 8s, 688x1024, 24 frames, with 'good' quality. But on upscale it crash, last time it can't allocate 24GB (V)RAM. Where can I set the upscale factor aroung 6GB VRAM or less?
@Cloud71 with 6gb of VRAM you are on the bare minimum needed to run the wan model, 8s at 688x1024 24f is way too much for your VRAM and most of the time will be spent doing model weight swapping on the memory. Enabling tiled VAE might help a little with the decoding process.
If you can't toggle the "Enable Two steps process" you can either just click on the run button twice when generating the video (this way, when the preview is done, it will automatically start the VAE decode/upscale process) or manually delete the "Two steps process" group inside the "VAE Decode" section, making sure the node connections remain connected in the same way.
The upscale factor is controlled by the upscale model you selected on the "Load Upscale Model" node, you can download a custom model and select it there, be it 2x or 4x. There's also the "Upscale Image By" node but it only affects the already up-scaled video, so it won't impact too much on the memory usage or time spent processing. But again, you have only 6GB of VRAM, upscalling 688x1024 by 2x or 4x might be way too much, you might need to consider either disabling the upscaling step or using a lower resolution.
I personally would suggest using a lower resolution like 640x480 or 800x600 at 5 seconds maximum.
@JCB2 Damn, I shot myself in the foot. The original workflow used RealESGRAN x2, but I had only x4 downloaded, so I've choosed that. Thx for the advice, I'll try them :)
Finally! 450 sec the prev: 544x800, 5s, 24fps, 15 min the final: 1088x1600, 5s. 50fps. Thx
Are you planning a text to video version?
@Cloud71 no, not at the moment. But if you want to use the workflow as T2V you can just disconnect the start_image link from the Wan22ImageToVideoLatent node at the Latent Video group. It will work as T2V, the resolution will be in the same aspect ratio of the "input" image
I seem to have issues with some of the nsfw content like insertion and stuff. A video of a woman sitting by a table drinking coffee seems ok, but another where she rides a man has issues where they seem to be stuck just wiggling a little. What should i do? increase cfg, steps or something? any advice?
You'll need to use loras for that, you can find some here at Civitai. But even with loras, wan 5b is very limited, so some scenes and poses simply won't work.
There used to be more lora options, even a custom trained nsfw wan 5b model, but for some reason they all decided to delete their models from civitai. You still can find some at civitai archive if you search on google
Check if all custom nodes dependencies are installed and updated using ComfyUI Manager, then enable the toggle for "Enable two steps process" at the toggleable features section.
Hello I am having the issue with massage like this:
[GetNode] ✗ Variable 'MAX_SIZE' not found! Available: (none) Tip: Make sure SetNode runs BEFORE GetNode in the graph.
Any fix on this? Thanks
Check if all dependencies are installed with the comfyui manager. Also make sure you're using a updated version of comfyui with the latest version of the custom nodes.
I encountered the same problem.
You are a Wan god. Thanks so much for this workflow. It works excellent even on an arc 770
True!
Thank you for your time and efforts, it is working great.
After test the results (preview quickly), Second step is always executed automatically. What If , I dont need the process after the first step is completed?
yes I installed and updated ALL Custom nodes, dependencies.
"Enable two steps process" Set No
But Still it is processing Two Steps process.
Any solution!, anyhow Great workflow. Thank you very much!
You have to set "Enable two steps process" to "yes", otherwise it will run everything in a single run (single step). When enabled, the first step/run will be the preview, and the second generate the final video
@JCB2 I appreciate the reply, Thank you, what if I need only first step (preview) , no need final video. (second generate)
@ranklens168 With the option set to "yes" it will only execute the second part if you press the run button again without changing anything in the workflow
@JCB2 Thank you, I need first part only (preview), when I get the preview, remaining process should be stop.
In this way I can save preview (because I need preview only), After getting the preview, I should input another image to animate , when I press the run button again , It should get preview for the another image . Thank you for your Time.
@ranklens168 My dude... That's what I'm trying to say, just set the "Enable two steps process" option to "yes".
If that isn't working, you're probably missing the "ComfyUI-mxToolkit" custom nodes dependency.
@JCB2 Thank you. You responded accurately earlier, but I didn't understand before, but now I do.
I have a weird issue where it won't save any changes like adding lora or remembering the image i loaded for the video. it just rolls back to before the additions. This usually happens after i use the workflow for a while.
It happened to me before as well, it's pretty annoying. If you use Ctrl-Z it also reverts back.
I think is some bug with ComfyUI or some dependency.
I found a way around it by loading the last video you generated as a workflow, by clicking on the ComfyUI menu->file->open and selecting the mp4 file. This way you recover your last version of the workflow and the bug goes away. Sometimes you have to delete the old bugged version or save as a new name
@JCB2 I'll give it a shot, thanks!
