OmniSafe Config#
|
Config class for storing hyperparameters. |
Config#
OmniSafe use yaml file to store all the configurations. The configuration file is stored in omnisafe/configs. The configuration file is divided into several parts.
Take PPOLag as an example, the configuration file is as follows:
Config |
Description |
|
Training configurations. |
|
Algorithm configurations |
|
Logger configurations |
|
Model configurations |
|
Lagrange configurations |
Specifically, the train_cfgs is as follows:
Config |
Description |
Value |
|
Device to use. |
|
|
Number of threads to use. |
16 |
|
Number of vectorized environments. |
1 |
|
Number of parallel agent, similar to A3C. |
1 |
|
Total number of training steps. |
1000000 |
Other configurations are similar to train_cfgs. You can refer to the omnisafe/configs for more details.
Documentation
- class omnisafe.utils.config.Config(**kwargs)[source]#
Config class for storing hyperparameters.
OmniSafe uses a Config class to store all hyperparameters. OmniSafe store hyperparameters in a yaml file and load them into a Config object. Then the Config class will check the hyperparameters are valid, then pass them to the algorithm class.
Initialize Config.
- static dict2config(config_dict)[source]#
Convert dictionary to Config.
- Parameters:
config_dict (dict) – dictionary to be converted.
- Return type:
Model Config#
Common Method#
Documentation
- omnisafe.utils.config.get_default_kwargs_yaml(algo, env_id, algo_type)[source]#
Get the default kwargs from
yamlfile.Note
This function search the
yamlfile by the algorithm name and environment name. Make sure your new implemented algorithm or environment has the same name as the yaml file.- Parameters:
algo (str) – algorithm name.
env_id (str) – environment name.
- Return type:
Documentation
Documentation
- omnisafe.utils.config.__check_algo_configs(configs, algo_type)[source]#
Check algorithm configs.
This function is used to check the algorithm configs.
Note
update_itersmust be greater than 0 and must be int.update_cyclemust be greater than 0 and must be int.batch_sizemust be greater than 0 and must be int.target_klmust be greater than 0 and must be float.entropy_coeffmust be in [0, 1] and must be float.gammamust be in [0, 1] and must be float.cost_gammamust be in [0, 1] and must be float.lammust be in [0, 1] and must be float.lam_cmust be in [0, 1] and must be float.clipmust be greater than 0 and must be float.penalty_coeffmust be greater than 0 and must be float.reward_normalizemust be bool.cost_normalizemust be bool.obs_normalizemust be bool.kl_early_stopmust be bool.use_max_grad_normmust be bool.use_costmust be bool.max_grad_normmust be greater than 0 and must be float.adv_estimation_methodmust be in [gae,v-trace,gae-rtg,plain].standardized_rew_advmust be bool.standardized_cost_advmust be bool.
- Parameters:
configs (Config) – configs to be checked.
algo_type (str) – algorithm type.
- Return type:
None