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 get_yaml_config()[source]

Get the yaml format config from self.

Returns:

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

abstract copy()[source]

Get a same and freely modifiable copy of self.

Returns:

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

get(key: str, default_var: Any)[source]

Retrieve the key-value item from the config.

Parameters:
  • key (str) – key name.

  • default_var (Any) – default value to pop.

Returns:

value to get.

Return type:

Any

set(key: str, var_to_set: Any)[source]

Set the key-value item from the config.

Parameters:
  • key (str) – key name.

  • var_to_set (Any) – default value to pop.

Returns:

value to get.

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

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.DataConfig

copy()[source]

Copy the config.

Returns:

a copy of current config.

Return type:

EasyTPP.DataConfig

get_data_dir(split)[source]

Get the dir of the source raw data.

Parameters:

split (str) – dataset split notation, ‘train’, ‘dev’ or ‘valid’, ‘test’.

Returns:

dir of the source raw data file.

Return type:

str

class config_factory.DataSpecConfig(**kwargs)[source]

Bases: Config

__init__(**kwargs)[source]

Initialize the Config class.

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:

DataSpecConfig

copy()[source]

Copy the config.

Returns:

a copy of current config.

Return type:

DataSpecConfig

class config_factory.ModelConfig(**kwargs)[source]

Bases: Config

__init__(**kwargs)[source]

Initialize the Config class.

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:

ModelConfig

copy()[source]

Copy the config.

Returns:

a copy of current config.

Return type:

ModelConfig

class config_factory.BaseConfig(**kwargs)[source]

Bases: Config

__init__(**kwargs)[source]

Initialize the Config class.

static set_backend(backend)[source]
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:

BaseConfig

copy()[source]

Copy the config.

Returns:

a copy of current config.

Return type:

BaseConfig

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:

RunnerConfig

ensure_valid_config()[source]

Do some sanity check about the config, to avoid conflicts in settings.

update_config()[source]

Updated config dict.

get_metric_functions()[source]
get_metric_direction(metric_name='rmse')[source]
copy()[source]

Copy the config.

Returns:

a copy of current config.

Return type:

RunnerConfig

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

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 HPO specs.

Return type:

EasyTPP.HPOConfig

copy()[source]

Copy the config.

Returns:

a copy of current config.

Return type:

EasyTPP.HPOConfig

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.

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 HPO specs.

Return type:

EasyTPP.HPORunnerConfig

copy()[source]

Copy the config.

Returns:

a copy of current config.

Return type:

EasyTPP.HPORunnerConfig