Saving list of models

I would like to store a list of my trained models so i can load them at any time to compare their performance.
Also, i would like to append a newly trained model to the stored list.
How do i do this most conveniently?

Did you have a look at the doc here https://pytorch.org/tutorials/beginner/saving_loading_models.html ? In the ‘Saving Multiple Models in One File’ section :slight_smile:

1 Like

Thanks!
I need to read manuals more carefully…
I would be 100% happy if there was a way to append newly trained model to the file without loading the entire file from disk, like you can do with pickle. Any ideas?

I am not sure to understand, can you be more explicit ? If it is a newly trained NN in your file, why would you need to load it ?

Imagine i have trained a bunch of models and saved them into one file. A couple of days later, i start a new session and train a new model. This model i want to append to the file that i created previously. In order to do this, i would have to load the entire file via torch.load, then append the new model to the loaded dict, then save the file anew. This can be a problem e.g. when the total loaded dict does not fit into the working memory