Skip to content

Commit 83dafb0

Browse files
Support TF 2.15 (#101)
* Add TF=2.15 and TFP=0.23 * Exclude TF 2.15 with python 3.8 * Use older mypy version with python 3.7 * Use older mypy for py 37, 38, 39 * Exclude TF 2.15 with python 3.9 * Revert "Exclude TF 2.15 with python 3.9" This reverts commit f9d95b5. * Revert "Use older mypy for py 37, 38, 39" This reverts commit 3e4f98c. * Separate requirements for python 3.8 * Include python 3.9 in new requirements file * Fix test by using sets directly with id Behavior of tensorflow ObjectIdentitySet has change in 2.15, resulting in the set equality comparing wrappers instead of wrapped values. See tensorflow/tensorflow@bc28335. * Also include intermediate TF versions * Add exclude * Add exclude * Fix tfp versions
1 parent 47ed46a commit 83dafb0

File tree

8 files changed

+62
-14
lines changed

8 files changed

+62
-14
lines changed

.github/workflows/quality-check.yaml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
strategy:
2323
matrix:
2424
python-version: ["3.7", "3.8", "3.9", "3.10"]
25-
tensorflow: ["~=2.5.0", "~=2.6.0", "~=2.7.0", "~=2.8.0", "~=2.9.0", "~=2.10.0", "~=2.11.0", "~=2.12.0"]
25+
tensorflow: ["~=2.5.0", "~=2.6.0", "~=2.7.0", "~=2.8.0", "~=2.9.0", "~=2.10.0", "~=2.11.0", "~=2.12.0", "~=2.13.0", "~=2.14.0", "~=2.15.0"]
2626
include:
2727
- tensorflow: "~=2.5.0"
2828
keras: "~=2.6.0"
@@ -47,7 +47,16 @@ jobs:
4747
tensorflow-probability: "~=0.19.0"
4848
- tensorflow: "~=2.12.0"
4949
keras: "~=2.12.0"
50-
tensorflow-probability: "~=0.19.0" # sic! no new tfp release
50+
tensorflow-probability: "~=0.20.0"
51+
- tensorflow: "~=2.13.0"
52+
keras: "~=2.13.0"
53+
tensorflow-probability: "~=0.21.0"
54+
- tensorflow: "~=2.14.0"
55+
keras: "~=2.14.0"
56+
tensorflow-probability: "~=0.22.0"
57+
- tensorflow: "~=2.15.0"
58+
keras: "~=2.15.0"
59+
tensorflow-probability: "~=0.23.0"
5160
exclude:
5261
# These older versions of TensorFlow don't work with Python 3.10:
5362
- python-version: "3.10"
@@ -59,6 +68,17 @@ jobs:
5968
# These newer versions of TensorFlow don't work with Python 3.7:
6069
- python-version: "3.7"
6170
tensorflow: "~=2.12.0"
71+
- python-version: "3.7"
72+
tensorflow: "~=2.13.0"
73+
- python-version: "3.7"
74+
tensorflow: "~=2.14.0"
75+
- python-version: "3.7"
76+
tensorflow: "~=2.15.0"
77+
# These newer versions of TensorFlow don't work with Python 3.8:
78+
- python-version: "3.8"
79+
tensorflow: "~=2.14.0"
80+
- python-version: "3.8"
81+
tensorflow: "~=2.15.0"
6282

6383
name: Python-${{ matrix.python-version }} tensorflow${{ matrix.tensorflow }}
6484
env:

CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ Because GitHub's [graph of contributors](http://github.com/secondmind-labs/GPflu
1818
[Jesper Nielsen](https://github.com/jesnie)
1919
[Sebastian Ober](https://github.com/sebastianober)
2020
[Simon Chiu](https://github.com/sc336)
21+
[Khurram Ghani](https://github.com/khurram-ghani)
2122

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ LINT_FILE_IGNORES = "$(LIB_NAME)/__init__.py:F401,F403 \
2525
$(LIB_NAME)/sampling/__init__.py:F401 \
2626
$(LIB_NAME)/utils/__init__.py:F401"
2727

28-
# Python 3.7 uses a separate test requirements file
28+
# Older Python versions use separate test requirements files
2929
ifeq ("$(VERSION_PYTHON)", "3.7")
3030
TEST_REQUIREMENTS = "tests_requirements_37.txt"
31+
else ifeq ($(filter $(VERSION_PYTHON),3.8 3.9),$(VERSION_PYTHON))
32+
TEST_REQUIREMENTS = "tests_requirements_38_39.txt"
3133
else
3234
TEST_REQUIREMENTS = "tests_requirements.txt"
3335
endif

gpflux/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
#
1616
"""Adds __version__"""
1717

18-
__version__ = "0.4.2"
18+
__version__ = "0.4.3"

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
"gpflow>=2.6.3",
1010
"numpy",
1111
"scipy",
12-
"tensorflow>=2.5.0,<2.13.0; platform_system!='Darwin' or platform_machine!='arm64'",
12+
"tensorflow>=2.5.0,<=2.15.0; platform_system!='Darwin' or platform_machine!='arm64'",
1313
# NOTE: Support of Apple Silicon MacOS platforms is in an experimental mode
14-
"tensorflow-macos>=2.5.0,<2.13.0; platform_system=='Darwin' and platform_machine=='arm64'",
14+
"tensorflow-macos>=2.5.0,<=2.15.0; platform_system=='Darwin' and platform_machine=='arm64'",
1515
# NOTE: once we require tensorflow-probability>=0.12, we can remove our custom deepcopy handling
16-
"tensorflow-probability>=0.13.0,<0.20.0",
16+
"tensorflow-probability>=0.13.0,<=0.23.0",
1717
]
1818

1919
with open("README.md", "r") as file:

tests/gpflux/layers/test_dedup_trackable_layer.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import pytest
2020
import tensorflow as tf
2121
from tensorflow.python.ops.resource_variable_ops import ResourceVariable
22-
from tensorflow.python.util import object_identity
2322

2423
import gpflow
2524
from gpflow.utilities import parameter_dict
@@ -141,11 +140,10 @@ def test_weights_equals_deduplicated_parameter_dict(model):
141140
# We filter out the parameters of type ResourceVariable.
142141
# They have been added to the model by the `add_metric` call in the layer.
143142
parameters = [p for p in parameter_dict(model).values() if not isinstance(p, ResourceVariable)]
144-
variables = map(lambda p: p.unconstrained_variable, parameters)
145-
deduplicate_variables = object_identity.ObjectIdentitySet(variables)
143+
variables = {id(p.unconstrained_variable) for p in parameters}
146144

147145
weights = model.trainable_weights
148-
assert len(weights) == len(deduplicate_variables)
146+
assert len(weights) == len(variables)
149147

150-
weights_set = object_identity.ObjectIdentitySet(weights)
151-
assert weights_set == deduplicate_variables
148+
weights_set = {id(w) for w in weights}
149+
assert weights_set == variables

tests_requirements_37.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ codecov
66
click==8.0.4
77
flake8==4.0.1
88
isort==5.10.1
9-
mypy
9+
mypy<1.4.0 # Newer mypy versions cause issues with Python 3.7 ('Self' from 'typing_extensions').
1010
pytest
1111
pytest-cov
1212
pytest-random-order

tests_requirements_38_39.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Test requirements specific to Python 3.8 and 3.9
2+
3+
# Code quality tools:
4+
black==21.7b0
5+
codecov
6+
click==8.0.4
7+
flake8==4.0.1
8+
isort==5.10.1
9+
mypy<1.4.0 # Newer mypy versions cause issues with older Python ('Self' from 'typing_extensions').
10+
pytest
11+
pytest-cov
12+
pytest-random-order
13+
pytest-mock
14+
15+
# For mypy stubs:
16+
types-Deprecated
17+
numpy
18+
19+
tqdm
20+
21+
# Notebook tests:
22+
jupytext
23+
nbformat
24+
nbconvert
25+
jupyter_client
26+
ipykernel
27+
tornado

0 commit comments

Comments
 (0)