Shortcuts

ding.config

Config

class ding.config.Config(cfg_dict: Optional[dict] = None, cfg_text: Optional[str] = None, filename: Optional[str] = None)[源代码]
Overview:

Base class for config.

Interface:

__init__, file_to_dict

Property:

cfg_dict

__init__(cfg_dict: Optional[dict] = None, cfg_text: Optional[str] = None, filename: Optional[str] = None) None[源代码]
Overview:

Init method. Create config including dict type config and text type config.

Arguments:
  • cfg_dict (Optional[dict]): dict type config

  • cfg_text (Optional[str]): text type config

  • filename (Optional[str]): config file name

static _file_to_dict(filename: str) Tuple[dict, str][源代码]
Overview:

Read config file and convert the config file to dict type config and text type config.

Arguments:
  • filename (Optional[str]): config file name.

Returns:
  • cfg_dict (Optional[dict]): dict type config

  • cfg_text (Optional[str]): text type config

static file_to_dict(filename: str) ding.config.config.Config[源代码]
Overview:

Read config file and create config.

Arguments:
  • filename (Optional[str]): config file name.

Returns:
  • cfg_dict (Config): config class

read_config

ding.config.read_config(path: str) Tuple[dict, dict][源代码]
Overview:

Read configuration from a file path(now only suport python file). And select some proper parts.

Arguments:
  • path (str): Path of configuration file

Returns:
  • cfg (Tuple[dict, dict]): A collection(tuple) of configuration dict, divided into main_config and create_cfg two parts.

save_config

ding.config.save_config(config_: dict, path: str, type_: str = 'py', save_formatted: bool = False) None[源代码]
Overview:

save configuration to python file or yaml file

Arguments:
  • config (dict): Config dict

  • path (str): Path of target yaml or target python file

  • type (str): If type is yaml , save configuration to yaml file. If type is py , save configuration to python file.

  • save_formatted (bool): If save_formatted is true, save formatted config to path. Formatted config can be read by serial_pipeline directly.

compile_config

ding.config.compile_config(cfg: easydict.EasyDict, env_manager: Optional[type] = None, policy: Optional[type] = None, learner: type = <class 'ding.worker.learner.base_learner.BaseLearner'>, collector: Optional[type] = None, evaluator: type = <class 'ding.worker.collector.interaction_serial_evaluator.InteractionSerialEvaluator'>, buffer: Optional[type] = None, env: Optional[type] = None, reward_model: Optional[type] = None, world_model: Optional[type] = None, seed: int = 0, auto: bool = False, create_cfg: Optional[dict] = None, save_cfg: bool = True, save_path: str = 'total_config.py', renew_dir: bool = True) easydict.EasyDict[源代码]
Overview:

Combine the input config information with other input information. Compile config to make it easy to be called by other programs

Arguments:
  • cfg (EasyDict): Input config dict which is to be used in the following pipeline

  • env_manager (type): Env_manager class which is to be used in the following pipeline

  • policy (type): Policy class which is to be used in the following pipeline

  • learner (type): Input learner class, defaults to BaseLearner

  • collector (type): Input collector class, defaults to BaseSerialCollector

  • evaluator (type): Input evaluator class, defaults to InteractionSerialEvaluator

  • buffer (type): Input buffer class, defaults to IBuffer

  • env (type): Environment class which is to be used in the following pipeline

  • reward_model (type): Reward model class which aims to offer various and valuable reward

  • seed (int): Random number seed

  • auto (bool): Compile create_config dict or not

  • create_cfg (dict): Input create config dict

  • save_cfg (bool): Save config or not

  • save_path (str): Path of saving file

  • renew_dir (bool): Whether to new a directory for saving config.

Returns:
  • cfg (EasyDict): Config after compiling

Read the Docs v: latest
Versions
latest
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.