question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Colab issue on using models - runtime error due to name conflict with built-in Keras model

See original GitHub issue

Hey 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:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
skgoh95commented, Nov 30, 2021

Hi, I had a similar issue with cuDNN and cuda setup error, and I resolved it by changing the runtime to TPU on colab

1reaction
mongrelitecommented, Nov 29, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

issue with loading a model in Keras in Colab - Stack Overflow
Consider renaming <class 'keras.layers.recurrent.LSTMCell'> to avoid naming conflicts when loading with `tf.keras.models.load_model`. If ...
Read more >
Weight name conflicts when keras model consists of ... - GitHub
Weight name duplication issues when using subclassed keras layer with many ops. For instance, a custom layer with 1Conv+1Dense.
Read more >
Serialization and saving - Keras
Description: Complete guide to saving & serializing models. View in Colab • GitHub source. Introduction. A Keras model consists of multiple ...
Read more >
Use TPUs | TensorFlow Core
This guide demonstrates how to perform basic training on Tensor Processing Units (TPUs) and TPU Pods, a collection of TPU devices connected by...
Read more >
How to Setup Your Python Environment for Machine Learning ...
I have installed theano and tensorflow, while the errors pop out when installing keras. C:\Users\stevenwsy>pip install keras. Collecting keras
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found