jadechoghari
commited on
Commit
•
469d7c2
1
Parent(s):
7038305
add device
Browse files- gaussian_diffusion.py +4 -4
gaussian_diffusion.py
CHANGED
@@ -491,7 +491,7 @@ class GaussianDiffusion:
|
|
491 |
if noise is not None:
|
492 |
img = noise
|
493 |
else:
|
494 |
-
img = th.randn(*shape)
|
495 |
indices = list(range(self.num_timesteps))[::-1]
|
496 |
|
497 |
if progress:
|
@@ -501,7 +501,7 @@ class GaussianDiffusion:
|
|
501 |
indices = tqdm(indices)
|
502 |
|
503 |
for i in indices:
|
504 |
-
t = th.tensor([i] * shape[0])
|
505 |
with th.no_grad():
|
506 |
out = self.p_sample(
|
507 |
model,
|
@@ -658,7 +658,7 @@ class GaussianDiffusion:
|
|
658 |
if noise is not None:
|
659 |
img = noise
|
660 |
else:
|
661 |
-
img = th.randn(*shape)
|
662 |
indices = list(range(self.num_timesteps))[::-1]
|
663 |
|
664 |
if progress:
|
@@ -668,7 +668,7 @@ class GaussianDiffusion:
|
|
668 |
indices = tqdm(indices)
|
669 |
|
670 |
for i in indices:
|
671 |
-
t = th.tensor([i] * shape[0])
|
672 |
with th.no_grad():
|
673 |
out = self.ddim_sample(
|
674 |
model,
|
|
|
491 |
if noise is not None:
|
492 |
img = noise
|
493 |
else:
|
494 |
+
img = th.randn(*shape).to(device)
|
495 |
indices = list(range(self.num_timesteps))[::-1]
|
496 |
|
497 |
if progress:
|
|
|
501 |
indices = tqdm(indices)
|
502 |
|
503 |
for i in indices:
|
504 |
+
t = th.tensor([i] * shape[0]).to(device)
|
505 |
with th.no_grad():
|
506 |
out = self.p_sample(
|
507 |
model,
|
|
|
658 |
if noise is not None:
|
659 |
img = noise
|
660 |
else:
|
661 |
+
img = th.randn(*shape).to(device)
|
662 |
indices = list(range(self.num_timesteps))[::-1]
|
663 |
|
664 |
if progress:
|
|
|
668 |
indices = tqdm(indices)
|
669 |
|
670 |
for i in indices:
|
671 |
+
t = th.tensor([i] * shape[0]).to(device)
|
672 |
with th.no_grad():
|
673 |
out = self.ddim_sample(
|
674 |
model,
|