diff --git a/deepmd/pt/infer/deep_eval.py b/deepmd/pt/infer/deep_eval.py index 11a877040d..97908c873a 100644 --- a/deepmd/pt/infer/deep_eval.py +++ b/deepmd/pt/infer/deep_eval.py @@ -170,7 +170,18 @@ def __init__( if not self.input_param.get("hessian_mode") and not no_jit: model = torch.jit.script(model) self.dp = ModelWrapper(model) - self.dp.load_state_dict(state_dict) + missing, unexpected = self.dp.load_state_dict(state_dict, strict=False) + if missing: + log.warning( + "Checkpoint loaded with missing keys (likely from an older " + "version): %s", + missing, + ) + if unexpected: + log.warning( + "Checkpoint loaded with unexpected keys: %s", + unexpected, + ) elif str(self.model_path).endswith(".pth"): extra_files = {"data_modifier.pth": ""} model = torch.jit.load(