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

SmoothMix PyTorch Implementation #1988

Closed
wants to merge 20 commits into from

Conversation

f4str
Copy link
Collaborator

@f4str f4str commented Jan 11, 2023

Description

Implementation of the SmoothMix training method for PyTorch models through the art.estimators.certification.PyTorchSmoothMix class. Includes the art.estimators.certification.SmoothMixMixin abstract class for future TensorFlow and Numpy implementations.

Additionally includes a notebook that demonstrates the usage. The notebooks/README.md is updated accordingly to include this new notebook.

This PR is continued and consolidated from

Paper Link: https://arxiv.org/abs/2111.09277
Code Repository based on paper: https://github.com/jh-jeong/smoothmix

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.

  • Unit tests for the PyTorchSmoothMix class

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

asarj and others added 12 commits May 18, 2022 20:25
Signed-off-by: Ajay Sarjoo <ajay.sarjoo@outlook.com>
…ated a separate estimator for smoothmix

Signed-off-by: Ajay Sarjoo <ajay.sarjoo@outlook.com>
Signed-off-by: Ajay Sarjoo <ajay.sarjoo@outlook.com>
Signed-off-by: Ajay Sarjoo <ajay.sarjoo@outlook.com>
Signed-off-by: Ajay Sarjoo <ajay.sarjoo@outlook.com>
Signed-off-by: Ajay Sarjoo <ajay.sarjoo@outlook.com>
Signed-off-by: Ajay Sarjoo <ajay.sarjoo@outlook.com>
Signed-off-by: Ajay Sarjoo <ajay.sarjoo@outlook.com>
Signed-off-by: Ajay Sarjoo <ajay.sarjoo@outlook.com>
Signed-off-by: Ajay Sarjoo <ajay.sarjoo@outlook.com>
Signed-off-by: Ajay Sarjoo <ajay.sarjoo@outlook.com>
f4str added 6 commits January 10, 2023 17:01
Signed-off-by: Farhan Ahmed <Farhan.Ahmed@ibm.com>
Signed-off-by: Farhan Ahmed <Farhan.Ahmed@ibm.com>
Signed-off-by: Farhan Ahmed <Farhan.Ahmed@ibm.com>
Signed-off-by: Farhan Ahmed <Farhan.Ahmed@ibm.com>
Signed-off-by: Farhan Ahmed <Farhan.Ahmed@ibm.com>
Signed-off-by: Farhan Ahmed <Farhan.Ahmed@ibm.com>
@f4str
Copy link
Collaborator Author

f4str commented Jan 11, 2023

Tagging @keykholt and @rahmati for updates. PR #1705 should be closed in favor of this one.

@codecov-commenter
Copy link

codecov-commenter commented Jan 11, 2023

Codecov Report

Merging #1988 (6f9abfb) into dev_1.14.0 (5ddd8ef) will decrease coverage by 0.06%.
The diff coverage is 81.03%.

Impacted file tree graph

@@              Coverage Diff               @@
##           dev_1.14.0    #1988      +/-   ##
==============================================
- Coverage       85.41%   85.36%   -0.06%     
==============================================
  Files             290      293       +3     
  Lines           25437    25669     +232     
  Branches         4573     4599      +26     
==============================================
+ Hits            21728    21913     +185     
- Misses           2541     2580      +39     
- Partials         1168     1176       +8     
Impacted Files Coverage Δ
art/estimators/certification/smoothmix/pytorch.py 76.38% <76.38%> (ø)
...rt/estimators/certification/smoothmix/smoothmix.py 88.37% <88.37%> (ø)
art/estimators/certification/smoothmix/__init__.py 100.00% <100.00%> (ø)
art/estimators/certification/abstain.py 90.90% <0.00%> (-9.10%) ⬇️
art/estimators/poison_mitigation/strip/strip.py 94.44% <0.00%> (-5.56%) ⬇️

@beat-buesser beat-buesser self-requested a review January 11, 2023 11:01
@beat-buesser beat-buesser self-assigned this Jan 11, 2023
@beat-buesser beat-buesser added the enhancement New feature or request label Jan 11, 2023
@beat-buesser beat-buesser added this to the ART 1.14.0 milestone Jan 11, 2023
@beat-buesser beat-buesser mentioned this pull request Jan 11, 2023
14 tasks
Signed-off-by: Farhan Ahmed <Farhan.Ahmed@ibm.com>
"""
raise NotImplementedError

def fit(self, x: np.ndarray, y: np.ndarray, batch_size: int = 128, nb_epochs: int = 10, **kwargs) -> None:

Check notice

Code scanning / CodeQL

Mismatch between signature and use of an overridden method

Overridden method signature does not match [call](1), where it is passed an argument named 'scheduler'. Overriding method [method PyTorchSmoothMix.fit](2) matches the call.
Signed-off-by: Farhan Ahmed <Farhan.Ahmed@ibm.com>
@beat-buesser beat-buesser requested a review from keykholt January 19, 2023 17:38
@f4str f4str marked this pull request as draft January 23, 2023 23:30
@beat-buesser beat-buesser modified the milestones: ART 1.14.0, ART 1.15.0 Mar 16, 2023
@beat-buesser beat-buesser modified the milestones: ART 1.15.0, ART 1.16.0 Jun 28, 2023
@f4str
Copy link
Collaborator Author

f4str commented Jul 10, 2023

Closed in favor of #2218

@f4str f4str closed this Jul 10, 2023
@f4str f4str deleted the smoothmix branch July 10, 2023 23:49
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.

4 participants