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: Sft train script FSDP QLoRA embedding mean resizing error #2151

Conversation

BenjaminBossan
Copy link
Member

Resizing the embedding layer with mean_resizing=True, which has been introduced in transformers > 4.45, will result in an error. This is because for FSDP + QLoRA the embedding matrix can be on meta device, in which case mean resizing fails. Therefore, if these conditions are detected, the script will set mean_resizing=False.

Also updated the recommended package versions to newer versions that I have checked to be working.

Resizing the embedding layer with mean_resizing=True, which has been
introduced in transformers > 4.45, will result in an error. This is
because for FSDP + QLoRA the embedding matrix can be on meta device, in
which case mean resizing fails. Therefore, if these conditions are
detected, the script will set mean_resizing=False.

Also updated the recommended package versions to newer versions that I
have checked to be working.
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@BenjaminBossan BenjaminBossan requested a review from gante October 15, 2024 12:42
Copy link
Member

@gante gante left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for this downstream fix 💛

@BenjaminBossan BenjaminBossan merged commit 62f71e3 into huggingface:main Oct 16, 2024
14 checks passed
@BenjaminBossan BenjaminBossan deleted the fix-sft-train-script-embedding-mean-resizing branch October 16, 2024 15:38
sirluk pushed a commit to sirluk/peft that referenced this pull request Oct 19, 2024
…ngface#2151)

Resizing the embedding layer with mean_resizing=True, which has been
introduced in transformers > 4.45, will result in an error. This is
because for FSDP + QLoRA the embedding matrix can be on meta device, in
which case mean resizing fails. Therefore, if these conditions are
detected, the script will set mean_resizing=False.

Also updated the recommended package versions to newer versions that I
have checked to be working.
yaswanth19 pushed a commit to yaswanth19/peft that referenced this pull request Oct 20, 2024
…ngface#2151)

Resizing the embedding layer with mean_resizing=True, which has been
introduced in transformers > 4.45, will result in an error. This is
because for FSDP + QLoRA the embedding matrix can be on meta device, in
which case mean resizing fails. Therefore, if these conditions are
detected, the script will set mean_resizing=False.

Also updated the recommended package versions to newer versions that I
have checked to be working.
yaswanth19 pushed a commit to yaswanth19/peft that referenced this pull request Oct 20, 2024
…ngface#2151)

Resizing the embedding layer with mean_resizing=True, which has been
introduced in transformers > 4.45, will result in an error. This is
because for FSDP + QLoRA the embedding matrix can be on meta device, in
which case mean resizing fails. Therefore, if these conditions are
detected, the script will set mean_resizing=False.

Also updated the recommended package versions to newer versions that I
have checked to be working.
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