Ghadjeres / DeepBach

code accompanying "DeepBach: a Steerable Model for Bach Chorales Generation" paper
MIT License
500 stars 131 forks source link

Trying to create "HelloWorld" script for DeepBach #19

Closed danholle closed 5 years ago

danholle commented 7 years ago

I'm trying to get DeepBach to minimally work on Ubuntu... sort of like "Hello World" for DeepBach. When I did, I got a score which sounds random... cacophonous, inharmonious, no sense of melody.

I suspect I'm misunderstanding something fundamental... if you could point me in the right direction, I would be most grateful.

Here is what I did on my Ubuntu 16.04 system with Python 3.5.2.

Get musescore sudo add-apt-repository ppa:mscore-ubuntu/mscore-stable sudo apt-get update sudo apt-get install musescore

get Python tools sudo apt-get install python-pip python-dev sudo apt-get install python3-pip pip3 install --upgrade pip

get DeepBach git clone https://github.com/Ghadjeres/DeepBach cd DeepBach

Install prerequisites.
h5py is required too; I specified the most recent one. Note tensorflow 1.x does not work with keras 1.2 so I used TF 0.12.
echo "tensorflow==0.12.0" >> requirements.txt echo "h5py==2.7.0" >> requirements.txt sudo pip3 install -r requirements.txt

Fix a glitch: deepBach writes to this dir but dies if it's not already there mkdir models

Tell music21 about MuseScore python3

import music21 us=music21.environment.UserSettings() us['musicxmlPath']='/usr/bin/musescore' exit()

Now run the first example from README python3 deepBach.py -l 100

And voila, after a long time it comes back in MuseScore, with some "music"! But it's rapid, chaotic, random stuff. Should it be? How could I fix it?

Thanks

--- Dan

PS I could zip up the MuseScore (.mscz) file and attach it here, if that would help.

Ghadjeres commented 7 years ago

Thank you for your detailed question. It seems that your deepbach model is not trained, and thus produces random notes. There is a link on the main page where you can download a pretrained model. However these models work with the old keras version, I hope it will work on your computer.

I will soon update my code and the models to comply with the Keras 2.0 interface.

In the meantime, if none of the options above work, you can train your own model with

python3 deepbach.py -t num_of_epochs