owiedotch commited on
Commit
f7d9674
1 Parent(s): de38782

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -57,8 +57,17 @@ from utils.image import auto_resize
57
 
58
  config = OmegaConf.load("configs/model/ccsr_stage2.yaml")
59
  model = instantiate_from_config(config)
60
- ckpt = torch.load("weights/real-world_ccsr.ckpt", map_location="cpu", weights_only=True)
61
- load_state_dict(model, ckpt, strict=True)
 
 
 
 
 
 
 
 
 
62
  model.freeze()
63
 
64
  # Check if CUDA is available, otherwise use CPU
 
57
 
58
  config = OmegaConf.load("configs/model/ccsr_stage2.yaml")
59
  model = instantiate_from_config(config)
60
+
61
+ # Load the checkpoint without weights_only=True
62
+ ckpt = torch.load("weights/real-world_ccsr.ckpt", map_location="cpu")
63
+
64
+ # Extract only the model state dict
65
+ if "state_dict" in ckpt:
66
+ state_dict = ckpt["state_dict"]
67
+ else:
68
+ state_dict = ckpt
69
+
70
+ load_state_dict(model, state_dict, strict=True)
71
  model.freeze()
72
 
73
  # Check if CUDA is available, otherwise use CPU