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
20 changes: 20 additions & 0 deletions b/src/diffusers/schedulers/scheduling_flow_match_euler_discrete.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
self._shift = shift

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

@property
def shift(self):
timesteps = torch.from_numpy(timesteps).to(dtype=torch.float32)

sigmas = timesteps / num_train_timesteps

# Compute sigma_min/sigma_max from the unshifted sigmas so that set_timesteps()
# does not apply timestep shifting twice -- it already applies shift/recomputation
# from sigma_min/sigma_max.
unshifted_sigmas = sigmas.clone()

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)
Loading
Loading