From 23850b271fab2237125e33977982b991d2a77977 Mon Sep 17 00:00:00 2001 From: Iden Kalemaj Date: Thu, 19 Dec 2024 09:01:34 -0800 Subject: [PATCH] Remove **kwargs from prepare_optimizer Summary: None of the optimizer classes accept **kwargs, so I am removing **kwargs from perpare_optimizer. Otherwsie, the current code throws an error when creating a custom PrivacyEngine that takes in additional arguments. Differential Revision: D67456352 --- opacus/privacy_engine.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/opacus/privacy_engine.py b/opacus/privacy_engine.py index 1af891c4..87161897 100644 --- a/opacus/privacy_engine.py +++ b/opacus/privacy_engine.py @@ -111,7 +111,6 @@ def _prepare_optimizer( clipping: str = "flat", noise_generator=None, grad_sample_mode="hooks", - **kwargs, ) -> DPOptimizer: if isinstance(optimizer, DPOptimizer): optimizer = optimizer.original_optimizer @@ -136,7 +135,6 @@ def _prepare_optimizer( loss_reduction=loss_reduction, generator=generator, secure_mode=self.secure_mode, - **kwargs, ) def _prepare_data_loader( @@ -396,7 +394,6 @@ def make_private( distributed=distributed, clipping=clipping, grad_sample_mode=grad_sample_mode, - **kwargs, ) optimizer.attach_step_hook(