[Request] add display “discrete_flow_shift”, “timestep_sampling”

用户在使用 Kohya SD Scripts 训练 Anima 或 Flow Matching 模型(如 SD3、Flux 架构相关)时,配置了 discrete_flow_shift 但不确定该参数是否被正确使用。尤其是当 timestep_sampling 设置为 flux_shift 时, d

[Request] add display "discrete_flow_shift", "timestep_sampling"

[Request] add display “discrete_flow_shift”, “timestep_sampling”

快速结论:该请求在 Kohya SD Scripts 的训练日志中加入 timestep_samplingdiscrete_flow_shift 的当前设置值显示,目的是让用户直观确认 discrete_flow_shift 是否实际生效。该功能已在合并的 PR 中按预期实现,无需额外命令即可在终端日志中查看。

问题场景

用户在使用 Kohya SD Scripts 训练 AnimaFlow Matching 模型(如 SD3、Flux 架构相关)时,配置了 discrete_flow_shift 但不确定该参数是否被正确使用。尤其是当 timestep_sampling 设置为 flux_shift 时,discrete_flow_shift 会被忽略,而用户没有直观的方式观察到这一状态。

报错原文

# 非错误,而是缺少 Info 日志。原讨论希望新增的输出格式示例:

                    INFO     Timestep sampling: timestep_sampling=shift, discrete_flow_shift=3.0 flux_train_utils.py:565
                             (applied), sigmoid_scale=1.0

                    INFO     Timestep sampling: timestep_sampling=flux_shift,                    flux_train_utils.py:565
                             discrete_flow_shift=3.0 (IGNORED for
                             timestep_sampling='flux_shift'; only 'sigma' and 'shift' use it),
                             sigmoid_scale=1.0

原因分析

这是一个功能请求,而非 Bug。原因在于:discrete_flow_shift 仅在 timestep_samplingsigmashift 时生效;当 timestep_samplingflux_shift 时,该值被忽略。由于先前训练开始时没有明确的日志输出,用户无法轻松确认当前配置的生效状态,导致调试困难或误解设定是否起作用。

环境排查

  • 确认 Kohya SD Scripts 的版本:该功能已在较新版本(2024年6月附近合并)中内置,需要更新至包含该日志输出的版本。
  • 如果无法看到新增日志,检查是否使用了自定义或过时的脚本分支。
  • 训练日志通常在终端(PowerShell / Terminal)输出,不需要额外命令行参数即可显示。

解决步骤

  1. 更新 sd-scripts 到最新版本: 拉取仓库最新提交,确保包含相关更改(涉及 flux_train_utils.py 中的日志行)。
  2. 正常启动训练: 无需任何额外参数。运行训练命令(例如 accelerate launch train_flux.py ...)后,训练开始时会在日志中看到类似以下格式的输出:
    INFO     Timestep sampling: timestep_sampling=shift, discrete_flow_shift=3.0 (applied), sigmoid_scale=1.0

    INFO     Timestep sampling: timestep_sampling=flux_shift, discrete_flow_shift=3.0 (IGNORED for timestep_sampling='flux_shift'; only 'sigma' and 'shift' use it), sigmoid_scale=1.0
  3. 确认生效状态: 如果日志中显示 (applied),表示 discrete_flow_shift 值被使用;如果显示 (IGNORED),则表示当前 timestep_sampling 设置不适用该参数,需要调整。

验证方法

启动训练后,在终端日志的前几行中定位到 “Timestep sampling:” 开头的信息。检查 discrete_flow_shift 后面是否显示 “applied” 或 “IGNORED”,并与你期望的配置比对。该行日志来自 flux_train_utils.py 文件。

参考来源

kohya-ss/sd-scripts #2383

GamsGo AI

AI 工具推荐

想把多个 AI 模型放在一个入口?

GamsGo AI 集成 ChatGPT、DeepSeek、Gemini、Claude、Midjourney、Veo 等常用模型,适合写作、绘图、视频和日常 AI 工作流。

了解 GamsGo AI

推广链接:通过此链接购买,我可能获得佣金,不影响你的价格。

celebrityanime
celebrityanime
文章: 8979

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注