Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when running the "Transcribe Audio" stage #144

Closed
mio-19 opened this issue Dec 18, 2023 · 3 comments
Closed

error when running the "Transcribe Audio" stage #144

mio-19 opened this issue Dec 18, 2023 · 3 comments

Comments

@mio-19
Copy link

mio-19 commented Dec 18, 2023

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[<ipython-input-5-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
@jackbullen
Copy link

I got the same issue and it is from the note_seq.plot_sequence function call. Likely because of a version incompatibility with bokeh library.

Despite this, est_ns = inference_model(audio) successfully completes, so you can get the midi file with note_seq.sequence_proto_to_midi_file(est_ns, "path_to_output_midi")

@0xdevalias
Copy link

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)

@iansimon
Copy link
Contributor

Should be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants