danieldjohnson / biaxial-rnn-music-composition

A recurrent neural network designed to generate classical music.
BSD 2-Clause "Simplified" License
1.91k stars 380 forks source link

How to load weights? #28

Closed MaksSieve closed 7 years ago

MaksSieve commented 7 years ago

How may I load already trained weights to the model?

danieldjohnson commented 7 years ago

To load them, you can do something like this:

>>> import model
>>> import main
>>> import multi_training
>>> import cPickle as pickle
>>> pcs = multi_training.loadPieces("music")
>>> m = model.Model([300,300],[100,50], dropout=0.5)
>>> m.learned_config = pickle.load(open( "output/final_learned_config.p", "rb" ) )
>>> main.gen_adaptive(m,pcs,10,name="composition")

where you replace "output/final_learned_config.p" with the location of the weights.