fix(checkpoint): RL replay tests + keep final alias (follow-up to #51)#52
Open
fbanelli wants to merge 1 commit into
Open
fix(checkpoint): RL replay tests + keep final alias (follow-up to #51)#52fbanelli wants to merge 1 commit into
fbanelli wants to merge 1 commit into
Conversation
…keep final alias Addresses the second review round on PR #51. - RL replay integration tests (`test_train_rl_replay_buffer_used`, `test_train_rl_replay_buffer_samples`, `test_train_replay_initialization`, `test_train_replay_execution`) drove the real `Checkpointer` with a mocked sampler/model/state. The new always-on `save_final` then forced a real orbax save that serialized a `MagicMock` (grain iterator / state `extras`) and failed. These tests cover `ReplayBuffer`, not checkpointing, so they now patch `train.Checkpointer`. - `save_final`: when the final step is already on disk (training ended on a `save_every` boundary that `save_periodic` just wrote), reuse the existing checkpoint instead of letting orbax reject a duplicate write — which dropped the `final` W&B alias and logged a spurious warning. Fixes the Codex P2; the `final` artifact is now always tagged. - tests: replace the duplicate-step test with a backward-unsaved-step case plus a regression for the reused-final-step path; add `all_steps` to the fake manager. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
4 tasks
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.
Follow-up to the now-merged #51. A regression in the always-on RL
save_final(added in #51) was found while reviewing the private backport; this lands the fix ondevproperly (it was mistakenly pushed onto the already-merged #51 branch first — that commit is not ondev).Changes
test_train_rl_replay_buffer_used,test_train_rl_replay_buffer_samples,test_train_replay_initialization,test_train_replay_execution) drove the realCheckpointerwith a mocked sampler/model/state. The always-onsave_finalthen forced a real orbax save that serialized aMagicMock(grain iterator / stateextras) and failed. These tests coverReplayBuffer, not checkpointing, so they now patchtrain.Checkpointer(astest_train_rl_full_integrationalready does).save_final: when the final step is already on disk (training ended on asave_everyboundary thatsave_periodicjust wrote), reuse the existing checkpoint instead of letting orbax reject a duplicate write — which dropped thefinalW&B alias and logged a spurious warning. Thefinalartifact is now always tagged.all_stepsto the fake manager.Test plan
tests/unit/training/test_checkpointer.py+tests/integration/training/{test_full_integration,test_train_replay_integration}.py— 54 passed🤖 Generated with Claude Code