Skip to content

Commit 7078145

Browse files
authored
Try to catch one source of errors (official-stockfish#367)
1 parent f4a26ae commit 7078145

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

train.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,13 @@ def main():
395395
quantize_config=M.QuantizationConfig(),
396396
)
397397
else:
398-
nnue = torch.load(args.resume_from_model, weights_only=False)
398+
assert os.path.exists(args.resume_from_model)
399+
try:
400+
nnue = torch.load(args.resume_from_model, weights_only=False)
401+
except ModuleNotFoundError as e:
402+
raise RuntimeError(
403+
f"Could not load checkpoint: {e}. The model to be resumed was probably saved with a different version of the code."
404+
)
399405
nnue.model.set_feature_set(feature_set)
400406
nnue.loss_params = loss_params
401407
nnue.max_epoch = max_epoch

0 commit comments

Comments
 (0)