Full Demo: Training an Encrypted Neural Network across Workers using Crypten (with jails)#3565
Merged
Full Demo: Training an Encrypted Neural Network across Workers using Crypten (with jails)#3565
Conversation
|
Check out this pull request on Review Jupyter notebook visual diffs & provide feedback on notebooks. Powered by ReviewNB |
Co-authored-by: Ayoub Benaissa <ayouben9@gmail.com>
gmuraru
reviewed
May 28, 2020
| @@ -0,0 +1,325 @@ | |||
| { | |||
Member
There was a problem hiding this comment.
Q: It would be a good idea to also add a title and an author (you :P)?
Member
There was a problem hiding this comment.
Maybe also add some "comments" (I think you can do this in a follow up PR) regarding what is happening in each cell?
Member
|
Tried to run the notebook but got this error: Is there something special that I need to change? |
* fix jail + tests * ignore undef model name
Member
|
Got it! |
we should think about how to provide this feature
83114ab to
9f15ce4
Compare
Codecov Report
@@ Coverage Diff @@
## crypten #3565 +/- ##
===========================================
- Coverage 94.79% 94.67% -0.13%
===========================================
Files 159 169 +10
Lines 17189 17863 +674
===========================================
+ Hits 16294 16911 +617
- Misses 895 952 +57
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR add an experimental notebook showing how to train an encrypted neural network using crypten, it's based on Tutorial7 of CrypTen.
Two issues were also solved to implement the demo correctly. First an issue regarding how the crypten computation is initiated in the syft context, and a second regarding how virtual workers are used.
First issue
CrypTen computation is started from a master worker that will be responsible of running the master party which needs to bind and listen to a port for synchronizing between distributed parties, our initial design start a party (rank 0) on the local worker to be the master that will do the previous job, this introduced some complication with the API as users will list workers in the
run_multiworkerdecorator and doesn't expect an additional party to be running on the local worker. We solved this by removing the need to start a local party, but the ip address and port referred on the decorator would be the one used by the first worker in the list (more work on this need to be done).Second issue
Using virtual workers doesn't parallelize the computation as calling send will just call recv and the execution of the commands sent to the VirtualWorker will just run sequentially on the main thread. Using threads to call operations on VirtualWorker (which was our case) doesn't solve the issue as well as most computation is cpu-bound, and python doesn't support threads as expected because of the Global Interpreter Lock. So we switched to using processes instead, this introduces some extra cost for creating these processes, but this shouldn't be a big deal if the memory is shared using copy-on-write, a deeper analysis of this may be required only if this start popping up issues.
Results
With the previous changes, we were able to reproduce the same training as in the CrypTen tutorial with little changes, the running time is almost the same even for VirtualWorker due to the parallelism using processes.
Checklist:
(See the the contribution guidelines for additional tips.)