Fix episode continuity across sampler batch slots - #8
Open
JLUbaijh2323 wants to merge 1 commit into
Open
Conversation
JLUbaijh2323
marked this pull request as ready for review
August 21, 2026 15:16
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.
Summary
Add an optional persistent batch-slot layout to
SequentialEpisodeBatchSamplerand enable it for the RoboTwin-MeM training configuration.
Problem
EventVLA keeps predicted runtime keyframe state by batch slot:
_runtime_keyframe_image_bank[slot_idx]_runtime_pending_keyframe_writes[slot_idx]_runtime_slot_episode_ids[slot_idx]The current sampler instead flattens every episode into one sample stream before
splitting that stream into batches. With batch size 4, one episode is arranged
approximately as:
Consequently, each runtime memory slot skips between sparse points while the
history of one episode is split across multiple independent slots.
Change
When
preserve_episode_batch_slotsis enabled, complete episodes are assignedto approximately load-balanced persistent slots:
The implementation also:
stream rather than repeatedly copying one frame.
The option defaults to
falseat the sampler API boundary, preserving thereleased behavior for existing users. It is enabled in the RoboTwin-MeM
training YAML, where predicted KEM state is slot-indexed.
Validation
boundaries, sparse anchors, uneven distributed ranks, and empty slots.
with the released sampler and checking persistent-mode causality/DDP lengths.
python3 -m pytest -q EventVLA/tests/test_sequence_sampler_slots.pyruff check EventVLA/tests/test_sequence_sampler_slots.pyblack --check EventVLA/tests/test_sequence_sampler_slots.pygit diff --checkRelated to #7.