Spaces:
Running
Running
Update app.py
Browse files
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 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|