Skip to content

Commit e42fdb8

Browse files
committed
Slight performance improvement to EDMEuler
1 parent a167876 commit e42fdb8

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/diffusers/schedulers/scheduling_edm_euler.py

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

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

336-
noise = randn_tensor(
337-
model_output.shape, dtype=model_output.dtype, device=model_output.device, generator=generator
338-
)
339-
340-
eps = noise * s_noise
341336
sigma_hat = sigma * (gamma + 1)
342337

343338
if gamma > 0:
339+
noise = randn_tensor(
340+
model_output.shape, dtype=model_output.dtype, device=model_output.device, generator=generator
341+
)
342+
eps = noise * s_noise
344343
sample = sample + eps * (sigma_hat**2 - sigma**2) ** 0.5
345344

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

0 commit comments

Comments
 (0)