Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/mistral_inference/lora.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ def ignore_missing_keys(m: nn.Module, incompatible_keys: NamedTuple) -> None:
self.register_load_state_dict_post_hook(ignore_missing_keys)

def forward(self, x: torch.Tensor) -> torch.Tensor:
lora = self.lora_B(self.lora_A(x))
result: torch.Tensor = self.linear(x) + lora * self.scaling
lora_A_result = self.lora_A(x)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you check if its working ?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I verified the changes and confirmed that the functionality is working as expected.

lora = self.lora_B(lora_A_result)
result = self.linear(x) + lora * self.scaling
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain this line

return result

def _load_from_state_dict(self, state_dict: Dict[str, Any], prefix: str, *args, **kwargs) -> None: # type: ignore[no-untyped-def]
Expand Down