Update pretraining dataloader and torchtitan runner#33
Open
T4ras123 wants to merge 1 commit into
Open
Conversation
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.
This pull request introduces several performance and robustness improvements to the data loading and checkpoint handling logic for pretraining in
molgen3D. The most significant changes are the refactoring of the data loader to use NumPy arrays for pair management (improving efficiency and scalability), a robust mechanism to patch HuggingFace checkpoints safely in distributed environments, and the initialization of a multi-backend PyTorch distributed group to avoid InfiniBand resource exhaustion. Additionally, some unused arguments were removed from tokenizer initialization.DataLoader performance and memory improvements:
dataloader.py, and updated all related logic to use efficient NumPy operations for shuffling and worker assignment. This should significantly improve memory usage and speed when handling large datasets. [1] [2] [3] [4] [5]Distributed checkpoint patching and safety:
_ensure_hf_checkpoint_has_lm_headto ensure only global rank 0 performs checkpoint patching, using a.readysentinel file to signal completion. Other ranks wait for the sentinel, preventing race conditions and file corruption. This is especially important for multi-node training. [1] [2]Distributed training initialization robustness:
torch.distributedwith both CUDA and CPU backends to ensure CPU-based collectives use GLOO, avoiding InfiniBand completion queue exhaustion and related NCCL errors during planning phases.Tokenizer loading simplification:
fix_mistral_regexargument fromAutoTokenizer.from_pretrainedcalls in both the data loader and runner, simplifying tokenizer initialization. [1] [2]Configuration and path improvements:
"qwen_yerevann_root"to"ckpts_root"for clarity and consistency intorchtitan_runner.py.