Colab issue on using models - runtime error due to name conflict with built-in Keras model
See original GitHub issueHey there,
I was able to get Colab to install omnizart with the deprecated-legacy command mentioned in an earlier issue thread. However, I’m unable to run the chords, vocals and most other models without getting the error below
2021-11-26 13:30:18 Extracting feature 2021-11-26 13:30:24 Loading model 2021-11-26 13:30:24 Using built-in model /usr/local/lib/python3.7/dist-packages/omnizart/checkpoints/chord/chord_v1 for transcription. WARNING:tensorflow:SavedModel saved prior to TF 2.5 detected when loading Keras model. Please ensure that you are saving the model with model.save() or tf.keras.models.save_model(), NOT tf.saved_model.save(). To confirm, there should be a file named “keras_metadata.pb” in the SavedModel directory.
RuntimeError Traceback (most recent call last) <ipython-input-18-397ceb8cd640> in <module>() 34 }[model] 35 —> 36 midi = app.transcribe(f"{uploaded_audio}.wav", model_path=model_path) 37 38 # Synthesize MIDI and play
3 frames
/usr/local/lib/python3.7/dist-packages/keras/saving/saved_model/load.py in _revive_layer_or_model_from_config(self, metadata, node_id)
536 'your class with @keras.utils.register_keras_serializable
and ’
537 'include that file in your program, or pass your class in a ’
–> 538 ‘keras.utils.CustomObjectScope
that wraps this load call.’) from e
539 else:
540 raise
RuntimeError: Unable to restore object of class ‘MultiHeadAttention’ likely due to name conflict with built-in Keras class ‘<class ‘keras.layers.multi_head_attention.MultiHeadAttention’>’. To override the built-in Keras definition of the object, decorate your class with @keras.utils.register_keras_serializable
and include that file in your program, or pass your class in a keras.utils.CustomObjectScope
that wraps this load call.
This practically means that most of the model is broken, at least on my end. I’m only able to run the first two models. I’d really like to be able to use the other ones- any solutions?
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Hi, I had a similar issue with cuDNN and cuda setup error, and I resolved it by changing the runtime to TPU on colab
Hey again,
Your advice worked to fix that error message, but now I get this across all models:
UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above. [[node model_1/conv2d_1/Conv2D (defined at /usr/local/lib/python3.7/dist-packages/omnizart/music/prediction.py:183) ]] [Op:__inference_predict_function_135953]
Function call stack: predict_function
Thank you for your speedy responses by the way, I appreciate it