def add_subparser(self, name: str, parser: argparse._SubParsersAction) -> argparse.ArgumentParser:
# pylint: disable=protected-access
description = '''Train the specified model on the specified dataset.'''
subparser = parser.add_parser(
name, description=description, help='Train a model')
subparser.add_argument('param_path',
type=str,
help='path to parameter file describing the model to be trained')
# This is necessary to preserve backward compatibility
serialization = subparser.add_mutually_exclusive_group(required=True)
serialization.add_argument('-s', '--serialization-dir',
type=str,
help='directory in which to save the model and its logs')
serialization.add_argument('--serialization_dir',
type=str,
help=argparse.SUPPRESS)
subparser.set_defaults(func=train_model_from_args)
return subparser
评论列表
文章目录