New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save/load functions and function sets #181
Comments
I believe the safest way of saving a model is to save only the weight/bias variables, without necessarily saving the objects themselves (so, you would always have to dump CPU-based variables, as this is the common denominator for all users). Also, pickling is not reliable for model saving since there's issues to loading a Python 2 pickled file with Python 3 and vice-versa. It would be safer to export the model parameters to HDF5 (where you can even get some compression for free) or Numpy binary files. |
Is portability to other languages important? My colleague is trying to use a trained model on Javascript. |
We are now redesigning chainer in #363, that includes this issue. |
I've come across another problem around model saving when training on multiple GPUs. In
The unpickled model arrays have the type
It works but obviously not ideal :) You can replicate this bug by adding the following lines to the end of
which gives the following error
This works fine for |
Chainer now supports serialization in the master branch. |
fixed in #573 |
Function and FunctionSet objects can be pickled. If one uses GPU for training and wants to port it to non-GPU environment, we have to pickle it after migrating it to CPU. One must deep-copy the object if the pickling takes place during the training process in order not to keep the original object on GPU. It is redundant and uses too much GPU memory. We want an efficient way to save/load models regardless of CPU/GPU.
The text was updated successfully, but these errors were encountered: