calclavia / DeepJ

A deep learning model for style-specific music generation.

Home Page:https://arxiv.org/abs/1801.00887

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to load model from file.

KDcx35 opened this issue · comments

Hi, when i use the python generate.py command, it always said 'Unable to load model from file.', but the provided model is there and the file path is right, so why it can't load?
Also, although it can't load model, but it can generate one or two midi file and then begins to throw error.
The error message is like this:

Writing file out\samples\output_0.mid
Traceback (most recent call last):
File "generate.py", line 153, in
main()
File "generate.py", line 150, in main
write_file('output', generate(models, args.bars, styles))
File "generate.py", line 134, in write_file
midi.write_midifile(fpath, mf)
File "D:\anaconda\anaconda\lib\site-packages\midi-0.2.3-py3.7.egg\midi\fileio.py", line 162, in write_midifile
File "D:\anaconda\anaconda\lib\site-packages\midi-0.2. write_file('output', generate(models, args.bars, sty
les))
File "generate.py", line 134, in write_file
midi.write_midifile(fpath, mf)
File "D:\anaconda\anaconda\lib\site-packages\midi-0.2.
3-py3.7.egg\midi\fileio.py", line 162, in write_midifile
File "D:\anaconda\anaconda\lib\site-packages\midi-0.2.
3-py3.7.egg\midi\fileio.py", line 110, in write
File "D:\anaconda\anaconda\lib\site-packages\midi-0.2.
3-py3.7.egg\midi\fileio.py", line 124, in write_track
File "D:\anaconda\anaconda\lib\site-packages\midi-0.2.
3-py3.7.egg\midi\fileio.py", line 152, in encode_midi_ev
ent
ValueError: byte must be in range(0, 256)

Other people have the same error, but seems no one knows how to solves this.
so my question is:
1.how can i load model correctly?
2.if i haven't load the model, then why it can generate some midi results?How does it being generated?
3.how can i fix this ValueError?
Thank you!

same problem

The program is looking for the file at "out/model.h5" (see bottom of constants.py), but the pre-trained model is stored at "archives/v1/model.h5." Maybe that's your problem?