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

[MNT] Removing tensorflow_addons dependency #1421

Merged
merged 39 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
06cf993
tensorflow bound
MatthewMiddlehurst Apr 14, 2024
e296be4
add manually instance normalization
hadifawaz1999 Apr 26, 2024
535376d
empty commit
hadifawaz1999 Apr 26, 2024
36bc067
fix doxs
hadifawaz1999 Apr 26, 2024
973f14f
fix bug
hadifawaz1999 Apr 29, 2024
b67eda7
add maintainer
hadifawaz1999 Apr 29, 2024
a1c78e6
re arrange
hadifawaz1999 Apr 29, 2024
c29cc5d
dep on utils
hadifawaz1999 Apr 29, 2024
17c40aa
fix comments
hadifawaz1999 Apr 29, 2024
f23abc0
add version and file to header
hadifawaz1999 Apr 29, 2024
d5dbedb
re add conflict
hadifawaz1999 Apr 29, 2024
fc9af01
remove addon
hadifawaz1999 Apr 29, 2024
bb83016
only adodn remove
hadifawaz1999 Apr 29, 2024
a3467e6
Merge branch 'main' of https://github.com/aeon-toolkit/aeon into mm/t…
MatthewMiddlehurst Apr 29, 2024
c394d4a
add typeguard dep
hadifawaz1999 Apr 30, 2024
9f57a0f
remove addons from test
hadifawaz1999 Apr 30, 2024
0e99adb
remove tag of python<3.12 from base class
hadifawaz1999 Apr 30, 2024
949e6bb
edit pyptoject for test details
hadifawaz1999 Jun 3, 2024
ebbfa99
remove typeguard
hadifawaz1999 Jun 3, 2024
c00fd91
merging mac stuff
hadifawaz1999 Jul 3, 2024
3c2fe6b
remove addons
hadifawaz1999 Jul 3, 2024
aaa16ab
remove typeguard
hadifawaz1999 Jul 3, 2024
03030bb
fix bug in python version
hadifawaz1999 Jul 3, 2024
5538f89
remove config on python < 3.12
hadifawaz1999 Jul 3, 2024
d4b7c42
remove python version from test
hadifawaz1999 Jul 3, 2024
13449ba
remove python version from base
hadifawaz1999 Jul 3, 2024
ac1ae61
use group norm
hadifawaz1999 Jul 3, 2024
6e9217c
re-add 3.12 limit
hadifawaz1999 Jul 3, 2024
83356d8
Merge branch 'main' into mm/tensorflow
TonyBagnall Jul 3, 2024
e47e3d8
remove tags and add python version
hadifawaz1999 Jul 4, 2024
40281c3
Merge branch 'mm/tensorflow' of https://github.com/aeon-toolkit/aeon …
hadifawaz1999 Jul 4, 2024
09c35a5
skip random state clr test
hadifawaz1999 Jul 4, 2024
5e67887
Merge branch 'main' into mm/tensorflow
TonyBagnall Jul 4, 2024
9db7f73
Merge branch 'main' of https://github.com/aeon-toolkit/aeon into mm/t…
hadifawaz1999 Jul 4, 2024
61dd6db
Merge branch 'mm/tensorflow' of https://github.com/aeon-toolkit/aeon …
hadifawaz1999 Jul 4, 2024
2bef940
fix test all networks
hadifawaz1999 Jul 4, 2024
da619e4
set y for channel selection test
TonyBagnall Jul 4, 2024
d03e5bd
Merge branch 'main' into mm/tensorflow
TonyBagnall Jul 4, 2024
fff9488
set y for channel selection test
TonyBagnall Jul 4, 2024
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: 4 additions & 3 deletions aeon/classification/deep_learning/_encoder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Encoder Classifier."""

__maintainer__ = []
__maintainer__ = ["hadifawaz1999"]
__all__ = ["EncoderClassifier"]

import gc
Expand Down Expand Up @@ -83,7 +83,7 @@ class EncoderClassifier(BaseDeepClassifier):
"""

_tags = {
"python_dependencies": ["tensorflow", "tensorflow_addons"],
"python_dependencies": ["tensorflow"],
}

def __init__(
Expand Down Expand Up @@ -255,7 +255,8 @@ def _fit(self, X, y):

try:
self.model_ = tf.keras.models.load_model(
self.file_path + self.file_name_ + ".keras", compile=False
self.file_path + self.file_name_ + ".keras",
compile=False,
)
if not self.save_best_model:
os.remove(self.file_path + self.file_name_ + ".keras")
Expand Down
1 change: 0 additions & 1 deletion aeon/classification/deep_learning/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class BaseDeepClassifier(BaseClassifier, ABC):
"non-deterministic": True,
"cant-pickle": True,
"python_dependencies": "tensorflow",
"python_version": "<3.12",
}

def __init__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


