Skip to content

LoRA tuning embedding layer uses nn.Parameter instead of nn.Linear #2040

Closed Answered by BenjaminBossan
Wangmerlyn asked this question in Q&A
Discussion options

You must be logged in to vote

Very good question. Your observation is correct and I'm pretty sure that the only reason is that this is how the reference implementation by Microsoft did it:

https://github.com/microsoft/LoRA/blob/4c0333854cb905966f8cc4e9a74068c1e507c7b7/loralib/layers.py#L32

(I wasn't involved with PEFT back then so I cannot know for sure)

Personally, I think it would be better if the embedding implementation were the same as the linear implementation and I also don't like that we have self.lora_A/B and self.lora_embedding_A/B, as only ever one of the two is used, meaning we could get rid of self.lora_embedding_A/B.

Making these changes now would require very careful consideration to avoid breaking exis…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@Wangmerlyn
Comment options

@BenjaminBossan
Comment options

@Wangmerlyn
Comment options

@BenjaminBossan
Comment options

Answer selected by Wangmerlyn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants