Spaces:
Runtime error
Runtime error
changed to cpu
Browse files
sd.py
CHANGED
|
@@ -48,7 +48,7 @@ from ldm.models.diffusion.plms import PLMSSampler
|
|
| 48 |
|
| 49 |
# 2. Set model download config
|
| 50 |
def load_model_from_config(config, ckpt, verbose=False, device='cuda', half_precision=True):
|
| 51 |
-
map_location = "cuda"
|
| 52 |
print(f"Loading model from {ckpt}")
|
| 53 |
pl_sd = torch.load(ckpt, map_location=map_location)
|
| 54 |
if "global_step" in pl_sd:
|
|
|
|
| 48 |
|
| 49 |
# 2. Set model download config
|
| 50 |
def load_model_from_config(config, ckpt, verbose=False, device='cuda', half_precision=True):
|
| 51 |
+
map_location = "cuda" if torch.cuda.is_available() else "cpu"
|
| 52 |
print(f"Loading model from {ckpt}")
|
| 53 |
pl_sd = torch.load(ckpt, map_location=map_location)
|
| 54 |
if "global_step" in pl_sd:
|