lllyasviel commited on
Commit
54ce9a5
·
1 Parent(s): 69f57c0
Files changed (1) hide show
  1. entry.py +9 -5
entry.py CHANGED
@@ -130,10 +130,14 @@ def denoiser(input, sigma, c):
130
  return model.denoiser(model.model, input, sigma, c)
131
 
132
 
133
- model.model.to(torch.float16).cuda()
134
- model.denoiser.to(torch.float16).cuda()
135
- samples_z = sampler(denoiser, randn, cond=c, uc=uc)
136
- model.model.cpu()
137
- model.denoiser.cpu()
 
 
 
 
138
 
139
  a = 0
 
130
  return model.denoiser(model.model, input, sigma, c)
131
 
132
 
133
+ with torch.no_grad():
134
+ model.model.to(torch.float16).cuda()
135
+ model.denoiser.to(torch.float16).cuda()
136
+ samples_z = sampler(denoiser, randn, cond=c, uc=uc)
137
+ model.model.cpu()
138
+ model.denoiser.cpu()
139
+
140
+ torch.cuda.empty_cache()
141
+ torch.cuda.ipc_collect()
142
 
143
  a = 0