ysharma HF staff commited on
Commit
83a6d20
1 Parent(s): e9ba12d
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -30,6 +30,8 @@ import open_clip
30
  def load_model_from_config(config, ckpt, verbose=False):
31
  print(f"Loading model from {ckpt}")
32
  pl_sd = torch.load(ckpt, map_location="cuda")
 
 
33
  sd = pl_sd["state_dict"]
34
  model = instantiate_from_config(config.model)
35
  m, u = model.load_state_dict(sd, strict=False)
 
30
  def load_model_from_config(config, ckpt, verbose=False):
31
  print(f"Loading model from {ckpt}")
32
  pl_sd = torch.load(ckpt, map_location="cuda")
33
+ #please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.
34
+ pl_sd = torch.load(ckpt, map_location=torch.device('cpu'))
35
  sd = pl_sd["state_dict"]
36
  model = instantiate_from_config(config.model)
37
  m, u = model.load_state_dict(sd, strict=False)