-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Implement estimator for Hugging Face models #2245
Implement estimator for Hugging Face models #2245
Conversation
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Codecov Report
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. @@ Coverage Diff @@
## dev_1.16.0 #2245 +/- ##
==============================================
+ Coverage 84.68% 85.64% +0.95%
==============================================
Files 323 324 +1
Lines 29176 29304 +128
Branches 5374 5400 +26
==============================================
+ Hits 24709 25098 +389
+ Misses 3115 2828 -287
- Partials 1352 1378 +26
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
…ve to different PR. Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @GiulioZizzo Thank you very much for your pull request. I have completed my first review, please let me know what you think?
art/attacks/poisoning/hidden_trigger_backdoor/hidden_trigger_backdoor.py
Outdated
Show resolved
Hide resolved
art/attacks/poisoning/hidden_trigger_backdoor/hidden_trigger_backdoor_pytorch.py
Outdated
Show resolved
Hide resolved
tests/defences/detector/poison/pytest/test_activation_defence_pytest.py
Outdated
Show resolved
Hide resolved
@@ -24,6 +24,9 @@ | |||
from art.defences.trainer import DPInstaHideTrainer | |||
from art.estimators.classification import PyTorchClassifier, TensorFlowV2Classifier, KerasClassifier | |||
from tests.utils import ARTTestException | |||
from tests.utils import get_image_classifier_hf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the large model and integrate get_image_classifier_hf
into get_mnist_classifier
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we call image_dl_estimator
instead?
Co-authored-by: Beat Buesser <49047826+beat-buesser@users.noreply.github.com> Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
ac13097
to
d65f9af
Compare
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
d65f9af
to
e67388f
Compare
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
… with HF. Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
26dcd6a
to
5cccfba
Compare
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @GiulioZizzo I have added a few suggestions. Please let me know what you think!
tests/defences/trainer/test_adversarial_trainer_trades_pytorch.py
Outdated
Show resolved
Hide resolved
if len(shape) == 3 or len(shape) == 4: | ||
# Transpose the image putting channels last | ||
if channels_first: | ||
x = np.transpose(x, (0, 2, 3, 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the transpose with 4 indices work if len(shape)==3
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point: that should only apply to 4D inputs and an additional one is needed for 2D to go from HC to CH.
Co-authored-by: Beat Buesser <49047826+beat-buesser@users.noreply.github.com> Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
7bf255d
to
89bd452
Compare
…fier Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Signed-off-by: GiulioZizzo <giulio.zizzo@yahoo.co.uk>
Description
In this PR we introduce an estimator to support HF models for classification. This can enable initial support for HF in ART which we can expand on and develop in future.
Fixes #2225
Type of change
Please check all relevant options.
Testing
Please describe the tests that you ran to verify your changes. Consider listing any relevant details of your test configuration.
Test Configuration:
Checklist