-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test to make sure LoRA layer can be implemented and used in a full training pipeline. Problem encountered Hitting `KeyError: 'gradient_lora1.b.consteval_graph.output'` when implementing LoRA layer with nn.Parameters. ``` class LoraLayer(nn.Module): def __init__(self, input_size, output_size, rank=8, alpha=4, dtype=torch.float32): super(LoraLayer, self).__init__() self.a = nn.Parameter(torch.empty(input_size, rank, dtype=dtype), requires_grad=True) self.b = nn.Parameter(torch.zeros(rank, output_size, dtype=dtype), requires_grad=True) self.alpha = alpha / rank nn.init.normal_(self.a, mean=0, std=1) def forward(self, x): return self.alpha * (x @ self.a @ self.b) ``` Raised issue: #929
- Loading branch information
1 parent
9fd58b4
commit c00cc94
Showing
2 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters