This commit is contained in:
lvmin
2023-08-09 15:02:24 -07:00
parent ab65a357ec
commit 9993090813
+3 -4
View File
@@ -98,6 +98,8 @@ model.load_state_dict(safetensors.torch.load_file('./sd_xl_base_1.0.safetensors'
# model.conditioner.cuda()
with torch.no_grad():
model.conditioner.embedders[0].device = 'cpu'
model.conditioner.embedders[1].device = 'cpu'
@@ -142,11 +144,8 @@ with torch.no_grad():
torch.cuda.empty_cache()
torch.cuda.ipc_collect()
a = 0
with torch.no_grad():
model.first_stage_model.cuda()
model.first_stage_model.to(torch.float16).cuda()
samples_x = model.decode_first_stage(samples_z)
samples = torch.clamp((samples_x + 1.0) / 2.0, min=0.0, max=1.0)
model.first_stage_model.cpu()