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

Explicitly disallow Keras 3. #7

Merged
merged 13 commits into from
Aug 8, 2024
2 changes: 1 addition & 1 deletion .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
- Windows
- MacOs
py:
- "3.11"
- "3.10"
- "3.9"
- "3.8"
- "3.7"
steps:
- name: Setup python for test ${{ matrix.py }}
uses: actions/setup-python@v3
Expand Down
4 changes: 2 additions & 2 deletions realbook/layers/signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def __init__(
name: Name of the layer.
dtype: Type used in calcuation.
"""
super().__init__(trainable=False, name=name, dtype=dtype, dynamic=False)
super().__init__(trainable=False, name=name, dtype=dtype)
self.fft_length = fft_length
self.window_length = window_length if window_length else self.fft_length
self.hop_length = hop_length if hop_length else self.window_length // 4
Expand Down Expand Up @@ -171,7 +171,7 @@ def __init__(
name: Name of the layer.
dtype: Type used in calcuation.
"""
super().__init__(trainable=False, name=name, dtype=dtype, dynamic=False)
super().__init__(trainable=False, name=name, dtype=dtype)

# Because layer saves dtype as string???
self.dtypes_type = dtype
Expand Down
23 changes: 13 additions & 10 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.0.2
current_version = 1.0.3
commit = True
tag = True

Expand All @@ -22,20 +22,22 @@ classifiers =
Operating System :: MacOS :: MacOS X
Operating System :: Microsoft :: Windows
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
Programming Language :: Python :: Implementation :: CPython

[options]
zip_safe = False
packages = find:
include_package_data = True
# Note we don't yet support TensorFlow 2.16 or later due to Keras 3,
# which does not support complex datatypes.
install_requires =
tensorflow>=2.4; sys_platform != 'darwin' or platform.machine != 'arm64'
tensorflow-macos>=2.4; sys_platform == 'darwin' and platform.machine == 'arm64'
tensorboard
tensorflow>=2.4,<2.16; sys_platform != 'darwin' or platform.machine != 'arm64'
# TF 2.13 finally publishes ARM wheels:
tensorflow>=2.13,<2.16; sys_platform == 'darwin' and platform.machine == 'arm64'
types-protobuf
numpy
typing_extensions
Expand All @@ -48,7 +50,7 @@ tensorboard =
matplotlib
psutil
nvsmi
librosa>=0.9,<0.10
librosa>=0.9
test =
coverage>=5.0.2
pytest>=7.1.1
Expand All @@ -57,10 +59,11 @@ test =
tox
torch
nnaudio
numpy==1.21.6
librosa>=0.9,<0.10
tensorflow>=2.4,<2.11; sys_platform != 'darwin' or platform.machine != 'arm64'
tensorflow-macos>=2.4,<2.11; sys_platform == 'darwin' and platform.machine == 'arm64'
numpy>=1.22
librosa>=0.9
tensorflow>=2.4,<2.16; sys_platform != 'darwin' or platform.machine != 'arm64'
# TF 2.13 finally publishes ARM wheels:
tensorflow>=2.13,<2.16; sys_platform == 'darwin' and platform.machine == 'arm64'

[bumpversion:file:realbook/__init__.py]

Expand Down
6 changes: 3 additions & 3 deletions tests/callbacks/test_debugging.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def generate_data() -> Iterator[Tuple[List[int], List[int]]]:
),
)

model = tf.keras.Sequential([tf.keras.Input(shape=(1)), tf.keras.layers.Dense(1)])
model = tf.keras.Sequential([tf.keras.Input(shape=(1,)), tf.keras.layers.Dense(1)])
model.compile(loss="binary_crossentropy")
model.fit(fake_data, steps_per_epoch=1, epochs=10, callbacks=[HangDebugCallback()])

Expand Down Expand Up @@ -70,7 +70,7 @@ def generate_data() -> Iterator[Tuple[List[int], List[int]]]:
),
)

model = tf.keras.Sequential([tf.keras.Input(shape=(1)), tf.keras.layers.Dense(1)])
model = tf.keras.Sequential([tf.keras.Input(shape=(1,)), tf.keras.layers.Dense(1)])
model.compile(loss="binary_crossentropy")
model.fit(
fake_data,
Expand Down Expand Up @@ -114,7 +114,7 @@ def generate_data() -> Iterator[Tuple[List[int], List[int]]]:
),
)

model = tf.keras.Sequential([tf.keras.Input(shape=(1)), tf.keras.layers.Dense(1)])
model = tf.keras.Sequential([tf.keras.Input(shape=(1,)), tf.keras.layers.Dense(1)])
model.compile(loss="binary_crossentropy")
model.fit(
fake_data,
Expand Down
2 changes: 1 addition & 1 deletion tests/layers/test_nnaudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_cqt_trainable_layers_change_on_training(train: bool) -> None:

model.compile(loss="mse")
if train:
signal = librosa.chirp(32.70, TEST_SAMPLE_RATE, length=TEST_SAMPLE_RATE * 10, linear=True)
signal = librosa.chirp(fmin=32.70, fmax=TEST_SAMPLE_RATE, length=TEST_SAMPLE_RATE * 10, linear=True)
noise = np.random.rand(*signal.shape).astype(signal.dtype)

model.fit(np.array([signal, noise]), np.array([1, 0]), epochs=10, verbose=0)
Expand Down
Loading