示例#1
0
def main(_):
    with open(FLAGS.config_file) as data_file:
        in_config = json.load(data_file)
    if FLAGS.mode == "train":
        utils.deco_print("Running in training mode")
        train_config = utils.configure_params(in_config, "train")
        if 'source_file_eval' in in_config and 'target_file_eval' in in_config:
            eval_config = utils.configure_params(in_config, "eval")
            train(train_config, eval_config)
        else:
            train(train_config, None)
    elif FLAGS.mode == "infer":
        config = utils.configure_params(in_config, "infer")
        utils.deco_print("Running in inference mode")
        infer(config)
    else:
        raise ValueError("Unknown mode in config file")
示例#2
0
def main(_):
    with open(FLAGS.config_file) as data_file:
        in_config = json.load(data_file)
        if FLAGS.lr is not None:
            in_config["learning_rate"] = FLAGS.lr
            utils.deco_print("using LR from command line: {}".format(FLAGS.lr))
    if FLAGS.mode == "train":
        utils.deco_print("Running in training mode")
        train_config = utils.configure_params(in_config, "train")
        if 'source_file_eval' in in_config and 'target_file_eval' in in_config:
            eval_config = utils.configure_params(in_config, "eval")
            train(train_config, eval_config)
        else:
            train(train_config, None)
    elif FLAGS.mode == "infer":
        config = utils.configure_params(in_config, "infer")
        utils.deco_print("Running in inference mode")
        infer(config)
    else:
        raise ValueError("Unknown mode in config file")
示例#3
0
def main(_):
  with open(FLAGS.config_file) as data_file:
    in_config = json.load(data_file)
    if FLAGS.lr is not None:
      in_config["learning_rate"] = FLAGS.lr
      utils.deco_print("using LR from command line: {}".format(FLAGS.lr))
    if 'num_gpus' in in_config:
      utils.deco_print("num_gpus parameters is ignored when using Horovod")
    if 'num_epochs' in in_config:
      utils.deco_print("num_epochs parameters is ignored when using Horovod. Instead use --max_steps")

  if FLAGS.mode == "train":
    utils.deco_print("Running in training mode")
    train_config = utils.configure_params(in_config, "train")
    if 'source_file_eval' in in_config and 'target_file_eval' in in_config:
      utils.deco_print("Eval is not supported when using Horovod")
    train(train_config)
  else:
    raise ValueError("Unknown mode in config file. For inference, do not use Horovod")