I have set load_best_model_at_end
to True
for the Trainer
class. And I want to save the best model in a specified directory. Does the method save_model
of Trainer
saves the best model or the last model in the specified directory?
1 Like
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.
As @mihai said, it saves the model currently inside the Trainer
. If you call it after Trainer.train()
, since load_best_model_at_end
will have reloaded the best model, it will save the best model.
3 Likes
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?
3 Likes