Music-and-Culture-Technology-Lab / omnizart

Omniscient Mozart, being able to transcribe everything in the music, including vocal, drum, chord, beat, instruments, and more.
https://music-and-culture-technology-lab.github.io/omnizart-doc/
MIT License
1.62k stars 98 forks source link

Colab OpError: /content/omnizart/omnizart/checkpoints/vocal/vocal_semi/variables/variables.data-00000-of-00001; No such file or directory #83

Closed R-N closed 1 year ago

R-N commented 1 year ago

Output and stack trace:

2022-11-24 14:03:24 Separating vocal track from the audio...
INFO:Vocal Transcription:Separating vocal track from the audio...
2022-11-24 14:03:56 Loading model...
INFO:Vocal Transcription:Loading model...
2022-11-24 14:03:56 Using built-in model /content/omnizart/omnizart/checkpoints/vocal/vocal_semi for transcription.
INFO:Base Class:Using built-in model /content/omnizart/omnizart/checkpoints/vocal/vocal_semi 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)
[/usr/local/lib/python3.7/dist-packages/tensorflow/python/training/py_checkpoint_reader.py](https://localhost:8080/#) in get_tensor(self, tensor_str)
     69     return CheckpointReader.CheckpointReader_GetTensor(
---> 70         self, compat.as_bytes(tensor_str))
     71   # TODO(b/143319754): Remove the RuntimeError casting logic once we resolve the

RuntimeError: /content/omnizart/omnizart/checkpoints/vocal/vocal_semi/variables/variables.data-00000-of-00001; No such file or directory

During handling of the above exception, another exception occurred:

OpError                                   Traceback (most recent call last)
11 frames
[<ipython-input-3-34236953df67>](https://localhost:8080/#) in <module>
     34 }[model]
     35 
---> 36 midi = app.transcribe(f"{uploaded_audio}.wav", model_path=model_path)
     37 
     38 # Synthesize MIDI and play

[/content/omnizart/omnizart/vocal/app.py](https://localhost:8080/#) in transcribe(self, input_audio, model_path, output)
     98 
     99         logger.info("Loading model...")
--> 100         model, model_settings = self._load_model(model_path)
    101 
    102         logger.info("Extracting feature...")

[/content/omnizart/omnizart/base.py](https://localhost:8080/#) in _load_model(self, model_path, custom_objects)
     62 
     63         try:
---> 64             model = tf.keras.models.load_model(model_path, custom_objects=custom_objects)
     65         except (OSError):
     66             raise FileNotFoundError(

[/usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/saving/save.py](https://localhost:8080/#) in load_model(filepath, custom_objects, compile, options)
    204         filepath = path_to_string(filepath)
    205         if isinstance(filepath, str):
--> 206           return saved_model_load.load(filepath, compile, options)
    207 
    208   raise IOError(

[/usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/saving/saved_model/load.py](https://localhost:8080/#) in load(path, compile, options)
    150   for node_id, loaded_node in keras_loader.loaded_nodes.items():
    151     nodes_to_load[keras_loader.get_path(node_id)] = loaded_node
--> 152   loaded = tf_load.load_partial(path, nodes_to_load, options=options)
    153 
    154   # Finalize the loaded layers and remove the extra tracked dependencies.

[/usr/local/lib/python3.7/dist-packages/tensorflow/python/saved_model/load.py](https://localhost:8080/#) in load_partial(export_dir, filters, tags, options)
    773     A dictionary mapping node paths from the filter to loaded objects.
    774   """
--> 775   return load_internal(export_dir, tags, options, filters=filters)
    776 
    777 

[/usr/local/lib/python3.7/dist-packages/tensorflow/python/saved_model/load.py](https://localhost:8080/#) in load_internal(export_dir, tags, options, loader_cls, filters)
    904       try:
    905         loader = loader_cls(object_graph_proto, saved_model_proto, export_dir,
--> 906                             ckpt_options, filters)
    907       except errors.NotFoundError as err:
    908         raise FileNotFoundError(

[/usr/local/lib/python3.7/dist-packages/tensorflow/python/saved_model/load.py](https://localhost:8080/#) in __init__(self, object_graph_proto, saved_model_proto, export_dir, ckpt_options, filters)
    161 
    162     self._load_all()
--> 163     self._restore_checkpoint()
    164 
    165     for node in self._nodes:

[/usr/local/lib/python3.7/dist-packages/tensorflow/python/saved_model/load.py](https://localhost:8080/#) in _restore_checkpoint(self)
    487                                   self._checkpoint_options).expect_partial()
    488     else:
--> 489       load_status = saver.restore(variables_path, self._checkpoint_options)
    490     load_status.assert_existing_objects_matched()
    491     checkpoint = load_status._checkpoint

[/usr/local/lib/python3.7/dist-packages/tensorflow/python/training/tracking/util.py](https://localhost:8080/#) in restore(self, save_path, options)
   1299       dtype_map = reader.get_variable_to_dtype_map()
   1300     try:
-> 1301       object_graph_string = reader.get_tensor(base.OBJECT_GRAPH_PROTO_KEY)
   1302     except errors_impl.NotFoundError:
   1303       # The object graph proto does not exist in this checkpoint. Try the

[/usr/local/lib/python3.7/dist-packages/tensorflow/python/training/py_checkpoint_reader.py](https://localhost:8080/#) in get_tensor(self, tensor_str)
     72   # issue with throwing python exceptions from C++.
     73   except RuntimeError as e:
---> 74     error_translator(e)
     75 
     76 

[/usr/local/lib/python3.7/dist-packages/tensorflow/python/training/py_checkpoint_reader.py](https://localhost:8080/#) in error_translator(e)
     46     raise errors_impl.InternalError(None, None, error_message)
     47   else:
---> 48     raise errors_impl.OpError(None, None, error_message, errors_impl.UNKNOWN)
     49 
     50 

OpError: /content/omnizart/omnizart/checkpoints/vocal/vocal_semi/variables/variables.data-00000-of-00001; No such file or directory
BreezeWhite commented 1 year ago

This seems like some of the checkpoints were not downloaded properly. Try close the session and setup the colab again.

lekoOwO commented 1 year ago

Same issue

lekoOwO commented 1 year ago

The problem is that !omnizart download-checkpoints saves the file inside /usr/local/lib/python3.8/dist-packages/omnizart/checkpoints instead of /content/omnizart/omnizart/checkpoints

BreezeWhite commented 1 year ago

Fixed in #85.