Add the ValueError in the restore checkpoint exception to avoid problems with the optimizer restauration when new keys are addition

pull/1032/head
Edresson 2021-08-28 10:11:33 -03:00 committed by Eren Gölge
parent ecf327a118
commit fee01daa09
1 changed files with 1 additions and 1 deletions

View File

@ -453,7 +453,7 @@ class Trainer:
if "scaler" in checkpoint and self.use_amp_scaler and checkpoint["scaler"]:
print(" > Restoring Scaler...")
scaler = _restore_list_objs(checkpoint["scaler"], scaler)
except (KeyError, RuntimeError):
except (KeyError, RuntimeError, ValueError):
print(" > Partial model initialization...")
model_dict = model.state_dict()
model_dict = set_init_dict(model_dict, checkpoint["model"], config)