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

Allow the entire model to be targed for LoRA and DoRA fine tuning: LoRA and DoRA embeddings with small DoRALinear bug fix #914

Merged
merged 10 commits into from
Aug 16, 2024

Conversation

zaithottakath
Copy link
Contributor

@zaithottakath zaithottakath commented Jul 25, 2024

  • Added in LoRAEmbedding and DoRAEmbedding with tests so that embeddings can be targeted for fine tuning.
  • Added in the ability to target all Linear and Embedding modules regardless of if they are in model.layers allowing both the embeddings and the lm_head to be targeted for fine tuning, allowing a nearly full LoRA or DoRA fine tune of the model.
  • Fixed a bug with DoRALinear that sets the wrong self.m value due to it not being recalculated when the Linear layer is changed in DoRALinear.from_linear

I checked huggingface's PEFT library for how they handle DoRA for embeddings and there is still an open ticket for it. I wasn't able to find any reference implementations, so this could be the first example of that.

@zaithottakath zaithottakath force-pushed the feat-lora-embeddings branch from 7c81ec0 to 0f11d20 Compare July 25, 2024 22:42
@zaithottakath zaithottakath requested a review from awni August 3, 2024 21:15
@zaithottakath zaithottakath requested a review from awni August 6, 2024 00:58
@@ -25,10 +25,10 @@ def from_linear(
dropout=dropout,
scale=scale,
)
dora_lin.linear = linear
dora_lin.set_linear(linear)
Copy link
Member

Choose a reason for hiding this comment

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

Good catch with that bug!

Copy link
Member

@awni awni left a comment

Choose a reason for hiding this comment

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

Very nice addition, thanks!

@awni awni merged commit 4e01700 into ml-explore:main Aug 16, 2024
4 checks passed
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