Skip to content

Peft LoRA Attention Masking #6919

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

You must be logged in to vote

I don't think I have the full picture yet, but this is what I get: The idea is to supply a mask with the same shape as the LoRA adapter's output (and hence as the underlying base layer's output), which is simply multiplied element-wise to the output at the very end of forward.

Supplying such a mask is currently not supported by PEFT. To support this, I could imagine:

  1. Add an extra argument to PEFT layers to provide such a mask, which is then multiplied to the output before returning from forward. I'm not a huge fan since this is very specific to this use case.
  2. Add a new attention processor wrapper class to diffusers that wraps the LoRA layer and applies the mask. This would require to pas…

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@sayakpaul
Comment options

@cjfcsjt
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

asomoza
Feb 9, 2024
Maintainer Author

You must be logged in to vote
2 replies
@BenjaminBossan
Comment options

Answer selected by asomoza
@asomoza
Comment options

asomoza Feb 12, 2024
Maintainer Author

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