@pytest.mark.skipif(
not _check_soft_dependencies(["tensorflow", "tensorflow_addons"], severity="none"),
not _check_soft_dependencies(["tensorflow"], severity="none"),
reason="skip test if required soft dependency not available",
)
def test_random_state_deep_learning_cls():
Expand Down
1 change: 0 additions & 1 deletion aeon/clustering/deep_learning/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class BaseDeepClusterer(BaseClusterer, ABC):
"non-deterministic": True,
"cant-pickle": True,
"python_dependencies": "tensorflow",
"python_version": "<3.12",
}

def __init__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@

from aeon.clustering import deep_learning
from aeon.testing.data_generation import make_example_3d_numpy
from aeon.utils.validation._dependencies import _check_soft_dependencies

__maintainer__ = ["hadifawaz1999"]


@pytest.mark.skipif(
not _check_soft_dependencies(["tensorflow", "tensorflow_addons"], severity="none"),
# not _check_soft_dependencies("tensorflow", severity="none"),
# See Issue #1761
True,
reason="skip test if required soft dependency not available",
)
def test_random_state_deep_learning_clr():
Expand Down
9 changes: 5 additions & 4 deletions aeon/networks/_encoder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Encoder Classifier."""

__maintainer__ = []
__maintainer__ = ["hadifawaz1999"]

from aeon.networks.base import BaseDeepLearningNetwork

Expand Down Expand Up @@ -88,7 +88,8 @@ def build_network(self, input_shape, **kwargs):
output_layer : a keras layer
"""
import tensorflow as tf
import tensorflow_addons as tfa

tf.keras.config.enable_unsafe_deserialization()

self._kernel_size = (
[5, 11, 21] if self.kernel_size is None else self.kernel_size
Expand All @@ -107,7 +108,7 @@ def build_network(self, input_shape, **kwargs):
strides=self.strides,
)(x)

conv = tfa.layers.InstanceNormalization()(conv)
conv = tf.keras.layers.GroupNormalization(groups=-1)(conv)
conv = tf.keras.layers.PReLU(shared_axes=[1])(conv)
conv = tf.keras.layers.Dropout(self.dropout_proba)(conv)

Expand Down Expand Up @@ -138,7 +139,7 @@ def build_network(self, input_shape, **kwargs):
hidden_fc_layer = tf.keras.layers.Dense(
units=self.fc_units, activation=self.activation
)(attention)
hidden_fc_layer = tfa.layers.InstanceNormalization()(hidden_fc_layer)
hidden_fc_layer = tf.keras.layers.GroupNormalization(groups=-1)(hidden_fc_layer)

# output layer before classification layer

Expand Down
4 changes: 2 additions & 2 deletions aeon/networks/tests/test_all_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ def test_all_networks_functionality(network):
if not (
network.__name__
in ["BaseDeepNetwork", "BaseDeepLearningNetwork", "EncoderNetwork"]
):
) and _check_python_version(network._config["python_version"], severity="none"):
hadifawaz1999 marked this conversation as resolved.
Show resolved Hide resolved
if _check_soft_dependencies(
network._config["python_dependencies"], severity="none"
) and _check_python_version(network._config["python_version"], severity="none"):
):
my_network = network()

if network._config["structure"] == "auto-encoder":
Expand Down
2 changes: 1 addition & 1 deletion aeon/regression/deep_learning/_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class EncoderRegressor(BaseDeepRegressor):
"""

_tags = {
"python_dependencies": ["tensorflow", "tensorflow_addons"],
"python_dependencies": ["tensorflow"],
}

def __init__(
Expand Down
1 change: 0 additions & 1 deletion aeon/regression/deep_learning/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class BaseDeepRegressor(BaseRegressor, ABC):
"non-deterministic": True,
"cant-pickle": True,
"python_dependencies": "tensorflow",
"python_version": "<3.12",
}

def __init__(self, batch_size=40, last_file_name="last_model"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


@pytest.mark.skipif(
not _check_soft_dependencies(["tensorflow", "tensorflow_addons"], severity="none"),
not _check_soft_dependencies(["tensorflow"], severity="none"),
reason="skip test if required soft dependency not available",
)
def test_random_state_deep_learning_rgs():
Expand Down
1 change: 1 addition & 0 deletions aeon/utils/networks/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Utils for tensorflow_addons."""
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ all_extras = [
"ruptures>=1.1.9",
"tbats>=1.1.0",
"tensorflow>=2.12; python_version < '3.12'",
"tensorflow-addons; python_version < '3.12'",
"torch>=1.13.1",
"tsfresh>=0.20.0",
"tslearn>=0.5.2",
Expand All @@ -93,10 +92,9 @@ all_extras = [
]
dl = [
"keras-self-attention",
"tensorflow>=2.12; python_version < '3.12'",
"tensorflow-addons; python_version < '3.12'",
# dependency of tensorflow, see issue #1724
"keras<3.4",
"tensorflow>=2.12; python_version < '3.12'",
]
unstable_extras = [
"mrsqm>=0.0.1,<0.1.0; platform_system == 'Darwin' and python_version < '3.12'", # requires gcc and fftw to be installed for Windows and some other OS (see http://www.fftw.org/index.html)
Expand Down
Loading