October 2018
Intermediate to advanced
472 pages
10h 57m
English
It's time for the real fun! Let's generate some instrumental music. We will use the code from the model setup and training, but instead of executing the training (as our model is already trained), we will insert the learned weights that we obtained in earlier training.
The following code block executes these two steps:
model = Sequential()model.add(LSTM( 512, input_shape=(network_input.shape[1], network_input.shape[2]), return_sequences=True))model.add(Dropout(0.5))model.add(LSTM(512, return_sequences=True))model.add(Dropout(0.3))model.add(LSTM(512))model.add(Dense(256))model.add(Dropout(0.3))model.add(Dense(n_vocab))model.add(Activation('softmax'))model.compile(loss='categorical_crossentropy', optimizer='adam')# Load the ...Read now
Unlock full access