Skip to content
Open
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 @@ -128,6 +128,13 @@ def __init__(
timesteps = torch.from_numpy(timesteps).to(dtype=torch.float32)

sigmas = timesteps / num_train_timesteps
# Store sigma_min / sigma_max from the *unshifted* sigmas. `set_timesteps` uses these
# to seed the per-call schedule and then re-applies `shift` itself — storing the
# post-shift values here would make `set_timesteps` shift a second time and produce
# sigmas that don't match `__init__`'s schedule (#13243).
self.sigma_min = sigmas[-1].item()
self.sigma_max = sigmas[0].item()

if not use_dynamic_shifting:
# when use_dynamic_shifting is True, we apply the timestep shifting on the fly based on the image resolution
sigmas = shift * sigmas / (1 + (shift - 1) * sigmas)
Expand All @@ -140,8 +147,6 @@ def __init__(
self._shift = shift

self.sigmas = sigmas.to("cpu") # to avoid too much CPU/GPU communication
self.sigma_min = self.sigmas[-1].item()
self.sigma_max = self.sigmas[0].item()

@property
def shift(self):
Expand Down
Loading