def add_subparser(self, name: str, parser: argparse._SubParsersAction) -> argparse.ArgumentParser:
# pylint: disable=protected-access
description = '''Run the specified model against a JSON-lines input file.'''
subparser = parser.add_parser(
name, description=description, help='Use a trained model to make predictions.')
subparser.add_argument('archive_file', type=str, help='the archived model to make predictions with')
subparser.add_argument('input_file', type=argparse.FileType('r'), help='path to input file')
subparser.add_argument('--output-file', type=argparse.FileType('w'), help='path to output file')
batch_size = subparser.add_mutually_exclusive_group(required=False)
batch_size.add_argument('--batch-size', type=int, default=1, help='The batch size to use for processing')
batch_size.add_argument('--batch_size', type=int, help=argparse.SUPPRESS)
subparser.add_argument('--silent', action='store_true', help='do not print output to stdout')
cuda_device = subparser.add_mutually_exclusive_group(required=False)
cuda_device.add_argument('--cuda-device', type=int, default=-1, help='id of GPU to use (if any)')
cuda_device.add_argument('--cuda_device', type=int, help=argparse.SUPPRESS)
subparser.add_argument('-o', '--overrides',
type=str,
default="",
help='a HOCON structure used to override the experiment configuration')
subparser.set_defaults(func=_predict(self.predictors))
return subparser
评论列表
文章目录