utils.config_parser.custom_arg_parser
Custom Arguments Parser
#
CustomArgParser ObjectsThis class is part of utils and is provided to load arguments from the provided YAML config file. Further, the default values of arguments from config file can be overridden via commandline or via the special argument --params provided for easy AML experimentation. The class instance takes in the parser object and optional log_level. This class needs to be instantiated in the main method inside the Marlin_Scenario code.
Example for instantiation::
The command line arguments to override default YAML config values are passed by adding a '.' between namespace and the specific argument as shown in example below. If no namespace is present, then just pass the argument name. All command line arguments are optional and need to be prefixed with '--'. All commandline arguments not present in YAML config file will be ignored with a warning message. Example commandline override::
python train.py --tmgr.epochs 4 --chkp.save_dir "tmp\checkpoints"
NOTE: Supported types for CustomArgParser are int, float, str, lists. null is inferred implicitly as str. If you intend to use other types, then please set a dummy default value in YAML file and pass the intended value from commandline. Suggested defaults::
To make it easy to use with AML pipelines, the parser treats --params as a special argument. The parser treats this as a str format of JSON serialized dictionary and parses this single argument to override the default values from YAML config file of all the arguments present in the dictionary. For example when user provides this str for --param::
The parser parses this and overrides the default values provided for test_str and test_false under test section in the YAML config file.
#
parseParse YAML config file, parse commandline arguments and merge the two to get the final merged config dictionary.
Find and return the path of the file with greatest number of completed epochs under dirpath (recursive search) for a given file prefix, and optionally file extension.
Arguments:
self
Returns:
self._config
Dict - merged config dictionary containing all arguments.