- model.load_state_dict(torch.load(os.path.join(args.result_dir, filename)))
- log_string(f"model {model.id} successfully loaded from checkpoint.")
- nb_loaded_models += 1
-
- except FileNotFoundError:
- log_string(f"starting model {model.id} from scratch.")
+ for model in models:
+ filename = f"gpt_{model.id:03d}.pth"
+
+ try:
+ model.load_state_dict(
+ torch.load(os.path.join(args.result_dir, filename))
+ )
+ log_string(f"successfully loaded {filename}")
+ except FileNotFoundError:
+ log_string(f"cannot find {filename}")
+ pass
+
+ try:
+ filename = "c_quizzes.pth"
+ quiz_machine.load_c_quizzes(os.path.join(args.result_dir, filename))
+ log_string(f"successfully loaded {filename}")
+ except FileNotFoundError:
+ log_string(f"cannot find {filename}")
+ pass