EasyTPP Config Modules
- class config_factory.Config[source]
Bases:
Registrable
- save_to_yaml_file(fn)[source]
Save the config into the yaml file ‘fn’.
- Parameters:
fn (str) – Target filename.
Returns:
- static build_from_yaml_file(yaml_fn, **kwargs)[source]
Load yaml config file from disk.
- Parameters:
yaml_fn (str) – Path of the yaml config file.
- Returns:
Config object corresponding to cls.
- Return type:
EasyTPP.Config
- abstract static parse_from_yaml_config(yaml_config)[source]
Parse from the yaml to generate the config object.
- Parameters:
yaml_config (dict) – configs from yaml file.
- Returns:
Config class for data.
- Return type:
EasyTPP.Config
- update(config)[source]
Update the config.
- Parameters:
config (dict) – config dict.
- Returns:
Config class for data.
- Return type:
EasyTPP.Config
- pop(key: str, default_var: Any)[source]
pop out the key-value item from the config.
- Parameters:
key (str) – key name.
default_var (Any) – default value to pop.
- Returns:
value to pop.
- Return type:
Any
- class config_factory.DataConfig(train_dir, valid_dir, test_dir, specs=None)[source]
Bases:
Config
- __init__(train_dir, valid_dir, test_dir, specs=None)[source]
Initialize the DataConfig object.
- Parameters:
train_dir (str) – dir of tran set.
valid_dir (str) – dir of valid set.
test_dir (str) – dir of test set.
specs (dict, optional) – specs of dataset. Defaults to None.
- get_yaml_config()[source]
Return the config in dict (yaml compatible) format.
- Returns:
config of the data in dict format.
- Return type:
dict
- class config_factory.DataSpecConfig(**kwargs)[source]
Bases:
Config
- get_yaml_config()[source]
Return the config in dict (yaml compatible) format.
- Returns:
config of the data specs in dict format.
- Return type:
dict
- static parse_from_yaml_config(yaml_config)[source]
Parse from the yaml to generate the config object.
- Parameters:
yaml_config (dict) – configs from yaml file.
- Returns:
Config class for data specs.
- Return type:
- class config_factory.ModelConfig(**kwargs)[source]
Bases:
Config
- get_yaml_config()[source]
Return the config in dict (yaml compatible) format.
- Returns:
config of the model config specs in dict format.
- Return type:
dict
- static parse_from_yaml_config(yaml_config)[source]
Parse from the yaml to generate the config object.
- Parameters:
yaml_config (dict) – configs from yaml file.
- Returns:
Config class for trainer specs.
- Return type:
- class config_factory.BaseConfig(**kwargs)[source]
Bases:
Config
- get_yaml_config()[source]
Return the config in dict (yaml compatible) format.
- Returns:
config of the base config specs in dict format.
- Return type:
dict
- static parse_from_yaml_config(yaml_config)[source]
Parse from the yaml to generate the config object.
- Parameters:
yaml_config (dict) – configs from yaml file.
- Returns:
Config class for trainer specs.
- Return type:
- class config_factory.RunnerConfig(base_config, model_config, data_config, trainer_config)[source]
Bases:
Config
- __init__(base_config, model_config, data_config, trainer_config)[source]
Initialize the Config class.
- Parameters:
base_config (EasyTPP.BaseConfig) – BaseConfig object.
model_config (EasyTPP.ModelConfig) – ModelConfig object.
data_config (EasyTPP.DataConfig) – DataConfig object.
trainer_config (EasyTPP.TrainerConfig) – TrainerConfig object
- get_yaml_config()[source]
Return the config in dict (yaml compatible) format.
- Returns:
config of the runner config in dict format.
- Return type:
dict
- static parse_from_yaml_config(yaml_config, **kwargs)[source]
Parse from the yaml to generate the config object.
- Parameters:
yaml_config (dict) – configs from yaml file.
- Returns:
Config class for trainer specs.
- Return type:
- ensure_valid_config()[source]
Do some sanity check about the config, to avoid conflicts in settings.
- class config_factory.HPOConfig(framework_id, storage_uri, is_continuous, num_trials, num_jobs)[source]
Bases:
Config
- __init__(framework_id, storage_uri, is_continuous, num_trials, num_jobs)[source]
Initialize the HPO Config
- Parameters:
framework_id (str) – hpo framework id.
storage_uri (str) – result storage dir.
is_continuous (bool) – whether to continuously do the optimization.
num_trials (int) – num of trails used in optimization.
num_jobs (int) – num of the jobs.
- property storage_protocol
Get the storage protocol
- Returns:
the dir of the storage protocol.
- Return type:
str
- property storage_path
Get the storage protocol
- Returns:
the dir of the hpo data storage.
- Return type:
str
- get_yaml_config()[source]
Return the config in dict (yaml compatible) format.
- Returns:
config of the HPO specs in dict format.
- Return type:
dict
- class config_factory.HPORunnerConfig(hpo_config, runner_config)[source]
Bases:
Config
- __init__(hpo_config, runner_config)[source]
Initialize the config class
- Parameters:
hpo_config (EasyTPP.HPOConfig) – hpo config class.
runner_config (EasyTPP.RunnerConfig) – runner config class.