Skip to content

Bump keras from 2.14.0 to 3.10.0 #2613

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

Open
wants to merge 20 commits into
base: dev_1.20.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci-huggingface.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ jobs:
sudo apt-get update
sudo apt-get -y -q install ffmpeg libavcodec-extra
python -m pip install --upgrade pip setuptools wheel
pip3 install -r requirements_test.txt
pip install tensorflow==2.14.0
pip install keras==2.14.0
pip install -q -r <(sed '/^tensorflow/d;/^keras/d;/^mxnet/d' requirements_test.txt)
pip install tensorflow==2.18.1
pip install keras==3.10.0
pip install torch==${{ matrix.torch }} --index-url https://download.pytorch.org/whl/cpu
pip install torchvision==${{ matrix.torchvision }} --index-url https://download.pytorch.org/whl/cpu
pip install torchaudio==${{ matrix.torchaudio }} --index-url https://download.pytorch.org/whl/cpu
Expand Down
22 changes: 5 additions & 17 deletions .github/workflows/ci-keras.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,12 @@ jobs:
fail-fast: false
matrix:
include:
- name: Keras 2.13.1 (TensorFlow 2.13.1 Python 3.10)
framework: keras
python: '3.10'
tensorflow: 2.13.1
keras: 2.13.1
tf_addons: 0.19.0
- name: Keras 2.14.0 (TensorFlow 2.14.0 Python 3.10)
framework: keras
python: '3.10'
tensorflow: 2.14.0
keras: 2.14.0
tf_addons: 0.20.0
- name: TensorFlow-Keras 2.14.0 (Keras 2.14.0 Python 3.10)
- name: TensorFlow-Keras 2.18.1 (Keras 3.10.0 Python 3.10)
framework: kerastf
python: '3.10'
tensorflow: 2.14.0
keras: 2.14.0
tf_addons: 0.20.0
tensorflow: 2.18.1
keras: 3.10.0
tf_addons: 0.23.0

name: ${{ matrix.name }}
steps:
Expand All @@ -60,7 +48,7 @@ jobs:
sudo apt-get update
sudo apt-get -y -q install ffmpeg libavcodec-extra
python -m pip install --upgrade pip setuptools wheel
pip install -q -r <(sed '/^tensorflow/d;/^keras/d;/^tensorflow-addons/d' requirements_test.txt)
pip install -q -r <(sed '/^tensorflow/d;/^keras/d;/^tensorflow-addons/d;/^mxnet/d' requirements_test.txt)
pip install tensorflow==${{ matrix.tensorflow }}
pip install keras==${{ matrix.keras }}
pip install tensorflow-addons==${{ matrix.tf_addons }}
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/ci-legacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ jobs:
matrix:
module: [attacks_1, attacks_2, estimators, defences, metrics, art]
include:
- name: legacy (TensorFlow 2.14.0 Keras 2.14.0 PyTorch 1.13.1 scikit-learn 1.6.1 Python 3.9)
- name: legacy (TensorFlow 2.18.1 Keras 3.10.0 PyTorch 2.7.0 scikit-learn 1.6.1 Python 3.10)
framework: legacy
python: '3.10'
tensorflow: 2.14.0
keras: 2.14.0
torch: 1.13.1+cpu
torchvision: 0.14.1+cpu
torchaudio: 0.13.1+cpu
tensorflow: 2.18.1
keras: 3.10.0
torch: 2.7.0
torchvision: 0.22.0
torchaudio: 2.7.0
scikit-learn: 1.6.1

