Skip to content

Commit fc217b0

Browse files
committed
Fix dependencies
Signed-off-by: Beat Buesser <[email protected]>
1 parent 669a487 commit fc217b0

13 files changed

+83
-56
lines changed

art/attacks/evasion/auto_projected_gradient_descent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def __init__(
9292
"cross_entropy", or "difference_logits_ratio"
9393
:param verbose: Show progress bars.
9494
"""
95-
from art.estimators.classification import TensorFlowV2Classifier, PyTorchClassifier
95+
from art.estimators.classification import TensorFlowV2Classifier, PyTorchClassifier
9696

9797
if loss_type not in self._predefined_losses:
9898
raise ValueError(

art/utils.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
ScikitlearnRandomForestClassifier,
9696
ScikitlearnSVC,
9797
)
98-
from art.estimators.classification.tensorflow import TensorFlowV2Classifier
98+
from art.estimators.classification.tensorflow import TensorFlowClassifier, TensorFlowV2Classifier
9999
from art.estimators.classification.xgboost import XGBoostClassifier
100100
from art.estimators.certification.deep_z import PytorchDeepZ
101101
from art.estimators.certification.interval import PyTorchIBPClassifier
@@ -125,6 +125,7 @@
125125
PyTorchClassifier,
126126
ScikitlearnLogisticRegression,
127127
ScikitlearnSVC,
128+
TensorFlowClassifier,
128129
TensorFlowV2Classifier,
129130
QueryEfficientGradientEstimationClassifier,
130131
]
@@ -137,6 +138,7 @@
137138
PyTorchClassifier,
138139
ScikitlearnLogisticRegression,
139140
ScikitlearnSVC,
141+
TensorFlowClassifier,
140142
TensorFlowV2Classifier,
141143
]
142144

@@ -146,6 +148,7 @@
146148
EnsembleClassifier,
147149
KerasClassifier,
148150
PyTorchClassifier,
151+
TensorFlowClassifier,
149152
TensorFlowV2Classifier,
150153
]
151154

@@ -180,6 +183,7 @@
180183
ScikitlearnRandomForestClassifier,
181184
ScikitlearnLogisticRegression,
182185
ScikitlearnSVC,
186+
TensorFlowClassifier,
183187
TensorFlowV2Classifier,
184188
XGBoostClassifier,
185189
CLASSIFIER_NEURALNETWORK_TYPE,
@@ -199,9 +203,7 @@
199203
TensorFlowV2FasterRCNN,
200204
]
201205

202-
SPEECH_RECOGNIZER_TYPE = Union[ # pylint: disable=invalid-name
203-
PyTorchDeepSpeech,
204-
]
206+
SPEECH_RECOGNIZER_TYPE = Union[PyTorchDeepSpeech,] # pylint: disable=invalid-name
205207

206208
PYTORCH_ESTIMATOR_TYPE = Union[ # pylint: disable=invalid-name
207209
PyTorchClassifier,

run_tests.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ else
114114
"tests/attacks/test_pixel_attack.py" \
115115
"tests/attacks/test_threshold_attack.py" \
116116
"tests/attacks/test_wasserstein.py" \
117-
"tests/attacks/test_shapeshifter.py" \
118117
"tests/attacks/test_targeted_universal_perturbation.py" \
119118
"tests/attacks/test_simba.py" )
120119

tests/attacks/evasion/feature_adversaries/test_feature_adversaries_tensorflow.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ def fix_get_mnist_subset(get_mnist_dataset):
3636
yield x_train_mnist[:n_train], y_train_mnist[:n_train], x_test_mnist[:n_test], y_test_mnist[:n_test]
3737

3838

39-
@pytest.mark.skip_framework(
40-
"tensorflow2v1", "keras", "kerastf", "non_dl_frameworks", "pytorch", "huggingface"
41-
)
39+
@pytest.mark.skip_framework("tensorflow2v1", "keras", "kerastf", "non_dl_frameworks", "pytorch", "huggingface")
4240
def test_images_pgd(art_warning, fix_get_mnist_subset, image_dl_estimator_for_attack):
4341
try:
4442
(x_train_mnist, y_train_mnist, x_test_mnist, y_test_mnist) = fix_get_mnist_subset
@@ -57,9 +55,7 @@ def test_images_pgd(art_warning, fix_get_mnist_subset, image_dl_estimator_for_at
5755
art_warning(e)
5856

5957

60-
@pytest.mark.skip_framework(
61-
"tensorflow2v1", "keras", "kerastf", "non_dl_frameworks", "pytorch", "huggingface"
62-
)
58+
@pytest.mark.skip_framework("tensorflow2v1", "keras", "kerastf", "non_dl_frameworks", "pytorch", "huggingface")
6359
def test_images_unconstrained_adam(art_warning, fix_get_mnist_subset, image_dl_estimator_for_attack):
6460
try:
6561
import tensorflow as tf

tests/attacks/evasion/test_auto_attack.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,7 @@ def test_classifier_type_check_fail(art_warning):
193193
art_warning(e)
194194

195195

196-
@pytest.mark.skip_framework(
197-
"tensorflow2v1", "tensorflow2", "keras", "non_dl_frameworks", "kerastf"
198-
)
196+
@pytest.mark.skip_framework("tensorflow2v1", "tensorflow2", "keras", "non_dl_frameworks", "kerastf")
199197
def test_generate_parallel(art_warning, fix_get_mnist_subset, image_dl_estimator, framework):
200198
try:
201199
classifier, _ = image_dl_estimator(from_logits=True)

tests/attacks/evasion/test_composite_adversarial_attack.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ def fix_get_cifar10_subset(get_cifar10_dataset):
3838
yield x_train_cifar10[:n_train], y_train_cifar10[:n_train], x_test_cifar10[:n_test], y_test_cifar10[:n_test]
3939

4040

41-
@pytest.mark.skip_framework(
42-
"tensorflow2", "tensorflow2v1", "keras", "non_dl_frameworks", "kerastf", "huggingface"
43-
)
41+
@pytest.mark.skip_framework("tensorflow2", "tensorflow2v1", "keras", "non_dl_frameworks", "kerastf", "huggingface")
4442
def test_generate(art_warning, fix_get_cifar10_subset):
4543
try:
4644
(x_train, y_train, x_test, y_test) = fix_get_cifar10_subset
@@ -62,9 +60,7 @@ def test_generate(art_warning, fix_get_cifar10_subset):
6260
art_warning(e)
6361

6462

65-
@pytest.mark.skip_framework(
66-
"tensorflow2", "tensorflow2v1", "keras", "non_dl_frameworks", "kerastf"
67-
)
63+
@pytest.mark.skip_framework("tensorflow2", "tensorflow2v1", "keras", "non_dl_frameworks", "kerastf")
6864
def test_check_params(art_warning):
6965
try:
7066
classifier = get_cifar10_image_classifier_pt(from_logits=False, load_init=True)

tests/attacks/evasion/test_over_the_air.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ def forward(self, x):
4343
return logit_output.view(-1, 101)
4444

4545

46-
@pytest.mark.skip_framework(
47-
"tensorflow2", "tensorflow2v1", "keras", "non_dl_frameworks", "kerastf"
48-
)
46+
@pytest.mark.skip_framework("tensorflow2", "tensorflow2v1", "keras", "non_dl_frameworks", "kerastf")
4947
def test_get_loss_gradients(art_warning):
5048
try:
5149

@@ -69,9 +67,7 @@ def test_get_loss_gradients(art_warning):
6967
art_warning(e)
7068

7169

72-
@pytest.mark.skip_framework(
73-
"tensorflow2", "tensorflow2v1", "keras", "non_dl_frameworks", "kerastf"
74-
)
70+
@pytest.mark.skip_framework("tensorflow2", "tensorflow2v1", "keras", "non_dl_frameworks", "kerastf")
7571
def test_generate(art_warning):
7672
try:
7773

@@ -95,9 +91,7 @@ def test_generate(art_warning):
9591
art_warning(e)
9692

9793

98-
@pytest.mark.skip_framework(
99-
"tensorflow2", "tensorflow2v1", "keras", "non_dl_frameworks", "kerastf"
100-
)
94+
@pytest.mark.skip_framework("tensorflow2", "tensorflow2v1", "keras", "non_dl_frameworks", "kerastf")
10195
def test_check_params(art_warning, image_dl_estimator_for_attack):
10296
try:
10397
classifier = image_dl_estimator_for_attack(OverTheAirFlickeringPyTorch)

tests/attacks/poison/test_clean_label_backdoor_attack.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
logger = logging.getLogger(__name__)
3131

3232

33-
@pytest.mark.skip_framework("non_dl_frameworks",)
33+
@pytest.mark.skip_framework(
34+
"non_dl_frameworks",
35+
)
3436
def test_poison(art_warning, get_default_mnist_subset, image_dl_estimator, framework):
3537
try:
3638
(x_train, y_train), (_, _) = get_default_mnist_subset
@@ -52,7 +54,9 @@ def mod(x):
5254

5355

5456
@pytest.mark.parametrize("params", [dict(pp_poison=-0.2), dict(pp_poison=1.2)])
55-
@pytest.mark.skip_framework("non_dl_frameworks",)
57+
@pytest.mark.skip_framework(
58+
"non_dl_frameworks",
59+
)
5660
def test_failure_modes(art_warning, image_dl_estimator, params):
5761
try:
5862
classifier, _ = image_dl_estimator()

tests/defences/preprocessor/test_mp3_compression.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ def test_non_temporal_data_error(art_warning, image_batch_small):
8383

8484

8585
@pytest.mark.parametrize("channels_first", [True, False])
86-
@pytest.mark.skip_framework("keras", "pytorch", "scikitlearn",)
86+
@pytest.mark.skip_framework(
87+
"keras",
88+
"pytorch",
89+
"scikitlearn",
90+
)
8791
def test_mp3_compression(art_warning, audio_batch, channels_first):
8892
try:
8993
test_input, test_output, sample_rate = audio_batch
@@ -95,7 +99,11 @@ def test_mp3_compression(art_warning, audio_batch, channels_first):
9599

96100

97101
@pytest.mark.parametrize("channels_first", [True, False])
98-
@pytest.mark.skip_framework("keras", "pytorch", "scikitlearn",)
102+
@pytest.mark.skip_framework(
103+
"keras",
104+
"pytorch",
105+
"scikitlearn",
106+
)
99107
def test_mp3_compression_object(art_warning, audio_batch, channels_first):
100108
try:
101109
test_input, test_output, sample_rate = audio_batch
@@ -113,7 +121,11 @@ def test_mp3_compression_object(art_warning, audio_batch, channels_first):
113121
art_warning(e)
114122

115123

116-
@pytest.mark.skip_framework("keras", "pytorch", "scikitlearn",)
124+
@pytest.mark.skip_framework(
125+
"keras",
126+
"pytorch",
127+
"scikitlearn",
128+
)
117129
def test_check_params(art_warning):
118130
try:
119131
with pytest.raises(ValueError):

tests/defences/preprocessor/test_video_compression.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ def video_batch(channels_first):
4343

4444

4545
@pytest.mark.parametrize("channels_first", [True, False])
46-
@pytest.mark.skip_framework("keras", "pytorch", "scikitlearn",)
46+
@pytest.mark.skip_framework(
47+
"keras",
48+
"pytorch",
49+
"scikitlearn",
50+
)
4751
def test_video_compression(art_warning, video_batch, channels_first):
4852
try:
4953
test_input, test_output = video_batch
@@ -54,7 +58,11 @@ def test_video_compression(art_warning, video_batch, channels_first):
5458
art_warning(e)
5559

5660

57-
@pytest.mark.skip_framework("keras", "pytorch", "scikitlearn",)
61+
@pytest.mark.skip_framework(
62+
"keras",
63+
"pytorch",
64+
"scikitlearn",
65+
)
5866
def test_compress_video_call(art_warning):
5967
try:
6068
test_input = np.arange(12).reshape((1, 3, 1, 2, 2))

0 commit comments

Comments
 (0)