Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ram efficient fsdp init #25686

Merged
merged 1 commit into from
Aug 24, 2023
Merged

fix ram efficient fsdp init #25686

merged 1 commit into from
Aug 24, 2023

Conversation

pacman100
Copy link
Contributor

@pacman100 pacman100 commented Aug 23, 2023

What does this PR do?

  1. Currently, when using Trainer if the model is loaded before creating TrainingArguments object, torch distributed process group won't be initialized and as such when FSDP is enabled via accelerate config, it will end up initializing the model with random weights on all ranks as the is_fsdp_enabled_and_dist_rank_0 function will always return False. This results in NaN losses. Quite a journey to uncover this bug. This PR fixes it.

@pacman100 pacman100 requested a review from sgugger August 23, 2023 14:27
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Aug 23, 2023

The documentation is not available anymore as the PR was closed or merged.

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me, thanks!

@pacman100 pacman100 merged commit b85b880 into main Aug 24, 2023
@pacman100 pacman100 deleted the smangrul/fsdp-fix branch August 24, 2023 06:00
parambharat pushed a commit to parambharat/transformers that referenced this pull request Sep 26, 2023
blbadger pushed a commit to blbadger/transformers that referenced this pull request Nov 8, 2023
EduardoPach pushed a commit to EduardoPach/transformers that referenced this pull request Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants