exarl.utils.candleDriver
Module Contents
Classes
Class that implements an interface to handle configuration options for the |
Functions
|
Resolve path to configuration files. |
|
Attempts to lookup arg from the global run_params. |
|
The base_parser is needed to intercept command line overwrites of the |
|
Custom parser to read a json file and return the list of included keywords. |
Build the full set of run parameters by sequentially parsing the config files |
Attributes
- exarl.utils.candleDriver.file_path
- exarl.utils.candleDriver.required = ['agent', 'model_type', 'env', 'workflow']
- exarl.utils.candleDriver.resolve_path(*path_components) str
Resolve path to configuration files. Priority is as follows:
<current working directory>/exarl/config
~/.exarl/config
<site-packages dir>/exarl/config
- class exarl.utils.candleDriver.BenchmarkDriver(filepath, defmodel, framework, prog=None, desc=None, parser=None)
Bases:
exarl.candlelib.candle.BenchmarkClass that implements an interface to handle configuration options for the different CANDLE benchmarks. It provides access to all the common configuration options and configuration options particular to each individual benchmark. It describes what minimum requirements should be specified to instantiate the corresponding benchmark. It interacts with the argparser to extract command-line options and arguments from the benchmark’s configuration files.
Initialize Benchmark object.
- Parameters
filepath (./) – os.path.dirname where the benchmark is located. Necessary to locate utils and establish input/ouput paths
defmodel ('p*b*_default_model.txt') – string corresponding to the default model of the benchmark
framework ('keras', 'neon', 'mxnet', 'pytorch') – framework used to run the benchmark
prog ('p*b*_baseline_*') – string for program name (usually associated to benchmark and framework)
desc (' ') – string describing benchmark (usually a description of the neural network model built)
parser (argparser (default None)) – if ‘neon’ framework a NeonArgparser is passed. Otherwise an argparser is constructed.
- set_locals(self)
Functionality to set variables specific for the benchmark - required: set of required parameters for the benchmark. - additional_definitions: list of dictionaries describing the additional parameters for the benchmark.
- exarl.utils.candleDriver.initialize_parameters()
- exarl.utils.candleDriver.lookup_params(arg, default=None)
Attempts to lookup arg from the global run_params. If it is not found it will return the defualt value passed as input.
- exarl.utils.candleDriver.base_parser(params)
The base_parser is needed to intercept command line overwrites of the basic configuration files only. All other additional keywords are generated automatically by the parser_from_json function. The configuration files which can be set here correspond to the essential components of an EXARL run: agent, env (environment), model (model_type) and workflow.
- Parameters
params (dictionary object) – Dictionary of parameters
- Returns
params (dictionary object) – Updated dictionary of parameters
- exarl.utils.candleDriver.parser_from_json(json_file)
Custom parser to read a json file and return the list of included keywords. Special case for True/False since these are not handled correctly by the default python command line parser. All keywords defined in json files are subsequently available to be overwritten from the command line, using the CANDLE command line parser.
- Parameters
json_file (str) – File to be parsed
- Returns
new_defs (dictionary) – Dictionary of parameters
- exarl.utils.candleDriver.get_driver_params()
Build the full set of run parameters by sequentially parsing the config files for agent, model, env and workflow. Unless overwritten from the command line (via base_parser), the names for these config files are defined in the learner_cfg.json file.