def build_network(sess, compute_graph, net_config): """Build the MDRNN.""" empi_mdrnn.MODEL_DIR = "./models/" K.set_session(sess) with compute_graph.as_default(): net = empi_mdrnn.PredictiveMusicMDRNN(mode=empi_mdrnn.NET_MODE_RUN, dimension=net_config.dimension, n_hidden_units=net_config.units, n_mixtures=net_config.mixes, layers=net_config.layers) #net.pi_temp = net_config.pi_temp #net.sigma_temp = net_config.sigmatemp print("MDRNN Loaded.") return net
def build_network(sess): """Build the MDRNN.""" empi_mdrnn.MODEL_DIR = "./models/" K.set_session(sess) with compute_graph.as_default(): net = empi_mdrnn.PredictiveMusicMDRNN(mode=empi_mdrnn.NET_MODE_RUN, dimension=args.dimension, n_hidden_units=mdrnn_units, n_mixtures=mdrnn_mixes, layers=mdrnn_layers) net.pi_temp = args.pitemp net.sigma_temp = args.sigmatemp print("MDRNN Loaded:", net.model_name()) return net
# ## Load the Model compute_graph = tf.Graph() with compute_graph.as_default(): sess = tf.Session() # Hyperparameters units = 128 mixes = 5 layers = 2 empi_mdrnn.MODEL_DIR = "./models/" model_file = "./models/empi_mdrnn-layers2-units128-mixtures5-scale10-E84-VL-3.68.hdf5" # Instantiate Running Network K.set_session(sess) with compute_graph.as_default(): net = empi_mdrnn.PredictiveMusicMDRNN(mode=empi_mdrnn.NET_MODE_RUN, n_hidden_units=units, n_mixtures=mixes, layers=layers) net.load_model(model_file=model_file) net.pi_temp = 1.0 net.sigma_temp = 0.0 print("RNN Loaded.") rnn_output_buffer = queue.Queue() writing_queue = queue.Queue() # Touch storage for RNN. last_rnn_touch = empi_mdrnn.random_sample() # prepare previos sample. last_user_touch = empi_mdrnn.random_sample() last_user_interaction = time.time() CALL_RESPONSE_THRESHOLD = 2.0 call_response_mode = 'call' # Interaction Loop Parameters # All set to false before setting is chosen.