Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -165,7 +165,7 @@ def inference(net, prompt, negative_prompt, guidance_scale, ddim_steps, seed):
|
|
165 |
).bfloat16()
|
166 |
|
167 |
|
168 |
-
text_input =
|
169 |
|
170 |
text_embeddings = text_encoder(text_input.input_ids.to(device))[0]
|
171 |
|
@@ -176,7 +176,7 @@ def inference(net, prompt, negative_prompt, guidance_scale, ddim_steps, seed):
|
|
176 |
uncond_embeddings = text_encoder(uncond_input.input_ids.to(device))[0]
|
177 |
text_embeddings = torch.cat([uncond_embeddings, text_embeddings]).bfloat16()
|
178 |
noise_scheduler.set_timesteps(ddim_steps)
|
179 |
-
latents = latents *
|
180 |
|
181 |
for i,t in enumerate(tqdm.tqdm(noise_scheduler.timesteps)):
|
182 |
latent_model_input = torch.cat([latents] * 2)
|
|
|
165 |
).bfloat16()
|
166 |
|
167 |
|
168 |
+
text_input = tokenizer(prompt, padding="max_length", max_length=tokenizer.model_max_length, truncation=True, return_tensors="pt")
|
169 |
|
170 |
text_embeddings = text_encoder(text_input.input_ids.to(device))[0]
|
171 |
|
|
|
176 |
uncond_embeddings = text_encoder(uncond_input.input_ids.to(device))[0]
|
177 |
text_embeddings = torch.cat([uncond_embeddings, text_embeddings]).bfloat16()
|
178 |
noise_scheduler.set_timesteps(ddim_steps)
|
179 |
+
latents = latents * noise_scheduler.init_noise_sigma
|
180 |
|
181 |
for i,t in enumerate(tqdm.tqdm(noise_scheduler.timesteps)):
|
182 |
latent_model_input = torch.cat([latents] * 2)
|