From 817ed0badd256fb834b653b1b08c2e71de1682b9 Mon Sep 17 00:00:00 2001 From: Manoj Plakal Date: Mon, 23 Sep 2024 14:07:12 -0400 Subject: [PATCH] Switched YAMNet to stick with Keras 2. TF 2.16 switched the default to Keras 3 which is backwards incompatible. --- research/audioset/yamnet/README.md | 4 +++- research/audioset/yamnet/yamnet.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/research/audioset/yamnet/README.md b/research/audioset/yamnet/README.md index 4f3caddfd0f..e57b84339d2 100644 --- a/research/audioset/yamnet/README.md +++ b/research/audioset/yamnet/README.md @@ -15,11 +15,13 @@ YAMNet depends on the following Python packages: * [`numpy`](http://www.numpy.org/) * [`resampy`](http://resampy.readthedocs.io/en/latest/) * [`tensorflow`](http://www.tensorflow.org/) +* [`tf_keras`](https://github.com/keras-team/tf-keras) * [`pysoundfile`](https://pysoundfile.readthedocs.io/) These are all easily installable via, e.g., `pip install numpy` (as in the example command sequence below). Any reasonably recent version of these -packages should work. +packages should work. Note that YAMNet currently relies on Keras 2 and is +incompatible with Keras 3 (the default as of TF 2.16). YAMNet also requires downloading the following data file: diff --git a/research/audioset/yamnet/yamnet.py b/research/audioset/yamnet/yamnet.py index cac7f87d99e..06a246b043b 100644 --- a/research/audioset/yamnet/yamnet.py +++ b/research/audioset/yamnet/yamnet.py @@ -19,7 +19,7 @@ import numpy as np import tensorflow as tf -from tensorflow.keras import Model, layers +from tf_keras import Model, layers import features as features_lib