Update pipeline.py
Browse files- pipeline.py +1 -11
pipeline.py
CHANGED
@@ -172,18 +172,8 @@ class KarrasEDMPipeline(DiffusionPipeline):
|
|
172 |
# 5. Denoising loop
|
173 |
# Implements the "EDM" column in Table 1 of the EDM paper
|
174 |
num_warmup_steps = len(timesteps) - num_inference_steps * self.scheduler.order
|
175 |
-
# BEGIN CHANGE
|
176 |
-
t_init = timesteps[0]
|
177 |
-
scaled_sample_first_step = self.scheduler.scale_model_input(sample / self.scheduler.init_noise_sigma, t_init)
|
178 |
-
if self.scheduler.step_index is None:
|
179 |
-
self.scheduler._init_step_index(t_init)
|
180 |
-
sigma = self.scheduler.sigmas[self.scheduler.step_index]
|
181 |
-
sigma_input = self.scheduler.precondition_noise(sigma)
|
182 |
-
model_output = self.unet(scaled_sample_first_step, sigma_input.squeeze(), return_dict=False)[0]
|
183 |
-
sample = self.scheduler.step(model_output, t_init, sample).prev_sample
|
184 |
-
# END CHANGE
|
185 |
with self.progress_bar(total=num_inference_steps) as progress_bar:
|
186 |
-
for i, t in enumerate(timesteps
|
187 |
# 1. Add noise (if necessary) and precondition the input sample.
|
188 |
scaled_sample = self.scheduler.scale_model_input(sample, t)
|
189 |
|
|
|
172 |
# 5. Denoising loop
|
173 |
# Implements the "EDM" column in Table 1 of the EDM paper
|
174 |
num_warmup_steps = len(timesteps) - num_inference_steps * self.scheduler.order
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
with self.progress_bar(total=num_inference_steps) as progress_bar:
|
176 |
+
for i, t in enumerate(timesteps):
|
177 |
# 1. Add noise (if necessary) and precondition the input sample.
|
178 |
scaled_sample = self.scheduler.scale_model_input(sample, t)
|
179 |
|