kael558 commited on
Commit
9ad8b05
·
1 Parent(s): b5c0ab1

changed to cpu

Browse files
Files changed (1) hide show
  1. sd.py +1 -1
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" #@param ["cpu", "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: