Update app.py
Browse files
app.py
CHANGED
|
@@ -213,14 +213,14 @@ class main():
|
|
| 213 |
[negative_prompt], padding="max_length", max_length=max_length, return_tensors="pt"
|
| 214 |
)
|
| 215 |
uncond_embeddings = self.text_encoder(uncond_input.input_ids.to(device))[0]
|
| 216 |
-
text_embeddings = torch.cat([uncond_embeddings, text_embeddings])
|
| 217 |
self.noise_scheduler.set_timesteps(ddim_steps)
|
| 218 |
latents = latents * self.noise_scheduler.init_noise_sigma
|
| 219 |
|
| 220 |
for i,t in enumerate(tqdm.tqdm(self.noise_scheduler.timesteps)):
|
| 221 |
latent_model_input = torch.cat([latents] * 2)
|
| 222 |
latent_model_input = self.noise_scheduler.scale_model_input(latent_model_input, timestep=t)
|
| 223 |
-
|
| 224 |
with network:
|
| 225 |
noise_pred = self.unet(latent_model_input, t, encoder_hidden_states=text_embeddings, timestep_cond= None).sample
|
| 226 |
|
|
|
|
| 213 |
[negative_prompt], padding="max_length", max_length=max_length, return_tensors="pt"
|
| 214 |
)
|
| 215 |
uncond_embeddings = self.text_encoder(uncond_input.input_ids.to(device))[0]
|
| 216 |
+
text_embeddings = torch.cat([uncond_embeddings, text_embeddings]).bfloat16()
|
| 217 |
self.noise_scheduler.set_timesteps(ddim_steps)
|
| 218 |
latents = latents * self.noise_scheduler.init_noise_sigma
|
| 219 |
|
| 220 |
for i,t in enumerate(tqdm.tqdm(self.noise_scheduler.timesteps)):
|
| 221 |
latent_model_input = torch.cat([latents] * 2)
|
| 222 |
latent_model_input = self.noise_scheduler.scale_model_input(latent_model_input, timestep=t)
|
| 223 |
+
|
| 224 |
with network:
|
| 225 |
noise_pred = self.unet(latent_model_input, t, encoder_hidden_states=text_embeddings, timestep_cond= None).sample
|
| 226 |
|