Skip to content
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

Add support for TensorFlow 2.13 #54

Merged
merged 2 commits into from
Jul 20, 2023
Merged
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
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,19 @@ jobs:
coverage-name: remote
tf-version: tensorflow==2.10
- script: test
python-version: "3.11"
coverage-name: latest
- script: test
tf-version: tensorflow==2.4.4
python-version: "3.7"
python-version: "3.8"
coverage-name: oldest
- script: test
tf-version: tensorflow~=2.6.0
python-version: "3.8"
coverage-name: tf-2.6
- script: remote-docs
tf-version: tensorflow==2.10
python-version: "3.9"
- script: remote-examples
tf-version: tensorflow==2.10
fail-fast: false
Expand All @@ -60,7 +63,7 @@ jobs:
steps:
- uses: nengo/nengo-bones/actions/setup@main
with:
python-version: ${{ matrix.python-version || '3.9' }}
python-version: ${{ matrix.python-version || '3.10' }}
- uses: nengo/nengo-bones/actions/generate-and-check@main
- name: Write secrets to file
run: |
Expand Down
7 changes: 4 additions & 3 deletions .nengobones.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ setup_py:
- "Intended Audience :: Science/Research"
- "Operating System :: OS Independent"
- "Programming Language :: Python "
- "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 "
- "Topic :: Scientific/Engineering :: Artificial Intelligence"

Expand Down Expand Up @@ -108,6 +109,6 @@ pyproject_toml: {}
version_py:
type: semver
major: 0
minor: 6
patch: 1
minor: 7
patch: 0
release: False
9 changes: 7 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ Release history
- Removed
- Fixed

0.6.1 (unreleased)
0.7.0 (unreleased)
==================

*Compatible with TensorFlow 2.4 - 2.11*
*Compatible with TensorFlow 2.4 - 2.13*

**Changed**

- Minimum supported Python version is now 3.8 (3.7 reached end of life in June 2023).
(`#54`_)

.. _#54: https://github.com/nengo/keras-lmu/pull/54

0.6.0 (May 5, 2023)
===================
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ To install KerasLMU, we recommend using ``pip``.
Requirements
------------

KerasLMU works with Python 3.6 or later. After installing NumPy and TensorFlow, ``pip``
KerasLMU works with Python 3.8 or later. After installing NumPy and TensorFlow, ``pip``
will do its best to install all of the package's other requirements when it installs
KerasLMU. However, if anything goes wrong during this process, you can install each
required package manually and then try to ``pip install keras-lmu`` again.
Expand Down
26 changes: 21 additions & 5 deletions keras_lmu/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@
from tensorflow.python.keras.layers.recurrent import DropoutRNNCellMixin
elif version.parse(tf.__version__) < version.parse("2.9.0rc0"):
from keras.layers.recurrent import DropoutRNNCellMixin
else:
elif version.parse(tf.__version__) < version.parse("2.13.0rc0"):
from keras.layers.rnn.dropout_rnn_cell_mixin import DropoutRNNCellMixin
else:
from keras.src.layers.rnn.dropout_rnn_cell_mixin import DropoutRNNCellMixin

if version.parse(tf.__version__) < version.parse("2.8.0rc0"):
from tensorflow.keras.layers import Layer as BaseRandomLayer
else:
elif version.parse(tf.__version__) < version.parse("2.13.0rc0"):
from keras.engine.base_layer import BaseRandomLayer
else:
from keras.src.engine.base_layer import BaseRandomLayer


@tf.keras.utils.register_keras_serializable("keras-lmu")
Expand Down Expand Up @@ -450,7 +454,11 @@ def get_config(self):
def from_config(cls, config):
"""Load model from serialized config."""

config["hidden_cell"] = tf.keras.layers.deserialize(config["hidden_cell"])
config["hidden_cell"] = (
None
if config["hidden_cell"] is None
else tf.keras.layers.deserialize(config["hidden_cell"])
)
return super().from_config(config)


Expand Down Expand Up @@ -714,7 +722,11 @@ def get_config(self):
def from_config(cls, config):
"""Load model from serialized config."""

config["hidden_cell"] = tf.keras.layers.deserialize(config["hidden_cell"])
config["hidden_cell"] = (
None
if config["hidden_cell"] is None
else tf.keras.layers.deserialize(config["hidden_cell"])
)
return super().from_config(config)


Expand Down Expand Up @@ -1065,5 +1077,9 @@ def get_config(self):
def from_config(cls, config):
"""Load model from serialized config."""

config["hidden_cell"] = tf.keras.layers.deserialize(config["hidden_cell"])
config["hidden_cell"] = (
None
if config["hidden_cell"] is None
else tf.keras.layers.deserialize(config["hidden_cell"])
)
return super().from_config(config)
2 changes: 1 addition & 1 deletion keras_lmu/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
tagged with the version.
"""

version_info = (0, 6, 1)
version_info = (0, 7, 0)

name = "keras-lmu"
dev = 0
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
requires = ["setuptools<64", "wheel"]

[tool.black]
target-version = ['py36']
target-version = ['py38']

[tool.isort]
profile = "black"
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,15 @@ def read(*filenames, **kwargs):
"optional": optional_req,
"tests": tests_req,
},
python_requires=">=3.6",
python_requires=">=3.8",
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
"License :: Free for non-commercial use",
"Operating System :: OS Independent",
"Programming Language :: Python ",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Scientific/Engineering ",
Expand Down
Loading