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

Cannot implement LoRA on a custom model containing transformer encoder from pytorch #161

Open
wsuSaiman opened this issue Mar 5, 2024 · 0 comments

Comments

@wsuSaiman
Copy link

I am using LoRA for my custom model. Within the model i have trasnformer encoder block and a series of linear layers. I want to implement LoRA in the custom model specifically targeting the q,k and v projection weights on the self attention block. However, in the transformer encoder layer in pytorch, I cannot find any module names corresponding to the q, k and v projection.

class CustomModel(nn.Module):
   def __init__():
      self.embedding = nn.Linear(100,512)
      self.encoder_layer_1 = nn.TransformerEncoderLayer(d_model=self.model_dim, nhead=16)
      self.transformers_1 = torch.nn.TransformerEncoder(self.encoder_layer_1 , num_layers = 24)
      self.output = nn.Linear(200 * 512,200)

     def forward():

The code above represents the architecture of my custom model.

Has anybody implemented LoRA on the nn.Transformer on the q,k and v projection weights before? If yes, what is the module name for those weights?

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

No branches or pull requests

1 participant