BShakhovsky/PolyphonicPianoTranscription

cannot import name 'sequence_to_valued_intervals' from 'magenta.models.onsets_frames_transcription.metrics'

Closed this issue · 2 comments

Hello

Thank you these notebooks of onsets_and_frames model.

Previously, file 2 Training, Validation, Testing.ipynb that use magenta 2.1.3 is work but now in magenta 2.1.4 isn't work.

I try to run your code but found a problem that run on google colab.

ImportError: cannot import name 'sequence_to_valued_intervals' from 'magenta.models.onsets_frames_transcription.metrics' (/usr/local/lib/python3.7/dist-packages/magenta/models/onsets_frames_transcription/metrics.py)

I would like to ask you how to fix.
Thank you so much.

1
2

Hello,

It seems that sequence_to_valued_intervals function has been moved to note_seq library, and here is that Magenta’s commit:
magenta/magenta#1880

So, the following line:
from magenta.models.onsets_frames_transcription.metrics import sequence_to_valued_intervals
should be changed to the following:
from note_seq.sequences_lib import sequence_to_valued_intervals

Thank you very much