Nodes/KJNodes for ComfyUI/TorchCompileModelQwenImage
ComfyUI Node Runs on cloud

TorchCompileModelQwenImage

Deprecated — torch.compile for Qwen-Image now lives elsewhere

By kijai·Created 3 years ago·Updated a day ago· 2,908
TorchCompileModelQwenImage
  • model
  • *

The node's own description says everything you need to know before you wire it into anything: "This node has been replaced with TorchCompileModelAdvanced node, please use that instead." It's still in the pack purely so old workflows don't break on load - Kijai isn't recommending you reach for it.

It exists because, for a while, KJNodes shipped a separate torch.compile wrapper per model architecture - one for LTX, one for Wan Video, one for Qwen-Image. This is that Qwen-Image one. torch.compile is PyTorch's JIT compiler: it traces your model's forward pass once and swaps in a compiled version that runs faster on repeat calls at the same input shape. The trade is real and unavoidable - the first pass after compiling is slower than eager mode, sometimes noticeably so, because that's when the trace actually happens. Every subsequent call at the same resolution and batch size is where you get paid back.

That trade-off matters more for some workloads than others. It pays off fastest when you're running the same model shape over and over - many video frames per clip, or many still images generated back to back at a fixed resolution in one session. A single one-off image generation at a resolution you'll never repeat is close to the worst case for torch.compile: you eat the full compile cost and only get to spend it once.

Inputs and outputs

Bare-minimum schema, typed loosely on purpose:

  • model (*, required) - whatever Qwen-Image model object your loader hands it.
  • Output: * - the same object, now compiled.

No backend choice, no mode, no way to tune what kind of compile you're getting. That's exactly what its replacement fixes.

What to use instead

TorchCompileModelAdvanced is the current node in this pack for compiling a diffusion model. Where this deprecated node just wraps whatever you feed it with no options, the Advanced node exposes the actual controls - this pack's TorchCompileVAE node (not deprecated, still current) shows the shape of what that family of options looks like: a backend choice, an optimization mode, and a strictness flag for whether the compiler is allowed to fall back to eager mode on parts it can't trace.

How to install it

Comes with the pack - no separate step.

Via ComfyUI Manager: search KJNodes for ComfyUI, install, restart.

Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-KJNodes
pip install -r ComfyUI-KJNodes/requirements.txt

Then restart. Nothing to download for this node specifically - it compiles a model you've already loaded rather than fetching weights.

Common issues & troubleshooting

It's missing from the node menu. Expected on newer Manager registries, which can hide deprecated nodes from search. Look for TorchCompileModelAdvanced instead - that's the active one.

Your first generation after adding this got slower, and nothing after that. If every generation in your session is at a different resolution, you never reach the point where compiling pays for itself - you're re-paying the trace cost each time with nothing to amortize it against. Keep resolution fixed across a batch of runs if you want to see the actual speedup.

Errors on Windows, or it just silently does nothing. torch.compile's default backend depends on Triton, and Triton support on Windows has been a long-running pain point in this ecosystem - painful enough that one community member ended up maintaining unofficial Windows Triton builds. If you hit a wall here, that's almost always it, and it's precisely why TorchCompileModelAdvanced gives you a non-Triton backend option this deprecated node never did.

CategoryKJNodes/deprecated

Inputs (1)

NameTypeDefaultDescription
model*

Outputs (1)

NameTypeDescription
**