Spaces:
Runtime error
Runtime error
fix inpainting bug
Browse files
app.py
CHANGED
|
@@ -741,10 +741,10 @@ def sample_inpaint(
|
|
| 741 |
z = torch.randn(
|
| 742 |
(N, opts.latent_dim, opts.latent_size[0], opts.latent_size[1]), device=device
|
| 743 |
)
|
| 744 |
-
target_cond_N = target_cond.repeat(N, 1, 1, 1)
|
| 745 |
-
ref_cond_N = ref_cond.repeat(N, 1, 1, 1)
|
| 746 |
# novel view synthesis mode = off
|
| 747 |
-
nvs = torch.zeros(N, dtype=torch.int, device=
|
| 748 |
z = torch.cat([z, z], 0)
|
| 749 |
model_kwargs = dict(
|
| 750 |
target_cond=torch.cat([target_cond_N, torch.zeros_like(target_cond_N)]),
|
|
@@ -756,8 +756,8 @@ def sample_inpaint(
|
|
| 756 |
samples, _ = diffusion.inpaint_p_sample_loop(
|
| 757 |
model.forward_with_cfg,
|
| 758 |
z.shape,
|
| 759 |
-
latent,
|
| 760 |
-
inpaint_latent_mask,
|
| 761 |
z,
|
| 762 |
clip_denoised=False,
|
| 763 |
model_kwargs=model_kwargs,
|
|
|
|
| 741 |
z = torch.randn(
|
| 742 |
(N, opts.latent_dim, opts.latent_size[0], opts.latent_size[1]), device=device
|
| 743 |
)
|
| 744 |
+
target_cond_N = target_cond.repeat(N, 1, 1, 1).to(z.device)
|
| 745 |
+
ref_cond_N = ref_cond.repeat(N, 1, 1, 1).to(z.device)
|
| 746 |
# novel view synthesis mode = off
|
| 747 |
+
nvs = torch.zeros(N, dtype=torch.int, device=device)
|
| 748 |
z = torch.cat([z, z], 0)
|
| 749 |
model_kwargs = dict(
|
| 750 |
target_cond=torch.cat([target_cond_N, torch.zeros_like(target_cond_N)]),
|
|
|
|
| 756 |
samples, _ = diffusion.inpaint_p_sample_loop(
|
| 757 |
model.forward_with_cfg,
|
| 758 |
z.shape,
|
| 759 |
+
latent.to(z.device),
|
| 760 |
+
inpaint_latent_mask.to(z.device),
|
| 761 |
z,
|
| 762 |
clip_denoised=False,
|
| 763 |
model_kwargs=model_kwargs,
|