Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Save/Load Model? #11144

Closed
anchen1011 opened this issue Jun 5, 2018 · 5 comments
Closed

Save/Load Model? #11144

anchen1011 opened this issue Jun 5, 2018 · 5 comments

Comments

@anchen1011
Copy link

Will there be an API for saving and loading models in the future?
It was brought up in #6951 but not actually considered carefully.

Currently we have only:

  1. Save/Load checkpoints, which is epoch-dependent
  2. Save/Load params, which is not exactly save/load models, and is very unstable cross versions

Thanks!

@ThomasDelteil
Copy link
Contributor

ThomasDelteil commented Jun 6, 2018

If your model is hybridizable, and you want to shelf it for a while, the recommended way would be to use .export('prefix', epoch=0).
That way you can reload it later in a symbol block using SymbolBlock.imports() or in a different language binding altogether.

If you are iterating with your model, the recommend way is save_params/load_params for the parameters, and save the model definition file in a .py file or simply pickle it.

You can check this upcoming tutorial. https://github.com/indhub/mxnet/blob/ef1a5fb8ecfaf9f85c26a468cdbcfbfbab58c423/docs/tutorials/gluon/save_load_params.md

@lanking520
Copy link
Member

Thank you for submitting the issue! I'm labeling it so MXNet community members can help resolve it. @nswamy can you add 'Question', 'Disscussion' here?

@ThomasDelteil
Copy link
Contributor

@szha @piiswrong is it safe to pickle a model to store the network definition? And later reload the params using net.load_parameters() ? Could we imagine having a net.to_pickle() in the future? What would be the gotchas to consider when doing this ?

@Ishitori
Copy link
Contributor

@anchen1011 Did it work for you? If yes, please, close the issue.

@thomelane
Copy link
Contributor

@szha @piiswrong any comments to the above? otherwise can we close this issue due to not hearing back from author, thanks!

@anchen1011 can be reopened if .export doesn't work for you, cheers.

@yzhliu yzhliu closed this as completed Aug 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants