Skip to content

feat(wandb): log full RLConfig to W&B instead of per-component subconfig - #3110

Draft
samsja wants to merge 2 commits into
mainfrom
feat/wandb-full-config
Draft

feat(wandb): log full RLConfig to W&B instead of per-component subconfig#3110
samsja wants to merge 2 commits into
mainfrom
feat/wandb-full-config

Conversation

@samsja

@samsja samsja commented Jul 22, 2026

Copy link
Copy Markdown
Member

Summary

The rl entrypoint splits the full RLConfig into per-component subconfigs (trainer.toml, orchestrator.toml, inference.toml) before launching subprocesses. Each process only loads its subconfig, so wandb.init(config=...) only received the orchestrator config (the primary in shared W&B mode). The trainer, inference, slurm, deployment, and shared sections were missing entirely from the W&B run config.

Changes

  • rl.py: The rl() entrypoint writes the full resolved RLConfig as JSON (output_dir/configs/full_config.json) and sets WANDB_FULL_CONFIG_PATH in os.environ so all locally-launched subprocesses inherit it.
  • multi_node_rl.sbatch.j2: Exports WANDB_FULL_CONFIG_PATH directly (srun tasks don't inherit the launcher's os.environ).
  • wandb.py: WandbMonitor reads the full config JSON when WANDB_FULL_CONFIG_PATH is set, falling back to the per-component subconfig otherwise. After wandb.init, also uploads all config files (full_config.json + subconfig TOMLs) to the W&B run so they're downloadable from the UI Files tab.

All three launch modes are covered:

  • Local: os.environ propagates to subprocesses via **os.environ in Popen env dicts
  • Single-node SLURM: sbatch template re-runs uv run rl -> rl() -> sets os.environ -> rl_local()
  • Multi-node SLURM: sbatch template exports WANDB_FULL_CONFIG_PATH alongside existing WANDB_SHARED_* vars

Verification

Tested end-to-end with WANDB_MODE=offline uv run rl @ examples/basic/reverse-text/rl.toml --max-steps 3 --output-dir /tmp/rl-test --wandb:

  • full_config.json written with all 17 top-level keys (trainer, orchestrator, inference, slurm, deployment, wandb, ckpt, model, etc.)
  • Orchestrator log confirms: Using full config from /tmp/rl-test/configs/full_config.json for W&B
  • All config files (full_config.json, trainer.toml, orchestrator.toml, inference.toml) uploaded to the W&B run's Files tab

samsja added 2 commits July 22, 2026 17:40
The rl entrypoint splits the config into subconfigs (trainer.toml,
orchestrator.toml, inference.toml) before launching subprocesses. Each
process only loads its subconfig, so wandb.init only received the
orchestrator config (the primary in shared W&B mode). The trainer,
inference, slurm, deployment, and shared sections were missing entirely.

Fix: the rl() entrypoint writes the full resolved RLConfig as JSON
(output_dir/configs/full_config.json) and sets PRIME_FULL_CONFIG_PATH
in os.environ so all locally-launched subprocesses inherit it. The
multi-node SLURM template exports the same env var separately (since
srun tasks don't inherit the launcher's os.environ). The WandbMonitor
reads this file and uses it as the wandb run config when available,
falling back to the per-component subconfig otherwise.
After wandb.init, save all files in the config_dir (full_config.json +
subconfig TOMLs) to the W&B run so they are downloadable from the UI
Files tab. Uses WANDB_FULL_CONFIG_PATH parent dir to locate the
config directory.

RL_TOML = "rl.toml"
RL_SBATCH = "rl.sbatch"
FULL_CONFIG_JSON = "full_config.json"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

call this rl.json, will land as <output>/configs/rl.json

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and is consistent with other artifacts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants