asigalov61 / Amazing-GPT2-Piano

OpenAI's GPT2 based Music AI Google Colab Notebooks for Music Generation/Composition and Capabilities Evaluation
https://openai.com/blog/musenet/
43 stars 9 forks source link

Can't save or play generated sequence #1

Closed asigalov61 closed 4 years ago

asigalov61 commented 4 years ago

Here is the error:

If someone can help, I will be grateful. Thank you.

Last line of code (lol)

midi.write_midifile("output.mid", pattern)

Produces:

AssertionError Traceback (most recent call last)

in () ----> 1 midi.write_midifile("output.mid", pattern) 4 frames /usr/local/lib/python3.6/dist-packages/midi/fileio.py in write_midifile(midifile, pattern) 167 if type(midifile) in (str, str): 168 with open(midifile, 'wb') as out: --> 169 return write_midifile(out,pattern) 170 writer = FileWriter(midifile) 171 return writer.write(pattern) /usr/local/lib/python3.6/dist-packages/midi/fileio.py in write_midifile(midifile, pattern) 169 return write_midifile(out,pattern) 170 writer = FileWriter(midifile) --> 171 return writer.write(pattern) 172 173 def read_midifile(midifile): /usr/local/lib/python3.6/dist-packages/midi/fileio.py in write(self, pattern) 103 self.write_file_header(pattern,len(pattern)) 104 for track in pattern: --> 105 self.write_track(track) 106 107 def write_file_header(self, pattern, length=None): /usr/local/lib/python3.6/dist-packages/midi/fileio.py in write_track(self, track) 120 buf = bytearray(b'0'*hlen) 121 for event in track: --> 122 buf.extend(self.encode_midi_event(event)) 123 buf[:hlen] = self.encode_track_header(len(buf)-hlen) 124 self.file.write(buf) /usr/local/lib/python3.6/dist-packages/midi/fileio.py in encode_midi_event(self, event) 139 ret = bytearray() 140 #assert hasattr(event,'tick'), event --> 141 assert isinstance(event.tick,int), event.tick 142 ret.extend(write_varlen(event.tick)) 143 # is the event a MetaEvent? AssertionError: 20
asigalov61 commented 4 years ago

Resolved by installing latest and greatest dependencies. --update on all did the trick. And I've also added a few. Thank you, Alex!

ravi-annaswamy commented 4 years ago

great!

asigalov61 commented 4 years ago

Thanks :)))

On Tue, Aug 4, 2020 at 8:34 AM Ravi Annaswamy notifications@github.com wrote:

great!

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/asigalov61/Amazing-GPT2-Piano/issues/1#issuecomment-668668214, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANNXLIYZDAK4N3B7J4GX7ELR7ATBLANCNFSM4PUDCA3A .