You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A clear and concise description of what you expected to happen.
The code should return a YAMNet model.
5. Additional context
Include any logs that would be helpful to diagnose the problem.
The following is the error message.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/henry/models/research/audioset/yamnet/yamnet.py", line 121, in yamnet_frames_model
waveform_padded = features_lib.pad_waveform(waveform, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/henry/models/research/audioset/yamnet/features.py", line 91, in pad_waveform
num_samples = tf.shape(waveform)[0]
^^^^^^^^^^^^^^^^^^
File "/home/henry/env_yamnet/lib/python3.11/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/home/henry/env_yamnet/lib/python3.11/site-packages/keras/src/backend/common/keras_tensor.py", line 91, in __tf_tensor__
raise ValueError(
ValueError: A KerasTensor cannot be used as input to a TensorFlow function. A KerasTensor is a symbolic placeholder for a shape and dtype, used when constructing Keras Functional models or Keras Functions. You can only use it as input to a Keras layer or a Keras operation (from the namespaces `keras.layers` and `keras.operations`). You are likely doing something like:
x = Input(...)
...
tf_fn(x) # Invalid.
What you should do instead is wrap `tf_fn` in a layer:
class MyLayer(Layer):
def call(self, x):
return tf_fn(x)
x = MyLayer()(x)
6. System information
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Debian 12 on WSL2
TensorFlow installed from (source or binary): binary
TensorFlow version (use command below): 2.16.1
Python version: 3.11.2
The text was updated successfully, but these errors were encountered:
TF 2.16.0 included an upgrade to Keras 3 by default, which includes many breaking changes. I've confirmed that our code still works if we stick with Keras 2 (which requires also installing tf_keras). I'll send a PR to switch us to Keras 2.
Prerequisites
Please answer the following questions for yourself before submitting an issue.
1. The entire URL of the file you are using
https://github.com/tensorflow/models/blob/8da4857396fcedb1abd19a08cd4de40d16c7bc50/research/audioset/yamnet/yamnet.py
https://github.com/tensorflow/models/blob/8da4857396fcedb1abd19a08cd4de40d16c7bc50/research/audioset/yamnet/params.py
2. Describe the bug
@plakal @dpwe
Cannot initialise YAMNet using TF 2.16.1.
3. Steps to reproduce
Steps to reproduce the behavior.
4. Expected behavior
A clear and concise description of what you expected to happen.
The code should return a YAMNet model.
5. Additional context
Include any logs that would be helpful to diagnose the problem.
The following is the error message.
6. System information
The text was updated successfully, but these errors were encountered: