from tensorflow.python.client import device_lib

    else:
        raise ValueError('Invalid model: {}'.format(FLAGS.model))
    if FLAGS.rnn_mode:
        config.rnn_mode = FLAGS.rnn_mode
    if FLAGS.num_gpus != 1 or tf.__version__ < '1.3.0':
        config.rnn_mode = BASIC
    return config


def main(_):
    if not FLAGS.data_path:
        raise ValueError('data_path must be set')
    gpus = [
        x.name for x in device_lib.list_local_devices() if x.device_type == 'GPU'
    ]

    if FLAGS.num_gpus > len(gpus):
        raise ValueError('Invalid num_gpus')

    raw_data = reader.ptb_raw_data(FLAGS.data_path)
    train_data, valid_data, test_data, _ = raw_data

    config = get_config()
    eval_config = get_config()
    eval_config.batch_size = 1
    eval_config.num_steps = 1
