Skip to content

Commit

Permalink
Support TF 2.15 (openvinotoolkit#2609)
Browse files Browse the repository at this point in the history
### Changes

Support TF 2.15

### Reason for changes

Support TF 2.15

### Related tickets

133742

### Tests

pre-commit tests
  • Loading branch information
andrey-churkin authored Jul 1, 2024
1 parent beb9c04 commit a25e56d
Show file tree
Hide file tree
Showing 110 changed files with 142 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ jobs:
lfs: true
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: 3.8.18
python-version: 3.9.19
cache: pip
- name: Install NNCF and test requirements
run: make install-tensorflow-test
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ conda install -c conda-forge nncf
- Python\* 3.8 or later
- Supported frameworks:
- PyTorch\* >=2.2, <2.4
- TensorFlow\* >=2.8.4, <=2.12.1
- TensorFlow\* >=2.8.4, <=2.15.1
- ONNX\* ==1.16.0
- OpenVINO\* >=2022.3.0

Expand Down
3 changes: 2 additions & 1 deletion constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ onnx==1.16.0
onnxruntime==1.17.1

# TensorFlow
tensorflow==2.12.1
tensorflow==2.12.1; python_version < '3.9'
tensorflow==2.15.1; python_version >= '3.9'

# Tests and examples
pytest==8.0.2
Expand Down
4 changes: 3 additions & 1 deletion docs/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ as well as the supported versions of Python:

| NNCF | OpenVINO | PyTorch | ONNX | TensorFlow | Python |
|-----------|------------|----------|----------|------------|--------|
| `develop` | `2024.2.0` | `2.3.0` | `1.16.0` | `2.12.0` | `3.8` |
| `develop` | `2024.2.0` | `2.3.0` | `1.16.0` | `2.15.1` | `3.8`* |
| `2.11.0` | `2024.2.0` | `2.3.0` | `1.16.0` | `2.12.0` | `3.8` |
| `2.10.0` | `2024.1.0` | `2.2.1` | `1.16.0` | `2.12.0` | `3.8` |
| `2.9.0` | `2024.0.0` | `2.1.2` | `1.13.1` | `2.12.0` | `3.8` |
Expand All @@ -53,3 +53,5 @@ as well as the supported versions of Python:
| `2.6.0` | `2023.1.0` | `2.0.1` | `1.13.1` | `2.12.0` | `3.8` |
| `2.5.0` | `2023.0.0` | `1.13.1` | `1.13.1` | `2.11.1` | `3.8` |
| `2.4.0` | `2022.1.0` | `1.12.1` | `1.12.0` | `2.8.2` | `3.8` |

> (*) Python 3.9 or higher is required for TensorFlow 2.15.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
tensorflow~=2.12.0
tensorflow~=2.12.0; python_version < '3.9'
tensorflow~=2.15.1; python_version >= '3.9'
tensorflow-datasets
tqdm
openvino==2024.2
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@

import tensorflow as tf
import tensorflow.keras.backend as K
from packaging import version

from examples.tensorflow.common.object_detection.architecture import nn_ops

tensorflow_version = version.parse(version.parse(tf.__version__).base_version)


class CSPDarknet53:
"""Class to build CSPDarknet53"""
Expand All @@ -25,12 +28,17 @@ def DarknetConv2D_BN_Mish(self, *args, **kwargs):
"""Darknet Convolution2D followed by SyncBatchNormalization and Mish."""
no_bias_kwargs = {"use_bias": False}
no_bias_kwargs.update(kwargs)

if tensorflow_version < version.parse("2.15"):
mish = tf.keras.layers.Activation(self.mish)
else:
mish = tf.keras.layers.Activation("mish")

return nn_ops.compose(
nn_ops.DarknetConv2D(*args, **no_bias_kwargs),
# TODO(nsavelyev) replace by BatchNormalization(synchronized=True) once support for TF < 2.12 is dropped
tf.keras.layers.experimental.SyncBatchNormalization(),
# TODO(nsavelyev) change to tf.keras.activations.mish after upgrade to TF 2.13
tf.keras.layers.Activation(self.mish),
mish,
)

def csp_resblock_body(self, x, num_filters, num_blocks, all_narrow=True):
Expand Down
3 changes: 2 additions & 1 deletion examples/tensorflow/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ absl-py==1.0.0
tensorflow
tensorflow_datasets==4.2.0
tensorflow_hub
tensorflow_addons==0.20.0
tensorflow_addons==0.20.0; python_version < '3.9'
tensorflow_addons==0.23.0; python_version >= '3.9'
tensorflow-metadata==1.13.0
opencv-python
pycocotools==2.0.6
5 changes: 3 additions & 2 deletions nncf/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

__version__ = "2.12.0"


BKC_TORCH_SPEC = "==2.3.*"
BKC_TF_SPEC = "==2.12.*"
STRICT_TF_SPEC = ">=2.8.4,<2.14.0"
BKC_TF_SPEC = "==2.15.*"
STRICT_TF_SPEC = ">=2.8.4,<2.16.0"
Loading

0 comments on commit a25e56d

Please sign in to comment.