Skip to content
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

Addition of SmoothAdversarial and MACER Implementation in the Randomized Smoothing Module #1968

Closed

Conversation

archit-g
Copy link

Description

  • Addition of SmoothAdversarial and MACER Implementation in the Randomized Smoothing Module
  • Support for SmoothAdversarial implementation in PyTorch and Tensorflow
  • Support for MACER implementation in PyTorch
  • Example notebooks for the new modules added
  • Unit tests for the new modules added

Links to Paper and Authors' code repository:

Fixes # (issue)

Type of change

Please check all relevant options.

  • Improvement (non-breaking)
  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Testing

Please describe the tests that you ran to verify your changes. Consider listing any relevant details of your test configuration.

  • Test A
  • Test B

Test Configuration:

  • OS
  • Python version
  • ART version or commit number
  • TensorFlow / Keras / PyTorch / MXNet version

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

archit-g and others added 29 commits December 13, 2022 00:50
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
Signed-off-by: Tirth Mehta <tirthmehta05@gmail.com>
Signed-off-by: Tirth Mehta <tirthmehta05@gmail.com>
Signed-off-by: Tirth Mehta <tirthmehta05@gmail.com>
Signed-off-by: Tirth Mehta <tirthmehta05@gmail.com>
Signed-off-by: Tirth Mehta <tirthmehta05@gmail.com>
Signed-off-by: Tirth Mehta <tirthmehta05@gmail.com>
Signed-off-by: Tirth Mehta <tirthmehta05@gmail.com>
Signed-off-by: Tirth Mehta <tirthmehta05@gmail.com>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
…ypy style check

Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
@archit-g archit-g marked this pull request as ready for review December 13, 2022 19:32
@archit-g archit-g marked this pull request as draft December 13, 2022 19:32
@archit-g archit-g marked this pull request as ready for review December 13, 2022 19:34
@@ -161,6 +194,12 @@
# Set model mode
self._model.train(mode=training_mode)

if "train_method" in kwargs:
if kwargs.get("train_method") == "macer":
return fit_pytorch_macer(self, x, y, batch_size, nb_epochs, **kwargs)

Check warning

Code scanning / CodeQL

Use of the return value of a procedure

The result of [fit_pytorch_macer](1) is used even though it is always None.
@@ -136,9 +175,15 @@
"""
import tensorflow as tf

if "train_method" in kwargs:
if kwargs.get("train_method") == "macer":
return fit_tensorflow_macer(self, x, y, batch_size, nb_epochs)

Check warning

Code scanning / CodeQL

Use of the return value of a procedure

The result of [fit_tensorflow_macer](1) is used even though it is always None.
@codecov-commenter
Copy link

codecov-commenter commented Dec 13, 2022

Codecov Report

Merging #1968 (7c41c98) into dev_1.13.0 (0d481ca) will increase coverage by 11.95%.
The diff coverage is 62.45%.

Impacted file tree graph

@@               Coverage Diff               @@
##           dev_1.13.0    #1968       +/-   ##
===============================================
+ Coverage       73.25%   85.20%   +11.95%     
===============================================
  Files             257      289       +32     
  Lines           23928    25178     +1250     
  Branches         4346     4497      +151     
===============================================
+ Hits            17529    21454     +3925     
+ Misses           5417     2574     -2843     
- Partials          982     1150      +168     
Impacted Files Coverage Δ
...fication/randomized_smoothing/macer/train_macer.py 51.61% <51.61%> (ø)
...ed_smoothing/smooth_adversarial/train_smoothadv.py 66.32% <66.32%> (ø)
...tors/certification/randomized_smoothing/pytorch.py 84.15% <73.33%> (+0.06%) ⬆️
...s/certification/randomized_smoothing/tensorflow.py 89.18% <76.47%> (-2.20%) ⬇️
...rtification/randomized_smoothing/macer/__init__.py 100.00% <100.00%> (ø)
...ation/randomized_smoothing/randomized_smoothing.py 97.67% <100.00%> (+0.34%) ⬆️
...andomized_smoothing/smooth_adversarial/__init__.py 100.00% <100.00%> (ø)
art/estimators/certification/abstain.py 90.90% <0.00%> (-9.10%) ⬇️
art/estimators/keras.py 78.94% <0.00%> (-7.72%) ⬇️
art/estimators/poison_mitigation/strip/strip.py 94.44% <0.00%> (-5.56%) ⬇️
... and 96 more

@beat-buesser beat-buesser self-assigned this Dec 13, 2022
@beat-buesser beat-buesser added this to the ART 1.13.0 milestone Dec 13, 2022
tirthmehta05 and others added 4 commits December 14, 2022 16:03
Signed-off-by: Tirth Mehta <tirthmehta05@gmail.com>
Signed-off-by: Tirth Mehta <tirthmehta05@gmail.com>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
Signed-off-by: Archit Gajpal <agajpal@cs.stonybrook.edu>
@beat-buesser beat-buesser added the enhancement New feature or request label Dec 15, 2022
@beat-buesser beat-buesser removed this from the ART 1.13.0 milestone Dec 18, 2022
@beat-buesser beat-buesser changed the base branch from dev_1.13.0 to dev_1.14.0 January 19, 2023 15:47
@beat-buesser beat-buesser added this to the ART 1.14.0 milestone Jan 19, 2023
@beat-buesser beat-buesser removed this from the ART 1.14.0 milestone Mar 8, 2023
@f4str
Copy link
Collaborator

f4str commented Jul 10, 2023

@beat-buesser this should be closed in favor of #2218

@f4str f4str deleted the macer-smoothadv-rebased branch July 10, 2023 23:50
@beat-buesser
Copy link
Collaborator

Closing this pull request and replacing it with #2218

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants