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
Is there a good way to save/load & compress/decompress model weights? #18
Comments
Hey, we're intentionally un-opinionated here. I will note:
There are a few options we've seen work well:
I'll look into extending either the Transformer or ResNet example with checkpointing, so we have a concrete piece of code that we can point people to as an example. I'll leave this bug open conditioned on that - hope this helps! |
Thanks for the help! @trevorcai Your advice helped me a lot! I'm planning to try serialization via protobuf over gRPC communication. |
https://github.com/chris-chris/haiku-scalable-example/pull/1/files Thanks! @trevorcai I made encoder & decoder for the haiku model weights and trajectories for gRPC protobuf message. Is this data type going to be deprecated?
https://github.com/deepmind/dm-haiku/blob/master/haiku/_src/data_structures.py#L80 |
Hey, nice job! That's correct, we'd like to replace it with the FlatMapping class below it. |
Quick update - it turns out the bit is not ready to be flipped, there are a couple edge cases that need to be fixed. We don't really have the time to look into this for now, so don't expect it to flip in the near future. |
I've been using https://github.com/cloudpipe/cloudpickle/ which seems to be working well. |
What library is recommended for directly serializing the params dict? What are the caveats? I think adding these to the docs will be a nice addition, or at least links to other good docs on serialization in Python. |
If you use The transformer example is a simple demonstration of pickle-ing the entire state: Two years on, the vast majority of people at DeepMind use |
@trevorcai Is there an example of saving the tree structure and then loading the np.ndarrays back into it? |
typed out in the comment-box so may need some adjustment to actually run. |
Hey- This is Chris.
I'm using this open-source for my project.
https://github.com/chris-chris/haiku-scalable-example
Since I'm new to JAX and haiku, I have some questions.
Is there a good way to save/load & compress/decompress & serialize model weights?
I think serialization is an important issue on scalability. Can you give me some keywords or hints about this issue?
Thanks!
The text was updated successfully, but these errors were encountered: