Fix runtime issues for FSDP/DeepSpeed training#1017
Open
SajanGhimire1 wants to merge 2 commits intolinkedin:mainfrom
Open
Fix runtime issues for FSDP/DeepSpeed training#1017SajanGhimire1 wants to merge 2 commits intolinkedin:mainfrom
SajanGhimire1 wants to merge 2 commits intolinkedin:mainfrom
Conversation
- Removed unsafe usage of _MISSING_TYPE in parse_args. - Fixed KeyError in DataModule by correcting dataset field access. - Replaced set-based FSDP auto_wrap_policy with transformer_auto_wrap_policy. - Corrected Lightning precision strings to valid values (bf16-mixed). - Fixed devices argument to safely detect available GPUs. - Added safe get() for labels in training/validation steps to avoid KeyError.
Tcc0403
reviewed
Jan 15, 2026
| from torch.utils.data import DataLoader | ||
| from transformers.models.llama.modeling_llama import LlamaDecoderLayer | ||
| from transformers.models.qwen2.modeling_qwen2 import Qwen2DecoderLayer | ||
| from trl import DataCollatorForCompletionOnlyLM |
Collaborator
There was a problem hiding this comment.
What trl version should I use? I couldn't import DataCollatorForCompletionOnlyLM
Author
There was a problem hiding this comment.
DataCollatorForCompletionOnlyLM class requires trl >= 0.8.0. Please make sure that version (or higher) is installed to avoid import issues.
Author
There was a problem hiding this comment.
trl==0.26.2 no longer exposes DataCollatorForCompletionOnlyLM in the same way. This example is intended to work with older TRL releases where the collator exists, specifically: trl>=0.8.0,<0.21.0 In newer TRL versions (including 0.26.x), the collator was refactored/removed, which causes the import error.
Tcc0403
reviewed
Jan 15, 2026
| data: str = "cais/mmlu" | ||
| output_dir: str = "mmlu_finetuning" | ||
| max_length: int = 2048 | ||
| # for llam3 8B model, deepspeed will OOM with 16 on 8XA100 80G and 8 will OOM with 8XA100 40G |
Restore removed comments without functional changes
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
Ensures stable and correct training across multi-GPU setups with FSDP/DeepSpeed by fixing dataset handling, auto-wrap policy, precision settings, and device detection.
Testing Done
make testto ensure correctnessmake checkstyleto ensure code stylemake test-convergenceto ensure convergence