-
Notifications
You must be signed in to change notification settings - Fork 74
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
Finish pickle serialization for Pybind modules #160
Comments
@dkeeney can I assigne this to you? Prioritize as you find best |
yes, I will take that one. |
Related to #266
|
The problem is that to get a top to bottom serialization we need to include the state of the .py modules. In cases where the region plugin is implemented in .py code we could have a situation like this:
When the python app calls for serialization of the Network, the serialization needs to include the python region implementation. So, in bindings/py/cpp_src/PyBindRegin.cpp the C++ code will be calling pickle on the python code. That code needs to propagate the pickle until it gets to the bindings for the C++ algorithms and there it should call the C++ serialization. If we are going to use Cereal serialization then this might be implemented a little different. So perhaps it would be best to put in Cereal first and then fix the pickle interface. |
Just a memo that pickle is broken with python2 (due to pybind11) #530 (comment) and decided workaround to skip such tests selectively for py2.7 #530 (comment) |
Now that @Lupino made it possible to serialize using
My question is, for python:
|
So, there is really only one serialization method, although it may be accessed in two different ways. C++ is serialized with Cereal and .py code is serialized with pickle. |
I think we should keep both sets of methods, especially if they're already implemented. Pickle is convenient, but im pretty sure it adds meta data which C++ does not understand. The underlying C++ methods work in both python and C++, and data saved in one language can be loaded into the other. |
Well, not quite. If .py code serialized a TM using pickle then there will be a pickle wrapper around the Cereal Serialization of the C++ object that gets stored and C++ code would not be able to deserialize it. But if .py code called save(stream) directly on the TM object then the created archive file would be the same as TM being serialized by C++ code. However, if .py code wants to serialize one of its own objects which contains a TM object as a member then it would have to use pickle to get everything in one file. So I think we need both entry points for .py serialization. This means that we should probably require this |
can we just add an override to the bindings that adds |
I think that is the idea... This is the one I just did for the Array object.
|
yes, I'm doing the same for RDSE serialization #608 and I've plain copied that code from somewhere else. My point was if we can do an equivalent of Serializable.hpp with a templated method |
I think the last of the pickle serialization problems is covered in PR #747. |
https://github.com/htm-community/nupic.cpp/pull/157/files/5e792ec94ece123631a91f7cd95377a979f8b2b7..b7b6219ede889211e755e9c50f223d68668abc0d#diff-31a394dd13fa2847ebabec3965ae7077R88
and others
The text was updated successfully, but these errors were encountered: