Config
Configuration module for GLLM training.
This module provides utilities for loading and managing configuration files for GLLM training experiments.
Reviewers
- Muhammad Afif Al Hawari (muhammad.a.a.hawari@gdplabs.id)
References
NONE
YamlConfigLoader(base_dir='')
Loads YAML configuration files with support for includes and environment variables.
This loader extends PyYAML's FullLoader to support custom tags for more dynamic and modular configuration files.
!envvar: Substitutes an environment variable (e.g.,${MY_API_KEY}).!inc: Includes another YAML file inline.!load_prompt: A specific alias for!inc, intended for loading prompt templates.
Attributes:
| Name | Type | Description |
|---|---|---|
base_dir |
str
|
The base directory from which to resolve relative file paths. |
Initializes the YamlConfigLoader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_dir |
str
|
The base directory for resolving included files. Defaults to the current working directory. |
''
|
load(filename, experiment_id='experiment_1')
Loads and parses a YAML file from the base directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename |
str
|
The name of the file to load. |
required |
experiment_id |
str
|
The experiment ID to use for the output directory. Defaults to "experiment_1". |
'experiment_1'
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: The parsed YAML content as a Python dictionary. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the |