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

numpy data generators #1934

Merged

Conversation

davidslater
Copy link
Collaborator

@davidslater davidslater commented Nov 23, 2022

Signed-off-by: David Slater davidslater@users.noreply.github.com

Description

This PR adds a NumpyDataGenerator class that is backed by numpy arrays. This can be useful for avoiding OOM errors when using framework-specific model fitting.

Fixes #1926

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.

  • tests/test_data_generators.py::TestNumpyDataGenerator

Test Configuration:

  • CI Test

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

Signed-off-by: David Slater <davidslater@users.noreply.github.com>
@codecov-commenter
Copy link

codecov-commenter commented Nov 23, 2022

Codecov Report

Merging #1934 (0daa505) into dev_1.13.0 (caa606c) will increase coverage by 16.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           dev_1.13.0    #1934       +/-   ##
===============================================
+ Coverage       69.53%   85.60%   +16.07%     
===============================================
  Files             257      257               
  Lines           23890    23927       +37     
  Branches         4340     4346        +6     
===============================================
+ Hits            16611    20482     +3871     
+ Misses           6339     2335     -4004     
- Partials          940     1110      +170     
Impacted Files Coverage Δ
art/data_generators.py 95.83% <100.00%> (+34.38%) ⬆️
art/estimators/classification/tensorflow.py 84.30% <0.00%> (+0.20%) ⬆️
art/estimators/classification/pytorch.py 86.38% <0.00%> (+0.46%) ⬆️
art/attacks/evasion/boundary.py 93.93% <0.00%> (+1.21%) ⬆️
art/summary_writer.py 84.48% <0.00%> (+1.72%) ⬆️
art/estimators/classification/blackbox.py 98.00% <0.00%> (+2.00%) ⬆️
art/estimators/tensorflow.py 79.79% <0.00%> (+2.02%) ⬆️
...hidden_trigger_backdoor/hidden_trigger_backdoor.py 92.30% <0.00%> (+3.07%) ⬆️
art/preprocessing/audio/l_filter/pytorch.py 100.00% <0.00%> (+4.08%) ⬆️
art/estimators/classification/lightgbm.py 95.00% <0.00%> (+6.66%) ⬆️
... and 70 more

@beat-buesser beat-buesser self-requested a review November 23, 2022 17:55
@beat-buesser beat-buesser self-assigned this Nov 23, 2022
@beat-buesser beat-buesser added the enhancement New feature or request label Nov 23, 2022
@beat-buesser beat-buesser added this to Pull request open in ART 1.13.0 via automation Nov 23, 2022
@beat-buesser beat-buesser added this to the ART 1.13.0 milestone Nov 23, 2022
@lgtm-com
Copy link

lgtm-com bot commented Nov 23, 2022

This pull request introduces 2 alerts when merging e6c64f2 into e7c763b - view on LGTM.com

new alerts:

  • 2 for Module is imported more than once

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. Please enable GitHub code scanning, which uses the same CodeQL engine ⚙️ that powers LGTM.com. For more information, please check out our post on the GitHub blog.

Signed-off-by: David Slater <davidslater@users.noreply.github.com>
Signed-off-by: David Slater <davidslater@users.noreply.github.com>
@lgtm-com
Copy link

lgtm-com bot commented Nov 23, 2022

This pull request introduces 2 alerts when merging 162dd27 into e7c763b - view on LGTM.com

new alerts:

  • 2 for Module is imported more than once

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. Please enable GitHub code scanning, which uses the same CodeQL engine ⚙️ that powers LGTM.com. For more information, please check out our post on the GitHub blog.

@beat-buesser beat-buesser changed the base branch from main to dev_1.13.0 November 23, 2022 23:03
@lgtm-com
Copy link

lgtm-com bot commented Nov 24, 2022

This pull request introduces 2 alerts when merging 162dd27 into 6e82fe1 - view on LGTM.com

new alerts:

  • 2 for Module is imported more than once

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. Please enable GitHub code scanning, which uses the same CodeQL engine ⚙️ that powers LGTM.com. For more information, please check out our post on the GitHub blog.

davidslater and others added 3 commits November 28, 2022 09:04
Signed-off-by: David Slater <davidslater@users.noreply.github.com>
Signed-off-by: David Slater <davidslater@users.noreply.github.com>
Copy link
Collaborator

@beat-buesser beat-buesser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidslater Looks good to me! Thank you very much!

@beat-buesser beat-buesser merged commit 1d4d18b into Trusted-AI:dev_1.13.0 Dec 6, 2022
ART 1.13.0 automation moved this from Pull request open to Pull request done Dec 6, 2022
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
No open projects
ART 1.13.0
  
Pull request done
Development

Successfully merging this pull request may close these issues.

NumpyDataGenerator for avoiding OOM GPU errors
3 participants