aiexperiments-ai-duet/server/magenta/models/basic_rnn/basic_rnn_train.py
2016-11-17 07:33:16 +03:00

53 lines
1.6 KiB
Python

# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
r"""Train and evaluate the basic RNN model.
Example usage:
$ bazel build magenta/models/basic_rnn:basic_rnn_train
$ ./bazel-bin/magenta/models/basic_rnn/basic_rnn_train \
--run_dir=/tmp/basic_rnn/logdir/run1 \
--sequence_example_file=/tmp/basic_rnn/training_melodies.tfrecord \
--num_training_steps=20000
$ ./bazel-bin/magenta/models/basic_rnn/basic_rnn_train \
--run_dir=/tmp/basic_rnn/logdir/run1 \
--sequence_example_file=/tmp/basic_rnn/eval_melodies.tfrecord \
--num_training_steps=20000
--eval
$ tensorboard --logdir=/tmp/basic_rnn/logdir
See /magenta/models/shared/melody_rnn_train.py for flag descriptions.
"""
# internal imports
import basic_rnn_encoder_decoder
import basic_rnn_graph
import tensorflow as tf
from magenta.models.shared import melody_rnn_train
def main(unused_argv):
melody_encoder_decoder = basic_rnn_encoder_decoder.MelodyEncoderDecoder()
melody_rnn_train.run(melody_encoder_decoder, basic_rnn_graph.build_graph)
def console_entry_point():
tf.app.run(main)
if __name__ == '__main__':
console_entry_point()