ModelArguments.add_config_arguments#

ModelArguments.add_config_arguments(parser)[source]#

Add config argument to command-line parser and adds dataclass_parse_func.

Adds argument for reading parameters from a config and will automatically load the config file in the dataclass_parse_func. Will not work if class provided is not a subclass of config_base.BaseConfig.

Returns:

Argument parser with config_path argument added and a default function set as the ‘dataclass_parse_func’ parameter which will parse the argparse.Namespace and load the parameters from a config.

Return type:

argparse.ArgumentParser

Raises:

TypeError – If the model class isn’t a subclass of BaseConfig.

Parameters:

parser (ArgumentParser)