name: Run ${{ matrix.module }} ${{ matrix.name }} Tests
Expand All @@ -52,7 +52,7 @@ jobs:
sudo apt-get update
sudo apt-get -y -q install ffmpeg libavcodec-extra
python -m pip install --upgrade pip setuptools wheel
pip install -q -r requirements_test.txt
pip install -q -r <(sed '/^tensorflow/d;/^keras/d;/^torch/d;/^torchvision/d;/^torchaudio/d;/^mxnet/d' requirements_test.txt)
pip install tensorflow==${{ matrix.tensorflow }}
pip install keras==${{ matrix.keras }}
pip install scikit-learn==${{ matrix.scikit-learn }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-pytorch-object-detectors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
sudo apt-get update
sudo apt-get -y -q install ffmpeg libavcodec-extra
python -m pip install --upgrade pip setuptools wheel
pip3 install -q -r requirements_test.txt
pip install -q -r <(sed '/^mxnet/d' requirements_test.txt)
pip list
- name: Run Test Action - test_pytorch_object_detector
run: pytest --cov-report=xml --cov=art --cov-append -q -vv tests/estimators/object_detection/test_pytorch_object_detector.py --framework=pytorch --durations=0
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ci-pytorch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ jobs:
sudo apt-get update
sudo apt-get -y -q install ffmpeg libavcodec-extra
python -m pip install --upgrade pip setuptools wheel
pip3 install -r requirements_test.txt
pip install -q -r <(sed '/^torch/d;/^torchvision/d;/^torchaudio/d' requirements_test.txt)
pip install -q -r <(sed '/^mxnet/d' requirements_test.txt)
pip install torch==${{ matrix.torch }} --index-url https://download.pytorch.org/whl/cpu
pip install torchvision==${{ matrix.torchvision }} --index-url https://download.pytorch.org/whl/cpu
pip install torchaudio==${{ matrix.torchaudio }} --index-url https://download.pytorch.org/whl/cpu
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/ci-style-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@ jobs:
- name: Install Dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements_test.txt
pip install -q -r <(sed '/^numpy/d;/^tensorflow/d;/^keras/d' requirements_test.txt)
pip install numpy==1.22.4
pip install tensorflow==2.13.1
pip install keras==2.13.1
pip install -q -r <(sed '/^tensorflow/d;/^keras/d;/^mxnet/d' requirements_test.txt)
pip install tensorflow==2.18.1
pip install keras==3.10.0
pip list
- name: pycodestyle
run: pycodestyle --ignore=C0330,C0415,E203,E231,W503 --max-line-length=120 art
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/ci-tensorflow-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ jobs:
fail-fast: false
matrix:
include:
- name: TensorFlow 2.14.0v1 (Keras 2.14.0 Python 3.10)
- name: TensorFlow 2.18.1v1 (Keras 3.10.0 Python 3.10)
framework: tensorflow2v1
python: '3.10'
tensorflow: 2.14.0
tensorflow: 2.18.1
tf_version: v2
keras: 2.14.0
tf_addons: 0.21.0
- name: TensorFlow 2.14.0 (Keras 2.14.0 Python 3.10)
keras: 3.10.0
tf_addons: 0.23.0
- name: TensorFlow 2.18.1 (Keras 3.10.0 Python 3.10)
framework: tensorflow
python: '3.10'
tensorflow: 2.14.0
tensorflow: 2.18.1
tf_version: v2
keras: 2.14.0
tf_addons: 0.21.0
keras: 3.10.0
tf_addons: 0.23.0

name: ${{ matrix.name }}
steps:
Expand All @@ -56,7 +56,7 @@ jobs:
sudo apt-get update
sudo apt-get -y -q install ffmpeg libavcodec-extra
python -m pip install --upgrade pip setuptools wheel
pip install -q -r <(sed '/^tensorflow/d;/^keras/d;/^tensorflow-addons/d' requirements_test.txt)
pip install -q -r <(sed '/^tensorflow/d;/^keras/d;/^tensorflow-addons/d;/^mxnet/d' requirements_test.txt)
pip install tensorflow==${{ matrix.tensorflow }}
pip install keras==${{ matrix.keras }}
pip install tensorflow-addons==${{ matrix.tf_addons }}
Expand Down
1 change: 0 additions & 1 deletion art/attacks/evasion/carlini.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,6 @@ def _check_params(self) -> None:
raise ValueError("The initial constant value must be a positive float.")

if not isinstance(self.largest_const, (int, float)) or self.largest_const < 0:
print(self.largest_const)
raise ValueError("The largest constant value must be a positive float.")

if not isinstance(self.const_factor, (int, float)) or self.const_factor < 0:
Expand Down
4 changes: 2 additions & 2 deletions art/attacks/poisoning/adversarial_embedding_attack.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
BatchNormalization,
LeakyReLU,
)
from tensorflow.keras.optimizers.legacy import Adam
from tensorflow.keras.optimizers import Adam

opt = Adam(lr=self.learning_rate)

Expand All @@ -123,7 +123,7 @@
from keras.layers import GaussianNoise, Dense, BatchNormalization, LeakyReLU

try:
from keras.optimizers.legacy import Adam
from keras.optimizers import Adam

Check warning on line 126 in art/attacks/poisoning/adversarial_embedding_attack.py

View check run for this annotation

Codecov / codecov/patch

art/attacks/poisoning/adversarial_embedding_attack.py#L126

Added line #L126 was not covered by tests

opt = Adam(lr=self.learning_rate)
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion art/attacks/poisoning/gradient_matching_attack.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def get_config(self) -> dict:
"""
return {"schedule": self.schedule}

self.optimizer = tf.keras.optimizers.legacy.Adam(
self.optimizer = tf.keras.optimizers.Adam(
gradient_transformers=[lambda grads_and_vars: [(tf.sign(g), v) for (g, v) in grads_and_vars]]
)
self.lr_schedule = tf.keras.callbacks.LearningRateScheduler(PredefinedLRSchedule(*self.learning_rate_schedule))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(
logits: bool,
input_shape: tuple[int, ...],
loss_object: "tf.Tensor" | None = None,
optimizer: "tf.keras.optimizers.legacy.Optimizer" | None = None,
optimizer: "tf.keras.optimizers.Optimizer" | None = None,
train_step: Callable | None = None,
channels_first: bool = False,
clip_values: "CLIP_VALUES_TYPE" | None = None,
Expand Down
Loading
Loading