magenta/mt3

Error when transcribing audio in google colab

AnnaENS opened this issue · 3 comments


AttributeError Traceback (most recent call last)

in <cell line: 25>()
23 note_seq.play_sequence(est_ns, synth=note_seq.fluidsynth,
24 sample_rate=SAMPLE_RATE, sf2_path=SF2_PATH)
---> 25 note_seq.plot_sequence(est_ns)

2 frames

/usr/local/lib/python3.10/dist-packages/bokeh/core/has_props.py in _raise_attribute_error_with_matches(self, name, properties)
373 matches, text = sorted(properties), "possible"
374
--> 375 raise AttributeError(f"unexpected attribute {name!r} to {self.class.name}, {text} attributes are {nice_join(matches)}")
376
377 def str(self) -> str:

AttributeError: unexpected attribute 'plot_width' to figure, similar attributes are outer_width, width or min_width

I'm getting the same issue :(

Edit: Nevermind, did a little issue digging. Check out #144

After that fix, now getting a new issue unfortunately:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[<ipython-input-6-689ff6dbf16f>](https://localhost:8080/#) in <cell line: 25>()
     23 note_seq.play_sequence(est_ns, synth=note_seq.fluidsynth,
     24                        sample_rate=SAMPLE_RATE, sf2_path=SF2_PATH)
---> 25 note_seq.plot_sequence(est_ns)

2 frames
[/usr/local/lib/python3.10/dist-packages/bokeh/core/has_props.py](https://localhost:8080/#) in _raise_attribute_error_with_matches(self, name, properties)
    373             matches, text = sorted(properties), "possible"
    374 
--> 375         raise AttributeError(f"unexpected attribute {name!r} to {self.__class__.__name__}, {text} attributes are {nice_join(matches)}")
    376 
    377     def __str__(self) -> str:

AttributeError: unexpected attribute 'plot_width' to figure, similar attributes are outer_width, width or min_width

Which seems to be at least these 2 issues:

Originally posted by @0xdevalias in #151 (comment)

Running the error I got here through ChatGPT suggested the following:

The error you encountered, AttributeError: unexpected attribute 'plot_width' to figure, similar attributes are outer_width, width or min_width, suggests that there is an issue with the usage of the plot_width attribute in a Bokeh figure object.

Bokeh, a visualization library for Python, uses figure objects to create plots, and it seems like the code is trying to set an attribute plot_width which does not exist. Instead, Bokeh provides width, outer_width, or min_width as valid attributes.

Looking at the colab file:

The relevant snippet of code that's failing is:

import note_seq

# ..snip..

inference_model = InferenceModel(checkpoint_path, MODEL)

# ..snip..

est_ns = inference_model(audio)

# ..snip..

note_seq.plot_sequence(est_ns)

We can see the note_seq library here:

And here is a relevant sounding PR that may be related to this issue:

Which notes:

As described in this stackoverflow question:

In the 3.0.0 bokeh release, the plot_width attribute of a figure was replaced with width. Similarly, plot_height was replaced with height. Even in the last 2.x.x release docs, they are described as "compatibility aliases" for width and height.

This pull request fixes this issue by following the stackover flow answer mentioned above.

Originally posted by @Yao-Lirong in magenta/note-seq#72

Once that PR lands, it should fix the root cause, but until then, it sounds like the workaround is to use a pre-3.x version of Bokeh.

Searching the issues here, we can see that this was already suggested in another thread:

It worked, finally. I also downgraded bokeh so that midi image could come out normally.
https://colab.research.google.com/drive/1JkWyAwFhAC6SJJ1Lvf4VPap6FwtniEuy?usp=sharing

Originally posted by @Jackl-o-o-l in #134 (comment)

Originally posted by @0xdevalias in #144 (comment)

Fixed!