Do trainer.save_model saves the best model?
I have setload_best_model_at_endtoTruefor theTrainerclass. And I want to save the best model in a specified directory. Does the methodsave_modelofTrainersaves the best model or the last model in the specified directory?
2022-01-03T08:18:13Z
save_model itself does what it say on the can: saves the model, good, bad, best it does not matter. It’s the rotate checkpoints method that will keep the best model from being deleted.
2022-01-10T15:46:52Z
As@mihaisaid, it saves the model currently inside theTrainer. If you call it afterTrainer.train(), sinceload_best_model_at_endwill have reloaded the best model, it will save the best model.
2023-07-03T11:13:45Z
what is the source code to find the best model? Is best_model defined based on the minimum loss of a checkpoint or just the latest checkpoint?