Skip to content

Conversation

@emersodb
Copy link
Collaborator

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.

…re not DP compliant and the parameters have misalignment in the optimizer. Also adding in an example of "safely" setting the server initial parameters.
@emersodb emersodb requested review from jewelltaylor and zxj-c March 18, 2024 20:52
)


def get_model_and_validate() -> nn.Module:
Copy link
Collaborator Author

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)
Copy link
Collaborator Author

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

Copy link
Contributor

@jewelltaylor jewelltaylor left a comment

Choose a reason for hiding this comment

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

LGTM!

@emersodb emersodb merged commit addd310 into main Mar 19, 2024
@emersodb emersodb deleted the dbe/fixing_dp_opacus_issue branch March 19, 2024 22:24
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.

4 participants