TorchCompileControlNet
This node internally uses torch。
Torch Compile Control Net
TorchCompileControlNet node, which internally uses torch.compile.
TorchCompileControlNet is a utility node designed to optimize the inference performance of ControlNet models. It leverages PyTorch's just-in-time compilation technology to convert ControlNet models into a more efficient execution format, aiming to improve the processing speed of image generation workflows.
Node Functionality
This node internally uses the torch.compile function to compile the input ControlNet model. It allows users to select different compilation backends (such as inductor or cudagraphs) and optimization modes (such as max-autotune), and supports enabling full graph mode for more aggressive optimization. The compilation process is one-time, and the node internally tracks the compilation state to avoid redundant operations.
Node Parameter Description - TorchCompileControlNet
Connection Inputs (Inputs)
| Parameter Name | Data Type | Required | Default Value | Value Range/Options | Description |
|---|---|---|---|---|---|
controlnet | CONTROL_NET | Yes | - | - | : Input the ControlNet model to be compiled and optimized. |
Control Parameters (Parameters)
| Parameter Name | Data Type | Required | Default Value | Value Range/Options | Description |
|---|---|---|---|---|---|
backend | COMBO | Yes | inductor | "inductor", "cudagraphs" | : Select the backend engine used for PyTorch compilation. Options are inductor or cudagraphs. |
mode | COMBO | Yes | default | "default", "max-autotune", "max-autotune-no-cud... | : Select the compilation optimization mode. Options are default, max-autotune, max-autotune-no-cudagraphs, or reduce-overhead. |
fullgraph | BOOLEAN | Yes | False | - | Enable full graph mode |
Output
| Parameter Name | Data Type | Description |
|---|---|---|
| CONTROL_NET | CONTROL_NET | : Outputs the compiled and optimized ControlNet model. |
Usage Scenarios
In workflows requiring rapid iteration or batch image generation, you can connect this node after the ControlNet loader and before the sampler. By compiling the ControlNet, you can significantly reduce the time consumed per sampling or multiple samplings while maintaining generation quality. This is particularly suitable for real-time applications or large-scale content creation scenarios that have requirements for generation speed.
Notes
This node is marked as an experimental feature. Its compilation effectiveness and stability may vary depending on the PyTorch version, hardware drivers, and specific models. If compilation fails, the node will throw a runtime error. You need to check environment compatibility or try different compilation parameter combinations.
TorchCompileControlNet Node Source Code Link
The TorchCompileControlNet node is from the ComfyUI-KJNodes node package.
Comments
Sign in with GitHub to join the discussion.