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: Assign dtype of lora to base model dtype #82

Merged
merged 1 commit into from
Nov 29, 2023
Merged

fix: Assign dtype of lora to base model dtype #82

merged 1 commit into from
Nov 29, 2023

Conversation

tgaddair
Copy link
Contributor

Fixes #74.

When the model is quantized, the dtype of the weights (compressed) is typically uint or similar. This means if we cast the lora weights to the weight of the parent layer, it will corrupt them, rendering the output garbage. Instead, we should assign the dtype of the base model (float16 or bloat16) to the lora weights, which is consistent with how inference in QLoRA is done outside LoRAX (quantized weights + unquantized lora).

Copy link
Contributor

@geoffreyangus geoffreyangus left a comment

Choose a reason for hiding this comment

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

wow, nice catch!

@tgaddair tgaddair merged commit f1b9778 into main Nov 29, 2023
1 check passed
@tgaddair tgaddair deleted the fix-quant branch November 29, 2023 20:26
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.

Quantized models fail to generate expected output
2 participants