Skip to content

Add KaSA implementation to layer.py #2543

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

nsbg
Copy link

@nsbg nsbg commented May 17, 2025

cc @BenjaminBossan

I've added KaSA implementation part to layer.py by referring to the existing KaSA code. This is a very early draft of the PR, and there's a chance I misunderstood something, so a lot might need to be revised/added.

I'm not entirely sure what the sentence "For the PEFT integration, the new LoRA variant pattern introduced in #2443 should be leveraged (i.e. use a similar approach to extend vanilla LoRA as is used for DoRA)" - from #2516 - means exactly. If you could provide some guidance on this part, it would be really helpful for me.

I'm open to any kind of feedback!

@BenjaminBossan
Copy link
Member

Thanks @nsbg for working on KaSA. Sorry for the late reply, I was out of office.

Regarding the implementation, I don't think this works correctly yet, as your code only updates the base weight and it also does it unconditionally, when we want users to be able to enable/disable KaSA.

The proper way to implement this is:

  1. Add a new argument to LoraConfig called use_kasa (False by default).
  2. Extend the LoRA variant resolution to include use_kasa.
  3. Implement a KasaVariant similar to the existing DoraVariant. To see what changes are needed, search for the string diag in the existing KaSA code and port it over to the variant.

Later, we'll also need docs and tests, but this can wait until the implementation is done.

@nsbg
Copy link
Author

nsbg commented Jun 3, 2025

Thank you for your review. I'll include your feedback in the next step.

Copy link

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.

@BenjaminBossan
Copy link
Member

@nsbg No hurry, just asking if you still intend on working on this.

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