Spaces:
Sleeping
Sleeping
Update gligen/ldm/models/diffusion/plms.py
Browse files
gligen/ldm/models/diffusion/plms.py
CHANGED
@@ -189,6 +189,7 @@ class PLMSSampler(object):
|
|
189 |
|
190 |
print("optimize", index1)
|
191 |
self.model.train()
|
|
|
192 |
while loss.item() > loss_threshold and iteration < max_iter and (index1 < max_index) :
|
193 |
print('iter', iteration)
|
194 |
# import pdb; pdb.set_trace()
|
@@ -218,7 +219,7 @@ class PLMSSampler(object):
|
|
218 |
x = x.detach()
|
219 |
iteration += 1
|
220 |
torch.cuda.empty_cache()
|
221 |
-
|
222 |
|
223 |
return x
|
224 |
|
|
|
189 |
|
190 |
print("optimize", index1)
|
191 |
self.model.train()
|
192 |
+
torch.cuda.empty_cache()
|
193 |
while loss.item() > loss_threshold and iteration < max_iter and (index1 < max_index) :
|
194 |
print('iter', iteration)
|
195 |
# import pdb; pdb.set_trace()
|
|
|
219 |
x = x.detach()
|
220 |
iteration += 1
|
221 |
torch.cuda.empty_cache()
|
222 |
+
torch.cuda.synchronize()
|
223 |
|
224 |
return x
|
225 |
|