Repository navigation
Conversation
Instruments all four trainers against wandb entity shehio, project rl-atari: the custom DQN and policy gradient episode loops log per-episode metrics directly, and both SB3 scripts stream full rollout/train metrics through WandbCallback with sync_tensorboard. Every script keeps working with tracking off via --no-wandb or WANDB_MODE=disabled. Adds four sweep configs under sweeps/ (algorithm comparison, n_envs, seed sensitivity, DQN exploration), plus the --epsilon-decay and --memory-size overrides the DQN sweep needs. train_lunarlander.py gains DQN, --timesteps, and --seed so it can run finite reproducible A/B jobs. modal_app.py mirrors the atari_baseline_train.py CLI on an A10G worker. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P4b1Hy6RUgtNpNx2s72NHm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What This Adds
Experiment tracking through Weights & Biases (entity
shehio, projectrl-atari), sweep configs for the comparisons we care about, and a Modal GPU runner for the SB3 baseline trainer.Hook Sites
All four trainers are instrumented:
atari/algorithms/dqn/scripts/dqn_trainer.py(train()episode loop)episode_reward,episode_loss,epsilon,last_100_avg_reward,avg_max_q,episode_steps,total_steps,episode_duration_sec;final_episode/final_last_100_avg_rewardas summary metricsatari/algorithms/pg/scripts/pg_trainer.py(Trainer.train()/post_episode)episode_reward,running_reward,points_scored,points_conceded; final episode and running reward as summary metricsatari/baselines/atari_baseline_train.pywandb.integration.sb3.WandbCallback+tensorboard_log+sync_tensorboard=True, so allrollout/*andtrain/*metrics stream throughatari/baselines/train_lunarlander.pyEvery run calls
wandb.init(entity="shehio", project="rl-atari", config=<all hyperparams>, tags=[...]), and eval/final results land as summary metrics.Running With and Without Wandb
Every touched script takes
--no-wandb, honoursWANDB_MODE=disabled/offline, and degrades gracefully with a printed notice if wandb is not installed. All three paths were exercised.Sweeps
Under
sweeps/, each with awandb sweepusage comment at the top:sb3_algo_comparison.yaml: PPO vs DQN vs A2C at an equal timestep budgetsb3_n_envs.yaml: n_envs 1 / 4 / 8sb3_seed_sensitivity.yaml: one config across 5 seedsdqn_exploration.yaml: custom DQN epsilon-decay x replay buffer sizeThe DQN sweep needed knobs that did not exist, so
dqn_trainer.pygained--epsilon-decayand--memory-size, wired throughdqn_game_configs.pyintoExplorationConfigandTrainingConfig(withmin_memory_lenclamped below buffer capacity).Modal
modal_app.pymirrors theatari_baseline_train.pyCLI on an A10G worker:modal.App,debian_slim(python_version="3.12"),add_local_dir,@app.function(gpu=..., timeout=..., secrets=[modal.Secret.from_name("wandb")]), and a matching@app.local_entrypoint. Checkpoints persist in therl-atari-modelsvolume.Code only, verified with
python -m py_compile. It has never been executed, since there is no Modal token here.Smoke A/B Results
PPO vs DQN on LunarLander-v3, identical config keys so the curves overlay, tagged
smoke-ab. A pair had already been logged by an earlier pass at 20k timesteps; this pass re-ran at 25k before spotting them, so both pairs are listed. They agree.rollout/ep_rew_meanPPO is ahead of DQN at an equal budget in both pairs, which is the expected ordering this early: DQN is still mostly filling its replay buffer at 25k steps.
Two further runs validate the other hook sites end to end:
atari_baseline_train.py, PPO on ALE/Pong-v5, 3k timesteps,rollout/ep_rew_mean-20.44dqn_trainer.pyon Pong, per-episode metrics confirmed live (episode_reward,last_100_avg_reward,epsilon,episode_loss)Also Changed
train_lunarlander.pygained DQN as an algorithm choice plus--timestepsand--seed, so it can run finite, reproducible A/B jobs instead of only the previous infinite loop..gitignorecoverswandb/andtb_logs/;wandbis pinned inrequirements.txt.Skipped
Test Status
pytest tests/gives 38 passed, 1 failed. The failure,tests/test_atari_baselines.py::test_parse_arguments, is pre-existing and reproduces unchanged onmaster: the module doesfrom atari_baseline_test import parse_arguments as test_parse_arguments, and pytest collects that alias as a test, calling it with no argv.🤖 Generated with Claude Code
https://claude.ai/code/session_01P4b1Hy6RUgtNpNx2s72NHm