[train, data] perf: optimize data fetching latency for full-hetero encoder - #76
Merged
Merged
Conversation
Yangsx-1
force-pushed
the
data-pull
branch
3 times, most recently
from
May 29, 2026 07:14
03aa349 to
3464bc1
Compare
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
Optimizes data loading for the encoder in full-hetero DP mode by eliminating redundant data fetching. Previously, the encoder iterated through all microbatches sequentially (including those assigned to other PP ranks), causing unnecessary IO and latency. Now each PP rank only fetches its own assigned microbatches.
Changes
loongforge/data/encoder_strided_sampler.pyEncoderStridedSampler(map-style),EncoderStridedIterator(streaming),PrefetchIterator(background prefetch)loongforge/data/multimodal/dataloader_provider.pybuild_encoder_energon_iteratorfor Energon/WebDataset pathloongforge/train/sft/utils.pybuild_encoder_data_iteratorfor SFT map-style datasetsloongforge/train/pretrain/pretrain_vlm.pyget/set_encoder_data_iteratorloongforge/train/training_utils.pytrain_stepto consume from dedicated encoder iterator, removingitertools.tee+ sequential skip pattern