XB-BOX - ⚡ Wan 编译设置
Torch.compile for Wan, as a settings bundle — and the reason AMD users should skip it
- WANCOMPILEARGS
For Wan video, torch.compile is one of the biggest free speedups on NVIDIA - the community routinely reports 1.5–2x faster iteration on 4090-class cards once the graph is compiled. The problem is that the knobs - backend, mode, fullgraph, dynamic - live inside the model loader's API, not as friendly widgets. XB_WanCompileSettings packages them as a settings node that outputs a WANCOMPILEARGS bundle you feed into XB_WanModelLoader's compile_args input. Set it once, wire it, and your loader compiles the model graph on first run.
The inputs mirror torch.compile's parameters directly: backend (only inductor is exposed, which is the right call - that's the one you want for transformers), mode (default, reduce-overhead, or max-autotune - the last is the fastest but takes the longest to compile), fullgraph (forces the whole graph to compile as one unit; True can fail on graphs that don't fit), dynamic (allow dynamic shapes, usually unnecessary for fixed-resolution video), dynamo_cache_size_limit (default 64), and compile_transformer_blocks_only (default true - compile just the transformer blocks, which is where 90% of the time goes, and skip the marginal parts).
The input you should care about most
compile_transformer_blocks_only = True is the sane default and it's the one to leave alone until you're chasing the last few percent. Compiling the full graph (fullgraph + everything) gives slightly better speed but much longer compile times and more chances to hit an inductor failure. If a workflow with this node errors during the first run with a compile error, flip fullgraph off and compile_transformer_blocks_only on before you blame the pack.
The honest take - and the AMD catch
Here's the part the README won't advertise. This node is a pure settings bundle - it doesn't compile anything itself, it just passes the args to the Wan model loader. And that loader silently drops the compile args on ROCm: the source checks if torch.version.hip and sets compile_args = None. So on AMD cards this node is a no-op by design - torch.compile on ROCm either doesn't help or crashes, and the author chose to disable it rather than break his own target platform. If you're on NVIDIA and want the speedup, keep this node, but expect the first run to be slower than normal (that's the compile pass) before everything after speeds up. On AMD, you can leave it out of the graph entirely and lose nothing.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/WJLUOXIAO/XB_ToolBox.git
then restart, or install via ComfyUI Manager ("XB_ToolBox"). Zero extra dependencies - it's a dict-building settings node. It only has an effect when wired into XB_WanModelLoader.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| backend | COMBO | inductor | 1 options: inductor |
| fullgraph | BOOLEAN | false | — |
| mode | COMBO | default | 3 options: default, reduce-overhead, max-autotune |
| dynamic | BOOLEAN | false | — |
| dynamo_cache_size_limit | INT | 640–1024 | — |
| compile_transformer_blocks_only | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| WANCOMPILEARGS | WANCOMPILEARGS | — |