Esempio n. 1
0
def setup_args():
    """Setup saving arguments."""
    parser = argparse.ArgumentParser()

    models.add_cmdline_args(parser)
    tasks.add_cmdline_args(parser)

    parser.add_argument("--inference_model_path", type=str, required=True)

    args = parse_args(parser)
    args.load(args.config_path, "Model")
    args.run_infer = True # only build infer program
    args.display()
    return args
Esempio n. 2
0
def setup_args():
    """Setup arguments."""
    parser = argparse.ArgumentParser()
    parser.add_argument("--is_distributed", type=str2bool, default=False)
    parser.add_argument("--port", type=int, default=18123)

    models.add_cmdline_args(parser)
    DialogGeneration.add_cmdline_args(parser)

    args = parse_args(parser)
    args.load(args.config_path, "Model")
    args.run_infer = True  # only build infer program
    args.display()
    return args
Esempio n. 3
0
def setup_args():
    """Setup inference arguments."""
    parser = argparse.ArgumentParser()
    parser.add_argument("--is_distributed", type=str2bool, default=False)
    parser.add_argument("--save_path", type=str, default="output")
    parser.add_argument("--infer_file", type=str, required=True)
    parser.add_argument("--output_name", type=str, required=True)
    parser.add_argument("--log_steps", type=int, default=1)

    models.add_cmdline_args(parser)
    tasks.add_cmdline_args(parser)

    args = parse_args(parser)
    args.load(args.config_path, "Model")
    args.run_infer = True  # only build infer program
    args.display()
    return args
Esempio n. 4
0
def setup_args():
    """Setup arguments."""
    parser = argparse.ArgumentParser(
        description="Main inference program for dialogue state tracking.")
    parser.add_argument("--infer_file", type=str, required=True)
    parser.add_argument("--save_path", type=str, required=True)
    parser.add_argument("--dataset",
                        type=str,
                        default="multiwoz",
                        choices=["multiwoz", "woz"])
    parser.add_argument("--dial_batch_size", type=int, default=32)

    models.add_cmdline_args(parser)
    tasks.add_cmdline_args(parser)

    args = parse_args(parser)
    args.load(args.config_path, "Model")
    args.run_infer = True  # only build infer program
    args.display()
    return args
Esempio n. 5
0
def setup_args():
    """Setup evaluation arguments."""
    parser = argparse.ArgumentParser()
    parser.add_argument("--is_distributed", type=str2bool, default=False,
                        help="Whether to run distributed evaluation.")
    parser.add_argument("--save_path", type=str, default="output",
                        help="The path where to save temporary files.")
    parser.add_argument("--eval_file", type=str, required=True,
                        help="The evaluation dataset: file / filelist. "
                        "See more details in `docs/usage.md`: `file_format`.")

    parser.add_argument("--log_steps", type=int, default=100,
                        help="Display evaluation log information every X steps.")

    models.add_cmdline_args(parser)
    tasks.add_cmdline_args(parser)

    args = parse_args(parser)
    args.load(args.config_path, "Model")
    args.display()
    return args
Esempio n. 6
0
def setup_args():
    """Setup arguments."""
    parser = argparse.ArgumentParser(
        description="Main dynamic inference program.")
    parser.add_argument("--infer_file", type=str, required=True)
    parser.add_argument("--save_path", type=str, default="output")
    parser.add_argument("--db_file", type=str, required=True)
    parser.add_argument("--session_to_sample_mapping_file",
                        type=str,
                        required=True)
    parser.add_argument("--dial_batch_size", type=int, default=8)
    parser.add_argument("--normalization", type=str2bool, default=True)
    parser.add_argument("--db_guidance", type=str2bool, default=True)

    models.add_cmdline_args(parser)
    DialogGeneration.add_cmdline_args(parser)

    args = parse_args(parser)
    args.load(args.config_path, "Model")
    args.run_infer = True  # only build infer program
    args.display()
    return args
Esempio n. 7
0
def setup_args():
    """Setup training arguments."""
    parser = argparse.ArgumentParser()
    parser.add_argument("--is_distributed", type=str2bool, default=False,
                        help="Whether to run distributed training.")
    parser.add_argument("--save_path", type=str, default="output",
                        help="The path where to save models.")
    parser.add_argument("--train_file", type=str, required=True,
                        help="The training dataset: file / filelist. "
                        "See more details in `docs/usage.md`: `file_format`.")
    parser.add_argument("--valid_file", type=str, required=True,
                        help="The validation datasets: files / filelists. "
                        "The files / filelists are separated by `,`. "
                        "See more details in `docs/usage.md`: `file_format`.")

    parser.add_argument("--start_step", type=int, default=0,
                        help="The start step of training. It will be updated if you load from a checkpoint.")
    parser.add_argument("--num_epochs", type=int, default=20,
                        help="The number of times that the learning algorithm will work through the entire training dataset.")
    parser.add_argument("--log_steps", type=int, default=100,
                        help="Display training / evaluation log information every X steps.")
    parser.add_argument("--validation_steps", type=int, default=1000,
                        help="Run validation every X training steps.")
    parser.add_argument("--save_steps", type=int, default=0,
                        help="Save the lastest model every X training steps. "
                        "If `save_steps = 0`, then it only keep the lastest checkpoint.")
    parser.add_argument("--eval_metric", type=str, default="-loss",
                        help="Keep the checkpoint with best evaluation metric.")
    parser.add_argument("--save_checkpoint", type=str2bool, default=True,
                        help="Save completed checkpoint or parameters only. "
                        "The checkpoint contains all states for continuous training.")

    models.add_cmdline_args(parser)
    tasks.add_cmdline_args(parser)

    args = parse_args(parser)
    args.load(args.config_path, "Model")
    args.display()
    return args