Implementation:Facebookresearch Habitat lab Get config baselines
| Knowledge Sources | |
|---|---|
| Domains | Configuration_Management, Training |
| Last Updated | 2026-02-15 02:00 GMT |
Overview
Concrete function for composing Habitat-Baselines experiment configurations via Hydra YAML composition with optional CLI overrides.
Description
The get_config function in habitat-baselines loads a YAML config file, applies Hydra composition (merging habitat-lab core config with baselines training config), and applies any runtime overrides. It returns a frozen `DictConfig` containing the complete experiment setup: environment settings, task parameters, policy architecture, and training hyperparameters.
Usage
Call this function at the start of any training or evaluation script to load the experiment configuration. Typically invoked via `habitat_baselines.run.execute_exp` or directly in custom training scripts.
Code Reference
Source Location
- Repository: habitat-lab
- File: habitat-baselines/habitat_baselines/config/default.py
- Lines: L27-43
Signature
def get_config(
config_path: str,
overrides: Optional[List[str]] = None,
configs_dir: str = _BASELINES_CFG_DIR,
) -> DictConfig:
"""
Compose a Habitat-Baselines config from YAML + overrides.
Args:
config_path: Relative path to experiment YAML (e.g., "pointnav/ppo_pointnav.yaml")
overrides: List of Hydra override strings (e.g., ["habitat.seed=1"])
configs_dir: Base directory for config search (defaults to habitat_baselines/config/)
Returns:
DictConfig: Frozen composed configuration
"""
Import
from habitat_baselines.config.default import get_config
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| config_path | str | Yes | Relative path to experiment YAML config file |
| overrides | Optional[List[str]] | No | Hydra override strings (e.g., `["habitat.seed=1", "habitat_baselines.num_environments=4"]`) |
| configs_dir | str | No | Base directory for Hydra config search (defaults to baselines config dir) |
Outputs
| Name | Type | Description |
|---|---|---|
| config | DictConfig | Frozen composed configuration with habitat + baselines settings merged |
Usage Examples
from habitat_baselines.config.default import get_config
# Load PointNav PPO training configuration
config = get_config(
config_path="pointnav/ppo_pointnav.yaml",
overrides=[
"habitat.seed=42",
"habitat_baselines.num_environments=8",
"habitat_baselines.rl.ppo.num_steps=128",
],
)