Skip to content

(WIP) Add Protobuf serialization#2826

Closed
karlhigley wants to merge 10 commits intoOpenMined:masterfrom
karlhigley:feature/protobuf
Closed

(WIP) Add Protobuf serialization#2826
karlhigley wants to merge 10 commits intoOpenMined:masterfrom
karlhigley:feature/protobuf

Conversation

@karlhigley
Copy link
Contributor

@karlhigley karlhigley commented Dec 16, 2019

This PR will add bufferize and unbufferize to the classes that currently define simplify and detail in order to provide de/serialization for Protobuf (instead of msgpack.)

Depends on OpenMined/syft-proto#12.

@karlhigley
Copy link
Contributor Author

Tons of work left to do on this, but starting a PR so y'all can see what it looks like and provide feedback along the way.

@karlhigley karlhigley force-pushed the feature/protobuf branch 2 times, most recently from a58129e to 8031138 Compare December 19, 2019 00:03
@karlhigley
Copy link
Contributor Author

There's a lot of machinery to set up to make serialization and deserialization work! This PR probably, very nearly, almost makes a single round-trip Python -> Protobuf -> Python test pass (for AdditiveSharingTensor.) I think the overall structure is now mostly complete, but it has some unresolved bugs and a lot more bufferize and unbufferize methods to write.

(I also haven't figured out a good way to select between msgpack and Protobuf yet. I think it can be done, but I'm still trying to get the basic functionality working right now.)

@karlhigley
Copy link
Contributor Author

Noting for later: #2376 and #2791 will affect this PR.

@karlhigley
Copy link
Contributor Author

CI tests are failing because it can't find the new modules in syft-proto that haven't been merged yet. (Maybe other reasons after that, but that's the first reason.)

@karlhigley karlhigley requested a review from vvmnnnkv December 23, 2019 15:35
@vvmnnnkv
Copy link
Member

CI tests are failing because it can't find the new modules in syft-proto that haven't been merged yet. (Maybe other reasons after that, but that's the first reason.)

Updating requirements.txt to use direct git url like https://github.com/karlhigley/syft-proto@feature/protobuf#egg=syft-proto should help CI to install correct syft-proto version.

@@ -0,0 +1,355 @@
from collections import OrderedDict
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_generate_bufferizers_and_unbufferizers, _bufferize, _unbufferize, seem very similar to msgpack's serde.
Although, it seems there's no point to extract that to common code at this time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're intentionally very, very similar. IIRC, there are a few tweaks to how the data structures are created and what they contain, but there's almost certainly shared code that could be factored out.

@karlhigley
Copy link
Contributor Author

Closing this in favor of a series of smaller PRs with round-trip serialization tests. Thanks for the review, @vvmnnnkv!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants