Skip to content

Commit

Permalink
Build 2.12 (#2821)
Browse files Browse the repository at this point in the history
* Initial build against TF2.12
* support 3.11

---------

Co-authored-by: bhack <[email protected]>
  • Loading branch information
seanpmorgan and bhack authored Apr 7, 2023
1 parent c35cde6 commit 9c1642a
Show file tree
Hide file tree
Showing 23 changed files with 71 additions and 92 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
backport:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
name: Backport
steps:
- name: Backport Bot
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
steps:
- uses: actions/setup-python@v1
with:
python-version: 3.7
python-version: 3.9
- uses: actions/checkout@v2
- run: pip install --default-timeout=1000 -r tools/install_deps/tensorflow-cpu.txt -r tools/install_deps/pytest.txt
- run: pip install -e ./
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/notify_codeowners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.7
python-version: 3.9
- run: pip install pygithub click
- name: Drop a message for codeowners
env:
Expand Down
42 changes: 22 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ on:
- r*

env:
MIN_PY_VERSION: '3.7'
MAX_PY_VERSION: '3.10'
MIN_PY_VERSION: '3.9'
MAX_PY_VERSION: '3.11'

jobs:
test-with-bazel:
name: Test with bazel
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
Expand All @@ -40,22 +40,22 @@ jobs:
matrix:
# To switch on windows-2022/latest, please verify the bazel version:
# https://github.com/bazelbuild/bazel/issues/14232#issuecomment-1011247429
os: ['macos-12', 'windows-2019', 'ubuntu-18.04']
py-version: ['3.7', '3.8', '3.9', '3.10']
tf-version: ['2.9.3', '2.10.1', '2.11.0']
os: ['macos-12', 'windows-2019', 'ubuntu-20.04']
py-version: ['3.8', '3.9', '3.10', '3.11']
tf-version: ['2.10.1', '2.11.0', '2.12.0']
cpu: ['x86']
include:
- os: 'macos-12'
cpu: 'arm64'
tf-version: '2.11.0'
tf-version: '2.12.0'
py-version: '3.8'
- os: 'macos-12'
cpu: 'arm64'
tf-version: '2.11.0'
tf-version: '2.12.0'
py-version: '3.9'
- os: 'macos-12'
cpu: 'arm64'
tf-version: '2.11.0'
tf-version: '2.12.0'
py-version: '3.10'
fail-fast: false
steps:
Expand All @@ -66,7 +66,7 @@ jobs:
script: |
const commit_details = await github.git.getCommit({owner: context.repo.owner, repo: context.repo.repo, commit_sha: context.sha});
return commit_details.data.author.date
- if: matrix.tf-version != '2.10.0'
- if: matrix.tf-version != '2.12.0'
shell: bash
run: echo "SKIP_CUSTOM_OP_TESTS=--skip-custom-ops" >> $GITHUB_ENV
- if: github.event_name == 'push'
Expand All @@ -76,11 +76,12 @@ jobs:
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py-version }}
- if: matrix.os != 'ubuntu-18.04'
- if: matrix.os != 'ubuntu-20.04'
name: Setup Bazel
# Ubuntu bazel is run inside of the docker image
run: bash tools/install_deps/install_bazelisk.sh ./
- name: Build wheels
- if: matrix.py-version != '3.11' || matrix.tf-version == '2.12.0'
name: Build wheels
env:
OS: ${{ runner.os }}
PY_VERSION: ${{ matrix.py-version }}
Expand All @@ -89,32 +90,33 @@ jobs:
CPU: ${{ matrix.cpu }}
shell: bash
run: bash .github/workflows/make_wheel_${OS}_${CPU}.sh
- uses: actions/upload-artifact@v1
- if: matrix.py-version != '3.11' || matrix.tf-version == '2.12.0'
uses: actions/upload-artifact@v1
with:
name: ${{ runner.os }}-${{ matrix.py-version }}-tf${{ matrix.tf-version }}-${{ matrix.cpu }}-wheel
path: wheelhouse
upload-wheels:
name: Publish wheels to PyPi
needs: [release-wheel, test-with-bazel]
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
strategy:
matrix:
os: ['macOS', 'Windows', 'Linux']
py-version: ['3.7', '3.8', '3.9', '3.10']
tf-version: ['2.11.0']
py-version: ['3.8', '3.9', '3.10', '3.11']
tf-version: ['2.12.0']
cpu: ['x86']
include:
- os: 'macOS'
cpu: 'arm64'
tf-version: '2.11.0'
tf-version: '2.12.0'
py-version: '3.8'
- os: 'macOS'
cpu: 'arm64'
tf-version: '2.11.0'
tf-version: '2.12.0'
py-version: '3.9'
- os: 'macOS'
cpu: 'arm64'
tf-version: '2.11.0'
tf-version: '2.12.0'
py-version: '3.10'
fail-fast: false
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'release'
Expand All @@ -134,7 +136,7 @@ jobs:
upload-dev-container:
name: Upload dev container to DockerHub
needs: [release-wheel, test-with-bazel]
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
env:
PY_VERSION: '3.9'
if: (github.event_name == 'push' && github.ref == 'refs/heads/master')
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate_codeowners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.7
python-version: 3.9
- run: pip install pygithub click
- name: Check that the CODEOWNERS is valid
env:
Expand Down
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ conda activate my_dev_environement
Just run from the root:

```bash
pip install tensorflow==2.11.0
# you can use "pip install tensorflow-cpu==2.11.0" too if you're not testing on gpu.
pip install tensorflow==2.12.0
# you can use "pip install tensorflow-cpu==2.12.0" too if you're not testing on gpu.
pip install -e ./
```

Expand Down Expand Up @@ -262,7 +262,7 @@ If you need a custom C++/Cuda op for your test, compile your ops with

```bash
python configure.py
pip install tensorflow==2.11.0 -e ./ -r tools/install_deps/pytest.txt
pip install tensorflow==2.12.0 -e ./ -r tools/install_deps/pytest.txt
bash tools/install_so_files.sh # Linux/macos/WSL2
sh tools/install_so_files.sh # PowerShell
```
Expand All @@ -285,12 +285,12 @@ docker run --rm -it -v ${PWD}:/addons -w /addons tfaddons/dev_container:latest-c

GPU Docker:
```bash
docker run --gpus all --rm -it -v ${PWD}:/addons -w /addons gcr.io/tensorflow-testing/nosla-cuda11.2-cudnn8.1-ubuntu18.04-manylinux2010-multipython
docker run --gpus all --rm -it -v ${PWD}:/addons -w /addons gcr.io/tensorflow-testing/nosla-cuda11.8-cudnn8.6-ubuntu20.04-manylinux2014-multipython
```

Configure:
```bash
python3 -m pip install tensorflow==2.11.0
python3 -m pip install tensorflow==2.12.0
python3 ./configure.py # Links project with TensorFlow dependency
```

Expand Down Expand Up @@ -329,7 +329,7 @@ quickly, as Bazel has great support for caching and distributed testing.
To test with Bazel:

