Nodes/ComfyUI-WanAnimatePlus/WanAnimatePlus TorchCompileSettings
ComfyUI Node

WanAnimatePlus TorchCompileSettings

Make torch.compile actually fit your Wan model

By wuwukaka·Created 4 months ago·Updated about a month ago· 409
WanAnimatePlus TorchCompileSettings
    • torch_compile_args
    backendinductor
    fullgraphfalse
    modedefault
    dynamicfalse
    dynamo_cache_size_limit64
    compile_transformer_blocks_onlytrue
    dynamo_recompile_limit128
    force_parameter_static_shapesfalse
    allow_unmerged_lora_compilefalse

    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) or cudagraphs.
    • mode - default, max-autotune, max-autotune-no-cudagraphs, or reduce-overhead. reduce-overhead is the usual speed pick once the graph is warm; max-autotune can be worth it for long clips where the search cost amortizes.
    • fullgraph / dynamic - off by default; fullgraph demands the whole graph be one unit (stricter, occasionally errors on awkward code), dynamic relaxes 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) and dynamo_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.

    CategoryWanAnimatePlus

    Inputs (9)

    NameTypeDefaultDescription
    backendCOMBOinductor2 options: inductor, cudagraphs
    fullgraphBOOLEANfalseEnable full graph mode
    modeCOMBOdefault4 options: default, max-autotune, max-autotune-no-cudagraphs, reduce-overhead
    dynamicBOOLEANfalseEnable dynamic mode
    dynamo_cache_size_limitINT640–1024torch._dynamo.config.cache_size_limit
    compile_transformer_blocks_onlyBOOLEANtrueCompile only the transformer blocks, usually enough and can make compilation faster and less error prone
    dynamo_recompile_limitoptINT1280–1024torch._dynamo.config.recompile_limit
    force_parameter_static_shapesoptBOOLEANfalsetorch._dynamo.config.force_parameter_static_shapes
    allow_unmerged_lora_compileoptBOOLEANfalseAllow LoRA application to be compiled with torch.compile to avoid graph breaks, causes issues with some LoRAs, mostly dynamic ones

    Outputs (1)

    NameTypeDescription
    torch_compile_argsWANCOMPILEARGS