Spaces:
Running
on
Zero
Running
on
Zero
Update injection_main.py
Browse files- injection_main.py +4 -4
injection_main.py
CHANGED
@@ -238,14 +238,13 @@ def sample_disentangled(
|
|
238 |
latents = start_latents.clone()
|
239 |
|
240 |
latents = latents.repeat(len(prompt), 1, 1, 1)
|
241 |
-
# randomly
|
242 |
|
243 |
latents[1] = generative_latent
|
244 |
# assume that the first latent is used for reconstruction
|
245 |
-
for i in
|
246 |
-
|
247 |
if use_content_anchor:
|
248 |
-
latents[0] = intermediate_latents[(
|
249 |
t = pipe.scheduler.timesteps[i]
|
250 |
|
251 |
# Expand the latents if we are doing classifier free guidance
|
@@ -287,6 +286,7 @@ def sample_disentangled(
|
|
287 |
return images
|
288 |
|
289 |
|
|
|
290 |
## Inversion
|
291 |
@torch.no_grad()
|
292 |
def invert(
|
|
|
238 |
latents = start_latents.clone()
|
239 |
|
240 |
latents = latents.repeat(len(prompt), 1, 1, 1)
|
241 |
+
# randomly initialize the 1st latent for generation
|
242 |
|
243 |
latents[1] = generative_latent
|
244 |
# assume that the first latent is used for reconstruction
|
245 |
+
for i in range(start_step, num_inference_steps):
|
|
|
246 |
if use_content_anchor:
|
247 |
+
latents[0] = intermediate_latents[-(i + 1)]
|
248 |
t = pipe.scheduler.timesteps[i]
|
249 |
|
250 |
# Expand the latents if we are doing classifier free guidance
|
|
|
286 |
return images
|
287 |
|
288 |
|
289 |
+
|
290 |
## Inversion
|
291 |
@torch.no_grad()
|
292 |
def invert(
|