Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,10 @@ def set_timesteps(
else:
sigmas = self.shift * sigmas / (1 + (self.shift - 1) * sigmas)

# 3. If required, stretch the sigmas schedule to terminate at the configured `shift_terminal` value
if self.config.shift_terminal:
# 3. If required, stretch the sigmas schedule to terminate at the configured `shift_terminal` value. This is
# skipped when there is only a single step, since there is nothing to stretch and the terminal rescaling
# otherwise divides by zero (the single sigma is always 1.0, i.e. `one_minus_z[-1]` is always 0).
if self.config.shift_terminal and len(sigmas) > 1:
sigmas = self.stretch_shift_to_terminal(sigmas)
Comment on lines +353 to 357

# 4. If required, convert sigmas to one of karras, exponential, or beta sigma schedules
Expand Down
6 changes: 4 additions & 2 deletions src/diffusers/schedulers/scheduling_flow_match_lcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,10 @@ def set_timesteps(
else:
sigmas = self.shift * sigmas / (1 + (self.shift - 1) * sigmas) # type: ignore

# 3. If required, stretch the sigmas schedule to terminate at the configured `shift_terminal` value
if self.config.shift_terminal:
# 3. If required, stretch the sigmas schedule to terminate at the configured `shift_terminal` value. This is
# skipped when there is only a single step, since there is nothing to stretch and the terminal rescaling
# otherwise divides by zero (the single sigma is always 1.0, i.e. `one_minus_z[-1]` is always 0).
Comment on lines +362 to +364
if self.config.shift_terminal and len(sigmas) > 1:
sigmas = self.stretch_shift_to_terminal(sigmas) # type: ignore

# 4. If required, convert sigmas to one of karras, exponential, or beta sigma schedules
Expand Down
2 changes: 1 addition & 1 deletion src/diffusers/schedulers/scheduling_unipc_multistep.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def set_timesteps(
sigmas = self.time_shift(mu, 1.0, sigmas)
else:
sigmas = self.config.flow_shift * sigmas / (1 + (self.config.flow_shift - 1) * sigmas)
if self.config.shift_terminal:
if self.config.shift_terminal and len(sigmas) > 1:
sigmas = self.stretch_shift_to_terminal(sigmas)
eps = 1e-6
if np.fabs(sigmas[0] - 1) < eps:
Expand Down
Loading