Skip to content

Commit a167876

Browse files
committed
Slight performance improvement to Euler
1 parent 31058cd commit a167876

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/diffusers/schedulers/scheduling_euler_discrete.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -638,14 +638,13 @@ def step(
638638

639639
gamma = min(s_churn / (len(self.sigmas) - 1), 2**0.5 - 1) if s_tmin <= sigma <= s_tmax else 0.0
640640

641-
noise = randn_tensor(
642-
model_output.shape, dtype=model_output.dtype, device=model_output.device, generator=generator
643-
)
644-
645-
eps = noise * s_noise
646641
sigma_hat = sigma * (gamma + 1)
647642

648643
if gamma > 0:
644+
noise = randn_tensor(
645+
model_output.shape, dtype=model_output.dtype, device=model_output.device, generator=generator
646+
)
647+
eps = noise * s_noise
649648
sample = sample + eps * (sigma_hat**2 - sigma**2) ** 0.5
650649

651650
# 1. compute predicted original sample (x_0) from sigma-scaled predicted noise

0 commit comments

Comments
 (0)