Spaces:
Runtime error
Runtime error
Commit
·
e731c6b
1
Parent(s):
c0aff90
update space
Browse files
app.py
CHANGED
|
@@ -272,7 +272,7 @@ def main():
|
|
| 272 |
model.load_state_dict(ckp['model'])
|
| 273 |
|
| 274 |
noise_initial = initial_noise[e_type].to(device)
|
| 275 |
-
|
| 276 |
general_save_path = './logs/edited'
|
| 277 |
os.makedirs(general_save_path, exist_ok=True)
|
| 278 |
for i, latent in enumerate(state['latent']):
|
|
@@ -280,7 +280,7 @@ def main():
|
|
| 280 |
text_embeddings_clip = model.cached_model_kwargs(1, dict(texts=[instruction]))
|
| 281 |
print("shape of latent: ", latent.clone().unsqueeze(0).shape, "instruction: ", instruction)
|
| 282 |
ref_latent = latent.clone().unsqueeze(0)
|
| 283 |
-
t_1 = torch.randint(
|
| 284 |
|
| 285 |
noise_input = diffusion.q_sample(ref_latent, t_1, noise=noise_initial)
|
| 286 |
out_1 = diffusion.p_mean_variance(model, noise_input, t_1, clip_denoised=True,
|
|
|
|
| 272 |
model.load_state_dict(ckp['model'])
|
| 273 |
|
| 274 |
noise_initial = initial_noise[e_type].to(device)
|
| 275 |
+
noise_start_t_e_type = noise_start_t[e_type]
|
| 276 |
general_save_path = './logs/edited'
|
| 277 |
os.makedirs(general_save_path, exist_ok=True)
|
| 278 |
for i, latent in enumerate(state['latent']):
|
|
|
|
| 280 |
text_embeddings_clip = model.cached_model_kwargs(1, dict(texts=[instruction]))
|
| 281 |
print("shape of latent: ", latent.clone().unsqueeze(0).shape, "instruction: ", instruction)
|
| 282 |
ref_latent = latent.clone().unsqueeze(0)
|
| 283 |
+
t_1 = torch.randint(noise_start_t_e_type, noise_start_t_e_type + 1, (1,), device=device).long()
|
| 284 |
|
| 285 |
noise_input = diffusion.q_sample(ref_latent, t_1, noise=noise_initial)
|
| 286 |
out_1 = diffusion.p_mean_variance(model, noise_input, t_1, clip_denoised=True,
|