-
Notifications
You must be signed in to change notification settings - Fork 16
Fixing an issue with Opacus modified models and optimizers. #119
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
Conversation
…re not DP compliant and the parameters have misalignment in the optimizer. Also adding in an example of "safely" setting the server initial parameters.
| ) | ||
|
|
||
|
|
||
| def get_model_and_validate() -> nn.Module: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: This model wasn't causing any problems, but I wanted the examples to reflect a situation where the server should pass the appropriate model parameters after validation and correction to ensure that all the model weights line up properly
| # Currently uses the Pytorch default initialization for the model parameters. | ||
| initial_model = MnistNet() | ||
| initial_model: nn.Module = MnistNet() | ||
| initial_model, _ = privacy_validate_and_fix_modules(initial_model) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: This model wasn't causing any problems, but I wanted the examples to reflect a situation where the server should pass the appropriate model parameters after validation and correction to ensure that all the model weights line up properly
jewelltaylor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
PR Type
Fix
Short Description
Addressing an issue that can arise when opacus replaces layers that are not DP compliant and the parameters have misalignment in the optimizer. Also adding in an example of "safely" setting the server initial parameters..
Tests Added
Added a few tests to ensure that the functionality is indeed replacing the desired layers and that the new layers are also being replaced in the optimizer itself.