Torch Compile Settings

节点功能:用于配置 PyTorch 的 torch.compile 编译参数,用于 FramePack 视频模型加载时对其指定的模块进行 JIT 编译,以优化推理速度

输出参数

参数名称说明
torch_compile_argsTorch 编译配置参数集合,用于模型加载器。

控件参数

参数名称说明
backend指定 torch.compile 使用的后端优化引擎。inductor 是最常用的 JIT 编译后端,推荐使用;cudagraphs 更适合静态图。需根据硬件和模型选择。
fullgraph是否启用完整图模式。若为 True,则要求模型是完整图结构,优化幅度更大,但对动态模型不友好。建议默认关闭。
modetorch 编译模式,控制优化策略。 优化策略。 - default: 默认配置; - max-autotune: 最大性能自动调优; - max-autotune-no-cudagraphs: 禁用 cudagraphs 的最大调优版本; - reduce-overhead: 优化启动性能,适用于短模型。建议从 default 开始测试。
dynamic是否启用动态形状支持。如果模型输入尺寸会变,建议启用。否则可关闭以获得更高性能。
dynamo_cache_size_limit设置 Torch Dynamo 的缓存大小上限。
compile_single_blocks是否对单层 block 进行编译。推荐开启,可以减少显存压力,提高模块复用。
compile_double_blocks是否对双层 block(Transformer 结构)进行编译。推荐开启,对大型模型如 Transformer 特别有效。

使用torch compile和不使用torch compile的时间差距不是很大。在FramePackSampler节点中已经有teacache加速了,因此可以不用使用该节点进行加速了。

没使用torch compile的生成时间

使用了torch compile的生成时间,但是这次在解码时卡住了,没解码出视频。