diff --git a/README.md b/README.md index b085809..a31ebdf 100644 --- a/README.md +++ b/README.md @@ -23,16 +23,12 @@ The library can be installed together with other plugins that enable further fun * [Foolbox](https://github.com/bethgelab/foolbox), a Python toolbox to create adversarial examples. * [Tensorboard](https://www.tensorflow.org/tensorboard), a visualization toolkit for machine learning experimentation. +* [Adversarial Library](https://github.com/jeromerony/adversarial-library), a powerful library of various adversarial attacks resources in PyTorch. -Install one or more extras with the command: -```bash -pip install secml-torch[foolbox,tensorboard] -``` - -To enable the `adv_lib` extra, you have to manually install the library from the original repository: +Install one or more extras with the command: ```bash -pip install git+https://github.com/jeromerony/adversarial-library +pip install secml-torch[foolbox,tensorboard, adv_lib] ``` ## Key Features diff --git a/src/secmlt/VERSION b/src/secmlt/VERSION index 6085e94..23aa839 100644 --- a/src/secmlt/VERSION +++ b/src/secmlt/VERSION @@ -1 +1 @@ -1.2.1 +1.2.2 diff --git a/src/secmlt/adv/evasion/modular_attack.py b/src/secmlt/adv/evasion/modular_attack.py index 6c72023..93f2e0f 100644 --- a/src/secmlt/adv/evasion/modular_attack.py +++ b/src/secmlt/adv/evasion/modular_attack.py @@ -148,7 +148,7 @@ def _init_perturbation_constraints(self) -> list[Constraint]: raise NotImplementedError(msg) def _create_optimizer(self, delta: torch.Tensor, **kwargs) -> Optimizer: - return self.optimizer_cls([delta], **kwargs) + return self.optimizer_cls([delta], lr=self.step_size, **kwargs) def forward_loss( self, model: BaseModel, x: torch.Tensor, target: torch.Tensor @@ -181,8 +181,10 @@ def _run( samples: torch.Tensor, labels: torch.Tensor, init_deltas: torch.Tensor = None, - **optim_kwargs, + optim_kwargs: dict | None = None, ) -> tuple[torch.Tensor, torch.Tensor]: + if optim_kwargs is None: + optim_kwargs = {} multiplier = 1 if self.y_target is not None else -1 target = ( torch.zeros_like(labels) + self.y_target