Closed ltoniazzi closed 1 month ago
Thanks for opening this issue. Yes, I agree that this is an easy source of errors, and having a warning would help.
The main reason why this is not implemented yet is that merging is a layer-level operation in PEFT. The individual layer can, however, not know if its weights are tied are not. Therefore, we cannot easily check for this. It could be possible to refactor this to work differently but I don't see an easy way.
We could still try to make an educated guess based on model.config.tie_word_embeddings
and the actual target_modules
and that should help most users who face this situation. If you are interested in working on this, feel free to create a PR. Otherwise, I'll put this on the backlog and work on this when I have a bit of time on my hands.
Make the B matrix non-zero
This can also be achieved by passing init_lora_weights=False
to the LoraConfig
:)
If you are interested in working on this, feel free to create a PR.
Yes sure, happy to have a go at it later this week!
Fantastic, thanks. Don't hesitate to ask me if something is unclear, or to create a draft PR for early feedback.
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Resolved via #2025.
System Info
peft=0.12.0
transformers =4.44.0
Who can help?
No response
Information
Tasks
examples
folderReproduction
With Gemma2, a model where
tie_word_embeddings = True
, usingtarget_modules=["lm_head"]
and merging the adapter leads to merging the adapter to the tied/embedding layer, which is incorrect.Expected behavior
I think that merging should not succeed silently, but either a:
Related issues