Skip to content

Commit 4627434

Browse files
authored
Merge pull request #2395 from Trusted-AI/dev_1.17.1
Update to ART 1.17.1
2 parents 1b2d10d + cf737ba commit 4627434

File tree

59 files changed

+33
-28
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+33
-28
lines changed

.github/actions/deepspeech-v3/Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
pod# Get base from a pytorch image
2-
FROM pytorch/pytorch:2.1.1-cuda12.1-cudnn8-runtime
1+
# Get base from a pytorch image
2+
FROM python:3.10.13-slim-bullseye
33

44
# Set to install things in non-interactive mode
55
ENV DEBIAN_FRONTEND noninteractive
@@ -26,10 +26,10 @@ RUN apt-get update \
2626
RUN pip install --ignore-installed PyYAML torch==2.1.1 tensorflow==2.14.1 torchaudio==2.1.1 pytorch-lightning==2.1.2 scikit-learn==1.3.2
2727
RUN pip install --no-build-isolation fairscale==0.4.13
2828

29-
RUN git clone https://github.com/SeanNaren/deepspeech.pytorch.git
30-
RUN cd deepspeech.pytorch && sed -i '/^sklearn/d' requirements.txt && pip install -r requirements.txt && pip install -e .
29+
RUN git clone https://github.com/SeanNaren/deepspeech.pytorch.git && cd deepspeech.pytorch && sed -i '/^sklearn/d' requirements.txt && pip install -r requirements.txt && pip install -e .
3130

3231
RUN pip install numba==0.56.4 pytest-cov==4.1.0 pydub==0.25.1
33-
RUN pip list
3432

3533
RUN mkdir -p /root/.art/data && cd /root/.art/data && curl -LJO "https://github.com/SeanNaren/deepspeech.pytorch/releases/download/V3.0/librispeech_pretrained_v3.ckpt"
34+
35+
CMD ["/bin/bash"]

.github/workflows/ci-lingvo.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
sudo apt-get update
5151
sudo apt-get -y -q install ffmpeg libavcodec-extra
5252
python -m pip install --upgrade pip setuptools wheel
53-
pip install -q -r <(sed '/^scipy/d;/^matplotlib/d;/^pandas/d;/^statsmodels/d;/^numba/d;/^jax/d;/^h5py/d;/^Pillow/d;/^pytest/d;/^pytest-mock/d;/^torch/d;/^torchaudio/d;/^torchvision/d;/^xgboost/d;/^requests/d;/^tensorflow/d;/^keras/d;/^kornia/d;/^librosa/d;/^tqdm/d;/^timm/d;/^catboost/d' requirements_test.txt)
53+
pip install -q -r <(sed '/^scipy/d;/^matplotlib/d;/^pandas/d;/^statsmodels/d;/^numba/d;/^jax/d;/^h5py/d;/^Pillow/d;/^pytest/d;/^pytest-mock/d;/^torch/d;/^torchaudio/d;/^torchvision/d;/^xgboost/d;/^requests/d;/^tensorflow/d;/^keras/d;/^kornia/d;/^librosa/d;/^tqdm/d;/^timm/d;/^catboost/d;/^scikit-learn/d' requirements_test.txt)
5454
pip install scipy==1.5.4
5555
pip install matplotlib==3.3.4
5656
pip install pandas==1.1.5
@@ -75,6 +75,7 @@ jobs:
7575
pip install librosa==0.9.2
7676
pip install tqdm==4.64.1
7777
pip install catboost==1.1.1
78+
pip install scikit-learn==0.24.2
7879
pip list
7980
- name: Run ${{ matrix.name }} Tests
8081
run: pytest --cov-report=xml --cov=art --cov-append -q -vv tests/estimators/speech_recognition/test_tensorflow_lingvo.py --framework=${{ matrix.framework }} --durations=0

.github/workflows/ci-scikit-learn.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,14 @@ jobs:
2828
fail-fast: false
2929
matrix:
3030
include:
31-
- name: scikit-learn 1.1.3 (Python 3.9)
32-
framework: scikitlearn
33-
scikit-learn: 1.1.3
34-
python: 3.9
35-
- name: scikit-learn 1.2.2 (Python 3.10)
36-
framework: scikitlearn
37-
scikit-learn: 1.2.2
38-
python: '3.10'
3931
- name: scikit-learn 1.3.2 (Python 3.10)
4032
framework: scikitlearn
4133
scikit-learn: 1.3.2
4234
python: '3.10'
35+
- name: scikit-learn 1.4.0 (Python 3.10)
36+
framework: scikitlearn
37+
scikit-learn: 1.4.0
38+
python: '3.10'
4339

