Как исправить исключение MultipleExtractedExamplesException при вызове music_vae.interpolate? - PullRequest
0 голосов
/ 20 декабря 2018

Я пытаюсь интерполировать 2 мелодии с пурпурными music_vae.Сначала я создаю мелодии:

teapot = music_pb2.NoteSequence()
teapot.notes.add(pitch=69, start_time=0, end_time=0.5, velocity=80)
teapot.notes.add(pitch=71, start_time=0.5, end_time=1, velocity=80)
teapot.notes.add(pitch=73, start_time=1, end_time=1.5, velocity=80)
teapot.notes.add(pitch=74, start_time=1.5, end_time=2, velocity=80)
teapot.notes.add(pitch=76, start_time=2, end_time=2.5, velocity=80)
teapot.notes.add(pitch=81, start_time=3, end_time=4, velocity=80)
teapot.notes.add(pitch=78, start_time=4, end_time=5, velocity=80)
teapot.notes.add(pitch=81, start_time=5, end_time=6, velocity=80)
teapot.notes.add(pitch=76, start_time=6, end_time=8, velocity=80)
teapot.total_time = 8
teapot.tempos.add(qpm=80)

melody = music_pb2.NoteSequence()
melody.notes.add(pitch=55, start_time=0, end_time=0.375, velocity=80)
melody.notes.add(pitch=62, start_time=0.375, end_time=0.75, velocity=80)
melody.notes.add(pitch=60, start_time=0.75, end_time=1.0, velocity=80)
melody.notes.add(pitch=59, start_time=1.0, end_time=1.375, velocity=80)
melody.notes.add(pitch=60, start_time=1.375, end_time=1.75, velocity=80)
melody.notes.add(pitch=62, start_time=1.75, end_time=2.0, velocity=80)
melody.notes.add(pitch=65, start_time=2.0, end_time=2.25, velocity=80)
melody.notes.add(pitch=64, start_time=2.25, end_time=2.75, velocity=80)
melody.notes.add(pitch=60, start_time=2.75, end_time=3.0, velocity=80)
melody.notes.add(pitch=62, start_time=3.0, end_time=3.5, velocity=80)
melody.notes.add(pitch=62, start_time=3.5, end_time=3.75, velocity=80)
melody.notes.add(pitch=64, start_time=3.75, end_time=4.0, velocity=80)
melody.notes.add(pitch=65, start_time=4.0, end_time=4.25, velocity=80)
melody.notes.add(pitch=64, start_time=4.25, end_time=4.75, velocity=80)
melody.notes.add(pitch=60, start_time=4.75, end_time=5.0, velocity=80)
melody.notes.add(pitch=65, start_time=5.0, end_time=5.25, velocity=80)
melody.notes.add(pitch=64, start_time=5.25, end_time=5.75, velocity=80)
melody.notes.add(pitch=60, start_time=5.75, end_time=6.0, velocity=80)
melody.notes.add(pitch=55, start_time=6.0, end_time=6.375, velocity=80)
melody.notes.add(pitch=57, start_time=6.375, end_time=6.75, velocity=80)
melody.notes.add(pitch=59, start_time=6.75, end_time=7.0, velocity=80)
melody.notes.add(pitch=60, start_time=7.0, end_time=7.375, velocity=80)
melody.notes.add(pitch=59, start_time=7.375, end_time=7.75, velocity=80)
melody.notes.add(pitch=57, start_time=7.75, end_time=8.0, velocity=80)
melody.total_time = 8
melody.tempos.add(qpm=80)

Затем я пытаюсь интерполировать:

note_sequences = music_vae.interpolate(
      teapot,
      melody,
      num_steps= 8,
  length=32, assert_same_length=False)

И получаю следующее исключение:

MultipleExtractedExamplesException: Multiple (2) examples extracted from NoteSequence: tempos {
  qpm: 80.0
}...

ВЗаписная книжка Hello Magenta (https://colab.research.google.com/notebooks/magenta/hello_magenta/hello_magenta.ipynb#scrollTo=71dgCmmBli-s),) есть 2 примера мелодий: чайник и twinkle_twinkle. Я могу интерполировать их без проблем. Но когда я пытаюсь интерполировать свою мелодию, мелодию чайника я получаю исключение.

...