Spaces:
Running
on
T4
Running
on
T4
Update mono/utils/running.py
Browse files- mono/utils/running.py +4 -1
mono/utils/running.py
CHANGED
@@ -18,7 +18,10 @@ def load_ckpt(load_path, model, optimizer=None, scheduler=None, strict_match=Tru
|
|
18 |
logger.info(f"Loading weight '{load_path}'")
|
19 |
checkpoint = torch.load(load_path, map_location="cpu")
|
20 |
ckpt_state_dict = checkpoint['model_state_dict']
|
21 |
-
|
|
|
|
|
|
|
22 |
|
23 |
if optimizer is not None:
|
24 |
optimizer.load_state_dict(checkpoint['optimizer'])
|
|
|
18 |
logger.info(f"Loading weight '{load_path}'")
|
19 |
checkpoint = torch.load(load_path, map_location="cpu")
|
20 |
ckpt_state_dict = checkpoint['model_state_dict']
|
21 |
+
try:
|
22 |
+
model.module.load_state_dict(ckpt_state_dict, strict=strict_match)
|
23 |
+
except:
|
24 |
+
model.load_state_dict(ckpt_state_dict, strict=strict_match)
|
25 |
|
26 |
if optimizer is not None:
|
27 |
optimizer.load_state_dict(checkpoint['optimizer'])
|