ModelArguments.add_subcommands#

ModelArguments.add_subcommands(subparsers, name, add_arguments=True, add_config=True, **kwargs)[source]#

Add sub-commands for CLI arguments and config (if possible).

Note: config sub-command won’t be added if model provided to class isn’t a subclass of BaseConfig.

Parameters:
  • subparsers (argparse._SubParsersAction[ArgumentParser]) – Subparser to add new sub-commands to, created using argparser.ArgumentParser().add_subparsers().

  • name (str) – Name of the sub-command to add, if config sub-command is added it will be called ‘{name}-config’.

  • add_arguments (bool) – If True (default) adds sub-command called ‘{name}’ with arguments.

  • add_config (bool) – If True (default), and model given is a BaseConfig, adds sub-command called ‘{name}-config’ with a single config path argument.

  • kwargs – Keyword arguments to pass to subparsers.add_parser.