kohya-ss / kohya-ss/sd-scripts

Shouldn't fix_noise_scheduler_betas_for_zero_terminal_snr be applied BEFORE prepare_scheduler_for_custom_training?

Open
#1,905 2 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
Python
Stars
7.2k
Forks
1.2k
Avg merge
11m
Merged PRs (30d)
2

Description

Hello,

Reference code: https://github.com/kohya-ss/sd-scripts/blob/0778dd9b1df0d6aa33287ded3ce4195f3d03251b/train_network.py#L195

I noticed that fix_noise_scheduler_betas_for_zero_terminal_snr modifies the alphas_cumprod for the noise scheduler, and prepare_scheduler_for_custom_training uses alphas_cumprod to calculate all_snr. The issue with the current order is that all_snr will reflect NON-ztsnr snrs, not ztsnr, causing anything that uses all_snr to use snrs that do not align with ztsnr.

As such, shouldn't fix_noise_scheduler_betas_for_zero_terminal_snr always be applied before prepare_scheduler_for_custom_training?

Thank you.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at train_network.py around the referenced line and inspect the calls to fix_noise_scheduler_betas_for_zero_terminal_snr and prepare_scheduler_for_custom_training. Trace how alphas_cumprod and all_snr are produced, then verify that the resulting SNR values reflect zero-terminal-SNR adjustments wherever all_snr is used.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.