4440
name: ${{ matrix.name }}
4541
steps:

.github/workflows/ci-tensorflow-v1.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
sudo apt-get update
4949
sudo apt-get -y -q install ffmpeg libavcodec-extra
5050
python -m pip install --upgrade pip setuptools wheel
51-
pip install -q -r <(sed '/^pandas/d;/^scipy/d;/^matplotlib/d;/^xgboost/d;/^tensorflow/d;/^keras/d;/^jax/d;/^torch/d;/^Pillow/d;/^h5py/d' requirements_test.txt)
51+
pip install -q -r <(sed '/^pandas/d;/^scipy/d;/^matplotlib/d;/^xgboost/d;/^tensorflow/d;/^keras/d;/^jax/d;/^torch/d;/^Pillow/d;/^h5py/d;/^scikit-learn/d' requirements_test.txt)
5252
pip install pandas==1.3.5
5353
pip install scipy==1.7.2
5454
pip install matplotlib==3.5.3
@@ -62,6 +62,7 @@ jobs:
6262
pip install torchvision==0.14.1+cpu
6363
pip install Pillow==9.5.0
6464
pip install h5py==3.8.0
65+
pip install scikit-learn==1.0.2
6566
pip list
6667
- name: Run Tests
6768
run: ./run_tests.sh ${{ matrix.framework }}

requirements_test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
numpy>=1.18.5,<1.27
44
scipy==1.10.1
55
matplotlib==3.7.1
6-
scikit-learn>=0.22.2,<1.4.0
6+
scikit-learn==1.4.0
77
six==1.16.0
88
Pillow==10.2.0
99
tqdm==4.66.1

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
install_requires = [
1010
"numpy>=1.18.0",
1111
"scipy>=1.4.1",
12-
"scikit-learn>=0.22.2,<1.2.0",
12+
"scikit-learn>=0.22.2",
1313
"six",
1414
"setuptools",
1515
"tqdm",
@@ -24,7 +24,7 @@
2424
"numpy>=1.18.0",
2525
"scipy>=1.4.1",
2626
"six>=1.13.0",
27-
"scikit-learn>=0.22.2,<1.2.0",
27+
"scikit-learn>=0.22.2",
2828
"Pillow>=6.0.0",
2929
]
3030

tests/attacks/evasion/test_lowprofool.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ def train_nn(self, nn_model, x, y, learning_rate, epochs):
128128
optimizer.step()
129129

130130

131+
@pytest.mark.only_with_platform("scikitlearn")
131132
def test_general_iris_lr(iris_dataset):
132133
"""
133134
Check whether the produced adversaries are correct,
@@ -136,7 +137,7 @@ def test_general_iris_lr(iris_dataset):
136137
(x_train, y_train, x_valid, y_valid), _, clip_values = iris_dataset
137138

138139
# Setup classifier.
139-
lr_clf = LogisticRegression(penalty="none")
140+
lr_clf = LogisticRegression(penalty=None)
140141
lr_clf.fit(x_train, y_train)
141142
clf_slr = ScikitlearnLogisticRegression(model=lr_clf, clip_values=clip_values)
142143

@@ -170,6 +171,7 @@ def test_general_iris_lr(iris_dataset):
170171
_ = lpf_slr.generate(x=np.ones((sample.shape[0], 11)), y=target)
171172

172173

174+
@pytest.mark.only_with_platform("scikitlearn")
173175
def test_general_wines_lr(wine_dataset):
174176
"""
175177
Check whether the produced adversaries are correct,
@@ -178,7 +180,7 @@ def test_general_wines_lr(wine_dataset):
178180
(x_train, y_train, x_valid, y_valid), _, clip_values = wine_dataset
179181

180182
# Setup classifier
181-
lr_clf = LogisticRegression(penalty="none")
183+
lr_clf = LogisticRegression(penalty=None)
182184
lr_clf.fit(x_train, y_train)
183185
clf_slr = ScikitlearnLogisticRegression(model=lr_clf, clip_values=clip_values)
184186

