TorchCompileModels
The generic torch.compile node for whatever doesn't have a dedicated one
- model
- model
RES4LYF ships dedicated torch.compile nodes for AuraFlow, Flux, and SD3.5, each tuned to that architecture's own quirks. TorchCompileModels is the one without a model family in its name - reach for it on anything those three don't cover, or when you specifically want its one extra knob the others don't expose.
How it works
Same core mechanism as the pack's other compile nodes: it traces your model's forward pass once and compiles it into optimized kernels via PyTorch's torch.compile, trading a slower first run for faster ones after. Attach it right after your model loader and it hands back a patched MODEL your sampler treats exactly the same as the original.
The inputs and outputs that matter
model(MODEL) in,modelout.backend-inductor(default, most compatible across setups) orcudagraphs(potentially faster, more brittle with dynamic shapes).mode(defaultdefault) -default,max-autotune(much longer compile, highest ceiling),max-autotune-no-cudagraphs, orreduce-overhead.fullgraph(tooltip: "Enable full graph mode") - force a single compiled graph rather than allowing silent eager fallbacks.dynamic(tooltip: "Enable dynamic mode") - tolerate changing shapes (resolution, batch size) without a full recompile.dynamo_cache_size_limit(default 64) - how many compiled graph variants get cached beforetorch._dynamobails to eager.triton_max_block_x(default 0) - a raw Triton kernel-tuning knob, capping block size along one axis. Not present on the pack's other compile nodes. Leave it at 0 (Triton's own "let it decide" default) unless you're chasing a specific performance regression on unusually large tensors or resolutions and actually know what you're tuning for.
How to install it
Via ComfyUI Manager: search RES4LYF, install, restart.
Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ClownsharkBatwing/RES4LYF
cd RES4LYF
pip install -r requirements.txt
Portable installs: use the embedded Python's pip.exe. No extra downloads for torch.compile itself - it ships with PyTorch - but inductor depends on Triton, which is notoriously finicky to get working on Windows.
Common issues & troubleshooting
Slow first generation, faster ones after. That's the compile tax working as intended, not a bug - expect it to be worst on max-autotune and best repaid by a pipeline that reuses the same shape repeatedly.
Breaks or does nothing useful when paired with LoRAs or other model patches applied afterward. torch.compile assumes a stable graph; a patch that changes the model after compiling can conflict with that. Try backing off before this node if something else touching the model starts breaking once you add compilation.
Errors mentioning Triton on Windows. Common friction with inductor-backed compiling on that platform in general - try backend=cudagraphs if inductor is giving you trouble and you're on Windows.
Tuning triton_max_block_x and seeing no change or a regression. This is an advanced, situational knob - leave it at 0 unless you have a specific reason to touch it; it's not a general speed dial.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| backend | COMBO | 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 |
| triton_max_block_x | INT | 00–4294967296 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| model | MODEL | — |