def main(): print 'Generating the training model...' training_model = get_training_model() print 'Compiling the training model...' optimizer = Adadelta(lr=0.01, epsilon=1e-6) training_model.compile(loss=objective, optimizer=optimizer, metrics=['accuracy']) print 'Retrieving the repository...' pieces = repository_handler.load_repository(args.repository) print 'Learning...' train(training_model, pieces) print 'Retrieving the weights...' weights = training_model.get_weights() print 'Generating the composition model...' composition_model = get_composition_model() print 'Compiling the composition model...' composition_model.compile(loss=objective, optimizer=optimizer) print 'Setting the weights...' composition_model.set_weights(weights) print 'Composing a piece...' random_batch, _ = piece_handler.get_piece_batch(pieces, 5) initial_note = random_batch[0][0].reshape((1, 78, 80)) piece = compose_piece(composition_model, initial_note) piece_handler.save_piece(piece, args.piece)
def main(): print 'Retrieving the repository...' pieces = repository_handler.load_repository(args.repository) _, data = piece_handler.get_piece_batch(pieces, args.batch_size) print 'Generating Probability Matrix..' probability_matrix = get_probability_matrix(data) print 'Making Sweet Jams...' segment = generate_music(data[0, 0], probability_matrix, args.segment_length) print 'Saving Sweet Jams...' piece_handler.save_piece(segment, args.file_path)
def main(): print 'Generating the composition model...' composition_model = deep_jammer.get_composition_model() print 'Compiling the composition model...' optimizer = Adam(lr=1) composition_model.compile(loss=objective, optimizer=optimizer, metrics=['accuracy']) print 'Loading the weights...' composition_model.load_weights('checkpoints/model-weights-40.h5') print 'Generating the initial note of the piece...' repository = repository_handler.load_repository('1-repository') X_train, _ = piece_handler.get_piece_batch(repository, 5) initial_note = X_train[0][0].reshape((1, 78, 80)) print 'Generating a piece...' piece = compose_piece(composition_model, initial_note) piece_handler.save_piece(piece, 'checkpoint-piece')
def save_generated_piece(generated_piece, tag): generated_piece_path = generated_dir + generated_piece_name % tag piece_handler.save_piece(generated_piece, generated_piece_path)
def save_generated_piece(generated_piece, tag): generated_piece_path = GENERATED_PIECES_DIRECTORY + GENERATED_PIECE_NAME % tag piece_handler.save_piece(generated_piece, generated_piece_path)