```bash
python3 -m pip install tensorflow==2.11.0
python3 -m pip install tensorflow==2.12.0
python3 configure.py
python3 -m pip install -r tools/install_deps/pytest.txt
bazel test -c opt -k \
Expand Down
19 changes: 3 additions & 16 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,16 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("//build_deps/tf_dependency:tf_configure.bzl", "tf_configure")
load("//build_deps/toolchains/gpu:cuda_configure.bzl", "cuda_configure")

http_archive(
name = "cub_archive",
build_file = "//build_deps/toolchains/gpu:cub.BUILD",
sha256 = "6bfa06ab52a650ae7ee6963143a0bbc667d6504822cbd9670369b598f18c58c3",
strip_prefix = "cub-1.8.0",
urls = [
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/NVlabs/cub/archive/1.8.0.zip",
"https://github.com/NVlabs/cub/archive/1.8.0.zip",
],
)

tf_configure(
name = "local_config_tf",
)

cuda_configure(name = "local_config_cuda")

http_archive(
name = "org_tensorflow",
sha256 = "99c732b92b1b37fc243a559e02f9aef5671771e272758aa4aec7f34dc92dac48",
strip_prefix = "tensorflow-2.11.0",
sha256 = "c030cb1905bff1d2446615992aad8d8d85cbe90c4fb625cee458c63bf466bc8e",
strip_prefix = "tensorflow-2.12.0",
urls = [
"https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.11.0.tar.gz",
"https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.12.0.tar.gz",
],
)

Expand Down
4 changes: 2 additions & 2 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,14 @@ def configure_cuda():
"CUDNN_INSTALL_PATH",
os.getenv("CUDNN_INSTALL_PATH", "/usr/lib/x86_64-linux-gnu"),
)
write_action_env("TF_CUDA_VERSION", os.getenv("TF_CUDA_VERSION", "11.2"))
write_action_env("TF_CUDA_VERSION", os.getenv("TF_CUDA_VERSION", "11.8"))
write_action_env("TF_CUDNN_VERSION", os.getenv("TF_CUDNN_VERSION", "8"))

write("test --config=cuda")
write("build --config=cuda")
write("build:cuda --define=using_cuda=true --define=using_cuda_nvcc=true")
write(
"build:cuda [email protected]_manylinux2014-cuda11.2-cudnn8.1-tensorrt7.2_config_cuda//crosstool:toolchain"
"build:cuda [email protected]_manylinux2014-cuda11.8-cudnn8.6-tensorrt8.4_config_cuda//crosstool:toolchain"
)


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ def has_ext_modules(self):
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Libraries",
Expand Down
19 changes: 3 additions & 16 deletions tensorflow_addons/seq2seq/tests/beam_search_ops_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import pytest
import tensorflow as tf

from tensorflow_addons import options
from tensorflow_addons.seq2seq import gather_tree


Expand Down Expand Up @@ -80,26 +79,14 @@ def test_bad_parent_values_on_gpu():
[[[0, 0, 0], [0, -1, 1], [2, 1, 2], [-1, -1, -1]]]
)
max_sequence_lengths = [3]
expected_result = _transpose_batch_time(
[[[2, -1, 2], [6, 5, 6], [7, 8, 9], [10, 10, 10]]]
)
if options.is_custom_kernel_disabled():
# The Python version has the same behavior on CPU and GPU.
with pytest.raises(tf.errors.InvalidArgumentError, match="parent id"):
_ = gather_tree(
step_ids=step_ids,
parent_ids=parent_ids,
max_sequence_lengths=max_sequence_lengths,
end_token=end_token,
)
else:
beams = gather_tree(

with pytest.raises(tf.errors.InvalidArgumentError, match="parent id"):
_ = gather_tree(
step_ids=step_ids,
parent_ids=parent_ids,
max_sequence_lengths=max_sequence_lengths,
end_token=end_token,
)
np.testing.assert_equal(expected_result, beams.numpy())


@pytest.mark.usefixtures("run_custom_and_py_ops")
Expand Down
4 changes: 2 additions & 2 deletions tensorflow_addons/utils/resource_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

import tensorflow as tf

INCLUSIVE_MIN_TF_VERSION_FOR_ABI_COMPATIBILITY = "2.11.0"
EXCLUSIVE_MAX_TF_VERSION_FOR_ABI_COMPATIBILITY = "2.12.0"
INCLUSIVE_MIN_TF_VERSION_FOR_ABI_COMPATIBILITY = "2.12.0"
EXCLUSIVE_MAX_TF_VERSION_FOR_ABI_COMPATIBILITY = "2.13.0"
abi_warning_already_raised = False
SKIP_CUSTOM_OPS = False

Expand Down
4 changes: 2 additions & 2 deletions tensorflow_addons/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"""Define TensorFlow Addons version information."""

# Required TensorFlow version [min, max)
INCLUSIVE_MIN_TF_VERSION = "2.9.0"
EXCLUSIVE_MAX_TF_VERSION = "2.12.0"
INCLUSIVE_MIN_TF_VERSION = "2.10.0"
EXCLUSIVE_MAX_TF_VERSION = "2.13.0"

# We follow Semantic Versioning (https://semver.org/)
_MAJOR_VERSION = "0"
Expand Down
2 changes: 1 addition & 1 deletion tools/build_dev_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -x -e

docker build \
-f tools/docker/dev_container.Dockerfile \
--build-arg TF_VERSION=2.11.0 \
--build-arg TF_VERSION=2.12.0 \
--build-arg TF_PACKAGE=tensorflow \
--build-arg PY_VERSION=$PY_VERSION \
--no-cache \
Expand Down
7 changes: 5 additions & 2 deletions tools/docker/build_wheel.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#syntax=docker/dockerfile:1.1.5-experimental
ARG PY_VERSION
FROM tensorflow/build:2.11-python$PY_VERSION as base_install
FROM tensorflow/build:2.12-python$PY_VERSION as base_install

ENV TF_NEED_CUDA="1"
ARG PY_VERSION
ARG TF_VERSION

# TODO: Temporary due to build bug https://github.com/pypa/pip/issues/11770
RUN python -m pip install pip==22.3.1

# TODO: Remove this if tensorflow/build container removes their keras-nightly install
# https://github.com/tensorflow/build/issues/78
RUN python -m pip uninstall -y keras-nightly
Expand Down Expand Up @@ -42,7 +45,7 @@ RUN bazel build \
--noshow_loading_progress \
--verbose_failures \
--test_output=errors \
[email protected]_manylinux2014-cuda11.2-cudnn8.1-tensorrt7.2_config_cuda//crosstool:toolchain \
[email protected]_manylinux2014-cuda11.8-cudnn8.6-tensorrt8.4_config_cuda//crosstool:toolchain \
build_pip_pkg && \
# Package Whl
bazel-bin/build_pip_pkg artifacts $NIGHTLY_FLAG
Expand Down
6 changes: 3 additions & 3 deletions tools/docker/cpu_tests.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#syntax=docker/dockerfile:1.1.5-experimental
FROM python:3.7 as build_wheel
FROM python:3.9 as build_wheel

ARG TF_VERSION=2.11.0
ARG TF_VERSION=2.12.0
RUN pip install --default-timeout=1000 tensorflow-cpu==$TF_VERSION

RUN apt-get update && apt-get install -y sudo rsync
Expand All @@ -27,7 +27,7 @@ RUN bazel build --enable_runfiles build_pip_pkg
RUN bazel-bin/build_pip_pkg artifacts


FROM python:3.7
FROM python:3.9

COPY tools/install_deps/tensorflow-cpu.txt ./
RUN pip install --default-timeout=1000 -r tensorflow-cpu.txt
Expand Down
2 changes: 1 addition & 1 deletion tools/docker/pre-commit.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7
FROM python:3.9

COPY tools/install_deps /install_deps
RUN pip install -r /install_deps/black.txt -r /install_deps/flake8.txt
Expand Down
Loading

0 comments on commit 9c1642a

Please sign in to comment.