Spaces:
Running
on
Zero
Running
on
Zero
Update injection_main.py
Browse files- injection_main.py +3 -9
injection_main.py
CHANGED
@@ -325,15 +325,9 @@ def invert(
|
|
325 |
pipe.scheduler.set_timesteps(num_inference_steps, device=device)
|
326 |
|
327 |
# Reversed timesteps <<<<<<<<<<<<<<<<<<<<
|
328 |
-
timesteps = reversed(pipe.scheduler.timesteps)
|
329 |
|
330 |
-
for i in
|
331 |
-
range(1, num_inference_steps),
|
332 |
-
total=num_inference_steps - 1,
|
333 |
-
desc="DDIM Inversion",
|
334 |
-
):
|
335 |
-
|
336 |
-
# We'll skip the final iteration
|
337 |
if i >= num_inference_steps - 1:
|
338 |
continue
|
339 |
|
@@ -361,7 +355,7 @@ def invert(
|
|
361 |
)
|
362 |
|
363 |
current_t = max(0, t.item() - (1000 // num_inference_steps)) # t
|
364 |
-
next_t = t # min(999, t.item() + (1000//num_inference_steps)) # t+1
|
365 |
alpha_t = pipe.scheduler.alphas_cumprod[current_t]
|
366 |
alpha_t_next = pipe.scheduler.alphas_cumprod[next_t]
|
367 |
|
|
|
325 |
pipe.scheduler.set_timesteps(num_inference_steps, device=device)
|
326 |
|
327 |
# Reversed timesteps <<<<<<<<<<<<<<<<<<<<
|
328 |
+
timesteps = list(reversed(pipe.scheduler.timesteps))
|
329 |
|
330 |
+
for i in range(num_inference_steps):
|
|
|
|
|
|
|
|
|
|
|
|
|
331 |
if i >= num_inference_steps - 1:
|
332 |
continue
|
333 |
|
|
|
355 |
)
|
356 |
|
357 |
current_t = max(0, t.item() - (1000 // num_inference_steps)) # t
|
358 |
+
next_t = t # min(999, t.item() + (1000 // num_inference_steps)) # t+1
|
359 |
alpha_t = pipe.scheduler.alphas_cumprod[current_t]
|
360 |
alpha_t_next = pipe.scheduler.alphas_cumprod[next_t]
|
361 |
|