KJNodes/torchcompilegenerated
TorchCompileControlNet
该节点在内部使用 torch。
Torch Compile Control Net
controlnet
CONTROL_NET
backend
COMBO
fullgraph
mode
default
KJNodes
TorchCompileControlNet 节点,该节点在内部使用 torch.compile。
TorchCompileControlNet 是一个用于优化 ControlNet 模型推理性能的工具节点。它通过 PyTorch 的即时编译技术,将 ControlNet 模型转换为更高效的执行格式,旨在提升图像生成工作流的处理速度。
节点功能
该节点在内部使用 torch.compile 函数对输入的 ControlNet 模型进行编译。它允许用户选择不同的编译后端(如 inductor 或 cudagraphs)和优化模式(如 max-autotune),并支持启用全图模式以进行更激进的优化。编译过程是一次性的,节点内部会记录编译状态以避免重复操作。
节点参数说明 - TorchCompileControlNet
连接输入 (Inputs)
| 参数名称 | 数据类型 | 必填 | 默认值 | 取值范围/选项 | 说明 |
|---|---|---|---|---|---|
controlnet | CONTROL_NET | 是 | - | - | :输入待编译优化的 ControlNet 模型。 |
控件参数 (Parameters)
| 参数名称 | 数据类型 | 必填 | 默认值 | 取值范围/选项 | 说明 |
|---|---|---|---|---|---|
backend | COMBO | 是 | inductor | "inductor", "cudagraphs" | :选择 PyTorch 编译所使用的后端引擎。可选值为 inductor 或 cudagraphs。 |
mode | COMBO | 是 | default | "default", "max-autotune", "max-autotune-no-cudagraphs", "reduce-overhead" | :选择编译优化模式。可选值为 default、max-autotune、max-autotune-no-cudagraphs 或 reduce-overhead。 |
fullgraph | BOOLEAN | 是 | False | - | :启用完整图形模式 |
输出 (Outputs)
| 参数名称 | 数据类型 | 说明 |
|---|---|---|
| CONTROL_NET | CONTROL_NET | :输出经过编译优化后的 ControlNet 模型。 |
使用场景
在需要快速迭代或批量生成图像的工作流中,你可以将此节点连接在 ControlNet 加载器之后、采样器之前。通过编译 ControlNet,可以在保持生成质量的同时,显著减少单次或多次采样所消耗的时间,尤其适用于对生成速度有要求的实时应用或大规模内容创作场景。
注意事项
此节点标记为实验性功能,其编译效果和稳定性可能因 PyTorch 版本、硬件驱动和具体模型而异。如果编译失败,节点会抛出运行时错误,你需要检查环境兼容性或尝试不同的编译参数组合。
TorchCompileControlNet 节点源码链接
TorchCompileControlNet 节点来自 ComfyUI-KJNodes 节点包。
评论
使用 GitHub 登录后即可参与讨论。