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

make sure everything stays in the same dtype when using dpo + FSDP #1559

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

winglian
Copy link
Collaborator

trl's DPO Trainer attempts to call prepare_for_kbit_training on the peft model, but this should be avoided when using FSDP, otherwise you end up with the error:

ValueError: Must flatten tensors with uniform dtype but got torch.bfloat16 and torch.float32

we go behind it after instantiation and fix the dtypes.

@maziyarpanahi
Copy link
Contributor

can confirm, this PR fixes the issue for me. (QLoRA+FSDP Llama-3-70B)

@winglian winglian merged commit 68601ec into main Apr 22, 2024
7 checks passed
@winglian winglian deleted the dpo-fsdp-fix branch April 22, 2024 20:00
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.

2 participants