@@ -204,6 +206,7 @@ def test_general_wines_lr(wine_dataset):
204206
assert success_rate > expected
205207

206208

209+
@pytest.mark.only_with_platform("scikitlearn")
207210
def test_general_cancer_lr(breast_cancer_dataset):
208211
"""
209212
Check whether the produced adversaries are correct,
@@ -212,7 +215,7 @@ def test_general_cancer_lr(breast_cancer_dataset):
212215
(x_train, y_train, x_valid, y_valid), _, clip_values = breast_cancer_dataset
213216

214217
# Setup classifier
215-
lr_clf = LogisticRegression(penalty="none")
218+
lr_clf = LogisticRegression(penalty=None)
216219
lr_clf.fit(x_train, y_train)
217220
clf_slr = ScikitlearnLogisticRegression(model=lr_clf, clip_values=clip_values)
218221

@@ -281,6 +284,7 @@ def test_general_iris_nn(iris_dataset):
281284
assert success_rate > expected
282285

283286

287+
@pytest.mark.only_with_platform("scikitlearn")
284288
def test_general_cancer_svc(breast_cancer_dataset):
285289
"""
286290
Check whether the produced adversaries are correct,
@@ -316,6 +320,7 @@ def test_general_cancer_svc(breast_cancer_dataset):
316320
assert success_rate > expected
317321

318322

323+
@pytest.mark.only_with_platform("scikitlearn")
319324
def test_fit_importances(iris_dataset):
320325
"""
321326
Check whether feature importance is calculated properly.
@@ -329,7 +334,7 @@ def pearson_correlations(x, y):
329334
return result
330335

331336
# Setup classifier
332-
lr_clf = LogisticRegression(penalty="none")
337+
lr_clf = LogisticRegression(penalty=None)
333338
lr_clf.fit(x_train, y_train)
334339
clf_slr = ScikitlearnLogisticRegression(model=lr_clf, clip_values=clip_values)
335340

@@ -385,14 +390,15 @@ def pearson_correlations(x, y):
385390
assert is_vec_fit_valid
386391

387392

393+
@pytest.mark.only_with_platform("scikitlearn")
388394
def test_clipping(iris_dataset):
389395
"""
390396
Check weather adversaries are clipped properly.
391397
"""
392398
(x_train, y_train, x_valid, y_valid), _, clip_values = iris_dataset
393399

394400
# Setup classifier
395-
lr_clf = LogisticRegression(penalty="none")
401+
lr_clf = LogisticRegression(penalty=None)
396402
lr_clf.fit(x_train, y_train)
397403

398404
# Dataset min-max clipping values

tests/utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,9 +1748,10 @@ def get_tabular_classifier_scikit_list(clipped=False, model_list_names=None):
17481748
)
17491749

17501750
sklearn_version = list(map(int, sklearn.__version__.split(".")))
1751-
sklearn_ge_1_3_0 = sklearn_version[0] == 1 and sklearn_version[1] >= 3
1752-
if sklearn_ge_1_3_0:
1753-
suffix = "-ge-1.3.0"
1751+
if sklearn_version[0] == 1 and sklearn_version[1] == 3:
1752+
suffix = "-eq-1.3.0"
1753+
elif sklearn_version[0] == 1 and sklearn_version[1] == 4:
1754+
suffix = "-eq-1.4.0"
17541755
else:
17551756
suffix = ""
17561757

utils/resources/create_model_weights.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def create_scikit_model_weights():
154154
os.path.join(
155155
os.path.dirname(os.path.dirname(__file__)),
156156
"resources/models/scikit/",
157-
"scikit-" + model_name + "-iris-clipped-ge-1.3.0.pickle",
157+
"scikit-" + model_name + "-iris-clipped-eq-1.4.0.pickle",
158158
),
159159
"wb",
160160
),
@@ -168,7 +168,7 @@ def create_scikit_model_weights():
168168
os.path.join(
169169
os.path.dirname(os.path.dirname(__file__)),
170170
"resources/models/scikit/",
171-
"scikit-" + model_name + "-iris-unclipped-ge-1.3.0.pickle",
171+
"scikit-" + model_name + "-iris-unclipped-eq-1.4.0.pickle",
172172
),
173173
"wb",
174174
),

0 commit comments

Comments
 (0)