8000 Add **kwargs to all optimizer classes by iden-kalemaj · Pull Request #710 · pytorch/opacus · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add **kwargs to all optimizer classes #710

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions opacus/optimizers/adaclipoptimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def __init__(
loss_reduction: str = "mean",
generator=None,
secure_mode: bool = False,
**kwargs,
):
super().__init__(
optimizer,
Expand Down
2 changes: 2 additions & 0 deletions opacus/optimizers/ddp_perlayeroptimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def __init__(
loss_reduction: str = "mean",
generator=None,
secure_mode: bool = False,
**kwargs,
):
self.rank = torch.distributed.get_rank()
self.world_size = torch.distributed.get_world_size()
Expand Down Expand Up @@ -79,6 +80,7 @@ def __init__(
loss_reduction: str = "mean",
generator=None,
secure_mode: bool = False,
**kwargs,
):
self.rank = torch.distributed.get_rank()
self.world_size = torch.distributed.get_world_size()
Expand Down
2 changes: 2 additions & 0 deletions opacus/optimizers/ddpoptimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(
loss_reduction: str = "mean",
generator=None,
secure_mode: bool = False,
**kwargs,
):
super().__init__(
optimizer,
Expand All @@ -47,6 +48,7 @@ def __init__(
loss_reduction=loss_reduction,
generator=generator,
secure_mode=secure_mode,
**kwargs,
)
self.rank = torch.distributed.get_rank()
self.world_size = torch.distributed.get_world_size()
Expand Down
2 changes: 2 additions & 0 deletions opacus/optimizers/ddpoptimizer_fast_gradient_clipping.py
10000
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(
loss_reduction: str = "mean",
generator=None,
secure_mode: bool = False,
**kwargs,
):
super().__init__(
optimizer,
Expand All @@ -47,6 +48,7 @@ def __init__(
loss_reduction=loss_reduction,
generator=generator,
secure_mode=secure_mode,
**kwargs,
)
self.rank = torch.distributed.get_rank()
self.world_size = torch.distributed.get_world_size()
Expand Down
1 change: 1 addition & 0 deletions opacus/optimizers/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ def __init__(
loss_reduction: str = "mean",
generator=None,
secure_mode: bool = False,
**kwargs,
):
"""

Expand Down
2 changes: 2 additions & 0 deletions opacus/optimizers/optimizer_fast_gradient_clipping.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def __init__(
loss_reduction: str = "mean",
generator=None,
secure_mode: bool = False,
**kwargs,
):
"""

Expand Down Expand Up @@ -91,6 +92,7 @@ def __init__(
loss_reduction=loss_reduction,
generator=generator,
secure_mode=secure_mode,
**kwargs,
)

@property
Expand Down
2 changes: 2 additions & 0 deletions opacus/optimizers/perlayeroptimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def __init__(
loss_reduction: str = "mean",
generator=None,
secure_mode: bool = False,
**kwargs,
):
assert len(max_grad_norm) == len(params(optimizer))
self.max_grad_norms = max_grad_norm
Expand All @@ -51,6 +52,7 @@ def __init__(
loss_reduction=loss_reduction,
generator=generator,
secure_mode=secure_mode,
**kwargs,
)

def clip_and_accumulate(self):
Expand Down
1 change: 1 addition & 0 deletions opacus/privacy_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def _prepare_optimizer(
loss_reduction=loss_reduction,
generator=generator,
secure_mode=self.secure_mode,
**kwargs,
)

def _prepare_data_loader(
Expand Down
Loading
2A4D
0