def setup_args(): """Setup arguments.""" parser = argparse.ArgumentParser() DialogReader.add_cmdline_args(parser) parser.add_argument("--input_file", type=str, required=True) parser.add_argument("--output_file", type=str, required=True) args = parse_args(parser) return args
def setup_args(): """Setup arguments.""" parser = argparse.ArgumentParser() EntAugNSPReader.add_cmdline_args(parser) parser.add_argument("--use_role", type=str2bool, default=False, help="Whether use role embeddings.") parser.add_argument("--input_file", type=str, required=True) parser.add_argument("--output_file", type=str, required=True) args = parse_args(parser) return args
def add_cmdline_args(parser): """Add cmdline argument of Task.""" group = parser.add_argument_group("Task") group.add_argument("--task", type=str, required=True, help="The task type.") args = parse_args(parser, allow_unknown=True) if args.task not in TASK_REGISTRY: raise ValueError(f"Unknown task type: {args.task}") TASK_REGISTRY[args.task].add_cmdline_args(parser) return group
def setup_args(): """Setup arguments.""" parser = argparse.ArgumentParser() parser.add_argument("--tokenizer", type=str, default="SentencePieceTokenizer") args, _ = parser.parse_known_args() tokenizer_cls = getattr(tokenization, args.tokenizer) tokenizer_cls.add_cmdline_args(parser) parser.add_argument("--input_file", type=str, required=True) parser.add_argument("--output_file", type=str, required=True) args = parse_args(parser) return args
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
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
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
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
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
def add_cmdline_args(parser): """ Add cmdline argument of Model. """ group = parser.add_argument_group("Model") # Model group.add_argument("--model", type=str, required=True, help="The model type.") # Config group.add_argument("--config_path", type=str, required=True, help="The path of model configuration.") # Model related. args = parse_args(parser, allow_unknown=True) if args.model not in MODEL_REGISTRY: raise ValueError(f"Unknown model type: {args.model}") MODEL_REGISTRY[args.model].add_cmdline_args(parser) return group
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
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