WanAnimatePlus TorchCompileSettings
Make torch.compile actually fit your Wan model
- torch_compile_args
torch.compile is the community's favorite free lunch for video speed - the JIT compilation that folds your model's forward pass into optimized kernels and cuts iteration time meaningfully on a card with the VRAM to spare. It's also the thing that either works in ten minutes or eats your whole afternoon with Triton build errors. This node is the sane middle path: instead of hoping your model loader compiles the right things, you configure it explicitly, and the WanAnimatePlus model loader applies it when it loads the checkpoint.
The description is blunt about requirements: it needs Triton, and torch > 2.7.0 is recommended. On Windows, Triton install is the notorious pain point - the community has essentially one person maintaining Windows Triton builds, and half the torch.compile failure threads on r/comfyui are someone without a working Triton. Check that first; this node can't fix what isn't installed.
The knobs
backend-inductor(default) orcudagraphs.mode-default,max-autotune,max-autotune-no-cudagraphs, orreduce-overhead.reduce-overheadis the usual speed pick once the graph is warm;max-autotunecan be worth it for long clips where the search cost amortizes.fullgraph/dynamic- off by default;fullgraphdemands the whole graph be one unit (stricter, occasionally errors on awkward code),dynamicrelaxes shape assumptions and costs speed.compile_transformer_blocks_only- on by default, and it's the smart default: compile just the transformer blocks, which is where the time goes, and skip the fiddly parts that cause graph breaks. Faster to compile, less error-prone.dynamo_cache_size_limit(64) anddynamo_recompile_limit(128) - torch dynamo config dials; you'll touch these only if you're seeing graph-recompile warnings.
The optional allow_unmerged_lora_compile flag lets LoRA application be compiled too, to avoid graph breaks - but the tooltip warns it "causes issues with some LoRAs, mostly dynamic ones." Leave it off unless a profile tells you LoRA application is your bottleneck.
How it fits
The output is a torch_compile_args object (WANCOMPILEARGS), which you wire into the compile_args input on WanAnimatePlus ModelLoader (and, if you're compiling the controlnet too, into WanAnimatePlus Uni3C ControlnetLoader). Nothing compiles the moment you configure it - the compilation happens at load/sample time, and the first run pays a one-time warm-up cost before the per-step speedup kicks in. That's the contract: suffer the compile once, enjoy every step after.
Install
Part of the WanAnimatePlus pack:
cd ComfyUI/custom_nodes
git clone https://github.com/wuwukaka/ComfyUI-WanAnimatePlus.git
Restart ComfyUI, or grab it via Manager (search "ComfyUI-WanAnimatePlus"). Before you blame this node for a slow first run, confirm Triton is importable in your Python environment and your torch is recent - that's where 90% of torch.compile complaints actually live. And per the pack README, keep the original ComfyUI-WanVideoWrapper installed and don't mix node families in one workflow.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| backend | COMBO | inductor | 2 options: inductor, cudagraphs |
| fullgraph | BOOLEAN | false | Enable full graph mode |
| mode | COMBO | default | 4 options: default, max-autotune, max-autotune-no-cudagraphs, reduce-overhead |
| dynamic | BOOLEAN | false | Enable dynamic mode |
| dynamo_cache_size_limit | INT | 640–1024 | torch._dynamo.config.cache_size_limit |
| compile_transformer_blocks_only | BOOLEAN | true | Compile only the transformer blocks, usually enough and can make compilation faster and less error prone |
| dynamo_recompile_limitopt | INT | 1280–1024 | torch._dynamo.config.recompile_limit |
| force_parameter_static_shapesopt | BOOLEAN | false | torch._dynamo.config.force_parameter_static_shapes |
| allow_unmerged_lora_compileopt | BOOLEAN | false | Allow LoRA application to be compiled with torch.compile to avoid graph breaks, causes issues with some LoRAs, mostly dynamic ones |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| torch_compile_args | WANCOMPILEARGS | — |