nemo_gym.global_config#
Module Contents#
Classes#
Functions#
This function provides a handle to the global configuration dict |
|
Format user-friendly warning. Union literal errors are consolidated.
Union discriminator noise is filtered out. Explanation:
Pydantic validation is quirky- it will report all failures in the union if any union member fails. Example:
If an agent server contains an invalid license, it will not only show the error for the invalid license in ResponsesAPIAgentServerInstanceConfig, but also missing values for ResponsesAPIModelServerInstanceConfig |
Data#
API#
- nemo_gym.global_config._GLOBAL_CONFIG_DICT#
None
- nemo_gym.global_config.NEMO_GYM_CONFIG_DICT_ENV_VAR_NAME#
‘NEMO_GYM_CONFIG_DICT’
- nemo_gym.global_config.NEMO_GYM_CONFIG_PATH_ENV_VAR_NAME#
‘NEMO_GYM_CONFIG_PATH’
- nemo_gym.global_config.CONFIG_PATHS_KEY_NAME#
‘config_paths’
- nemo_gym.global_config.ENTRYPOINT_KEY_NAME#
‘entrypoint’
- nemo_gym.global_config.DEFAULT_HOST_KEY_NAME#
‘default_host’
- nemo_gym.global_config.HEAD_SERVER_KEY_NAME#
‘head_server’
- nemo_gym.global_config.DISALLOWED_PORTS_KEY_NAME#
‘disallowed_ports’
- nemo_gym.global_config.HEAD_SERVER_DEPS_KEY_NAME#
‘head_server_deps’
- nemo_gym.global_config.PYTHON_VERSION_KEY_NAME#
‘python_version’
- nemo_gym.global_config.NEMO_GYM_RESERVED_TOP_LEVEL_KEYS#
None
- nemo_gym.global_config.POLICY_BASE_URL_KEY_NAME#
‘policy_base_url’
- nemo_gym.global_config.POLICY_API_KEY_KEY_NAME#
‘policy_api_key’
- nemo_gym.global_config.POLICY_MODEL_NAME_KEY_NAME#
‘policy_model_name’
- nemo_gym.global_config.DEFAULT_HEAD_SERVER_PORT#
11000
- class nemo_gym.global_config.GlobalConfigDictParserConfig#
Bases:
pydantic.BaseModel- model_config#
‘ConfigDict(…)’
- dotenv_path: Optional[pathlib.Path]#
None
- initial_global_config_dict: Optional[omegaconf.DictConfig]#
None
- skip_load_from_cli: bool#
False
- skip_load_from_dotenv: bool#
False
- NO_MODEL_GLOBAL_CONFIG_DICT: ClassVar[omegaconf.DictConfig]#
‘DictConfig(…)’
- class nemo_gym.global_config.GlobalConfigDictParser#
Bases:
pydantic.BaseModel- parse_global_config_dict_from_cli() omegaconf.DictConfig#
- load_extra_config_paths(
- config_paths: List[str],
Returns the new total config_paths and the extra configs
- filter_for_server_instance_configs(
- global_config_dict: omegaconf.DictConfig,
- validate_and_populate_defaults(
- server_instance_configs: List[nemo_gym.config_types.ServerInstanceConfig],
- default_host: str,
- initial_disallowed_ports: Optional[List[int]] = None,
- parse(
- parse_config: Optional[nemo_gym.global_config.GlobalConfigDictParserConfig] = None,
- parse_no_environment(
- initial_global_config_dict: Optional[omegaconf.DictConfig] = None,
- detect_and_report_almost_servers(
- global_config_dict: omegaconf.DictConfig,
- nemo_gym.global_config.get_global_config_dict(
- global_config_dict_parser_config: Optional[nemo_gym.global_config.GlobalConfigDictParserConfig] = None,
- global_config_dict_parser_cls: Type[nemo_gym.global_config.GlobalConfigDictParser] = GlobalConfigDictParser,
This function provides a handle to the global configuration dict
global_config_dict. We try to have one source of truth for everything in NeMo gym. This config is resolved once and only once, immediately on a run command.On first initialization, the global config dict will be loaded from the following sources in order of priority (later items are higher priority):
Configuration yamls specified in
config_pathsparameter.Configuration (usually sensitive values like API keys, etc) from a local
.env.yamlfile.Command line argument configuration.
Validation is performed on the passed in configs:
If a host or port is not provided for a server, defaults will be provided. Ports are resolved by the OS.
If there are server reference configs, the respective server names and types will be validated against the remainder of the config.
Then, the global config dict will be cached and reused.
If this function is run by a child server of the main proc, that child will have been spun up with an environment variable with key NEMO_GYM_CONFIG_DICT_ENV_VAR_NAME. The config dict will be read directly off this variable, cached, and returned with no additional validation.
- nemo_gym.global_config.set_global_config_dict(
- global_config_dict_parser_config: Optional[nemo_gym.global_config.GlobalConfigDictParserConfig] = None,
- global_config_dict_parser_cls: Type[nemo_gym.global_config.GlobalConfigDictParser] = GlobalConfigDictParser,
- nemo_gym.global_config.get_first_server_config_dict(
- global_config_dict: omegaconf.DictConfig,
- top_level_path: str,
- nemo_gym.global_config.find_open_port(
- disallowed_ports: Optional[List[int]] = None,
- max_retries: int = 50,
- nemo_gym.global_config.format_almost_server_warning(
- server_name: str,
- error: pydantic.ValidationError,
Format user-friendly warning. Union literal errors are consolidated. Union discriminator noise is filtered out. Explanation: Pydantic validation is quirky- it will report all failures in the union if any union member fails. Example: If an agent server contains an invalid license, it will not only show the error for the invalid license in ResponsesAPIAgentServerInstanceConfig, but also missing values for ResponsesAPIModelServerInstanceConfig
responses_api_modelsand ResourcesServerInstanceConfigresources_servers.