Repository navigation
[BugFix] Fix offline-to-online training with a mixed replay buffer - #4768
Draft
sramireddy2 wants to merge 2 commits into
Draft
sramireddy2 wants to merge 2 commits into
sramireddy2 wants to merge 2 commits into
Conversation
- OfflineToOnlineReplayBuffer exposes write_count and batch_size, which UTDRHook reads when logging is enabled (the default). - Mixed samples drop the offline buffer's sampling metadata (e.g. "index" from TensorDictReplayBuffer-based datasets) so the concat with the online sample works. - The offline_to_online example adds RewardSum so the default r_total logging finds reward_sum.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/4768
Note: Links to docs will display an error until the docs builds have been completed.
|
sramireddy2
marked this pull request as draft
November 29, 2026 23:10
SliceSampler reports done keys in its info, so dropping every info key broke the concat. Drop only those missing from the online sample.
This branch has not been deployed
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.
Description
Fixes #4765. The offline-to-online example stopped on its first online batch:
OfflineToOnlineReplayBuffernow haswrite_count(the online buffer's) andbatch_size, whichUTDRHookreads when logging is enabled.OfflineToOnlineReplayBuffer.sampledrops the keys that the offline sampler reports (e.g. theindexthatTensorDictReplayBuffer-based datasets add) and the online sample lacks, before concatenating the two. Mismatches in any other key still raise.RewardSum, so the defaultr_totallogging findsreward_sum.test_train_grows_online_and_annealsnow also runs with logging enabled and aTensorDictReplayBufferoffline dataset.Motivation and Context
Types of changes
Checklist
I used an AI assistant (Claude Code) to help find the bug and write and test the change. I'm still reviewing it, so this is a draft.