Spaces:
Running
on
Zero
Running
on
Zero
Update injection_main.py
Browse files- injection_main.py +3 -7
injection_main.py
CHANGED
@@ -324,14 +324,10 @@ def invert(
|
|
324 |
# Set num inference steps
|
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 tqdm(
|
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:
|
@@ -361,7 +357,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
|
365 |
alpha_t = pipe.scheduler.alphas_cumprod[current_t]
|
366 |
alpha_t_next = pipe.scheduler.alphas_cumprod[next_t]
|
367 |
|
|
|
324 |
# Set num inference steps
|
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 tqdm(range(1, num_inference_steps), total=num_inference_steps - 1, desc="DDIM Inversion"):
|
|
|
|
|
|
|
|
|
331 |
|
332 |
# We'll skip the final iteration
|
333 |
if i >= num_inference_steps - 1:
|
|
|
357 |
)
|
358 |
|
359 |
current_t = max(0, t.item() - (1000 // num_inference_steps)) # t
|
360 |
+
next_t = t # min(999, t.item() + (1000//num_inference_steps)) # t+1
|
361 |
alpha_t = pipe.scheduler.alphas_cumprod[current_t]
|
362 |
alpha_t_next = pipe.scheduler.alphas_cumprod[next_t]
|
363 |
|