Loading...
Loading...
Configuration conventions for NeMo-RL. YAML is the single source of truth for defaults. Covers TypedDict usage, exemplar YAML updates, and forbidden default patterns.
npx skill4agent add nvidia/skills config-conventionsNonepolicy_cfg["precision"]typing.NotRequiredNoneexamples/configs/*.yamlexamples/configs/recipes/**/*.yamlTypedDictexamples/configs/*.yamldefaultsexamples/configs/recipes/**/*.yamldefaults: <exemplar>.yamlexamples/configs/*.yamldefaultsuv run ./tools/config_cli.py minimize <recipe.yaml>defaultsNotRequiredin.get(key).get(key, None)None# .get() with None (not a hidden default)
stop_properly_penalty_coef = cfg.get("stop_properly_penalty_coef", None)
# Truthiness check for optional booleans
if master_config.grpo.get("skip_reference_policy_logprobs_calculation"):
...
# Nested NotRequired: check presence at each level explicitly
if "megatron_cfg" in policy_config and policy_config["megatron_cfg"]["enabled"]:
...# Hidden boolean default — should come from YAML
disable_ppo_ratio = cfg.get("disable_ppo_ratio", False)
# Hidden non-trivial default — caller has no idea True is the fallback
normalize_rewards = grpo_config.get("normalize_rewards", True)
# Chained .get() with hidden defaults at each level
megatron_enable = config.get("megatron_cfg", {}).get("enabled", False)NotRequired# Hidden default in code
precision = policy_cfg.get("precision", "bfloat16")
# Function parameter defaulting a config value
def build_policy(policy_cfg, precision: str = "bfloat16"):
...# Required attribute: expect it from YAML or user override
precision: str = policy_cfg["precision"]
# Optional attribute: check for presence
if "milestones" in scheduler_cfg:
configure_milestones(scheduler_cfg["milestones"])