6 ms·
As a person that uses TensorFlow for his day job: I find that saving and restoring are of the weirder things with TensorFlow, you can either go all out an deci
by pmalynin 10y ago
As a person that uses TensorFlow for his day job:
I find that saving and restoring are of the weirder things with TensorFlow, you can either go all out an decide to save out all the variables, or only the ones needed for the model.
You usually don't want to save out gradients (which are also variables) since they take up a bunch of space and aren't actually that useful to restore. Now on the other, what are model variables -- do you want to save model variables + the moving averages ... or just the averages. But then when you're loading you'll have to "shadow" the moving averages to the real variables that actually run in your model.
Good news though, most of the scaffolding code you can write once and re-use it over and over again.
- jostmey 10y ago+1
- jostmey 10y agoI would put together a tutorial on how models are saved and restored if I understood it, which is to say it still confuses me
- minimaxir 10y agoIn Keras, it's just a simple model.save() [to a hdf5 file] and load_model(). This includes both the weights and the architecture. Models with a few million parameters result in a file around ~50MB, which is still reasonable for modern production use cases.