mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-06-24 17:31:18 +08:00
keep base weights in fp16
This commit is contained in:
parent
84f02ef58b
commit
8c8f9d6440
@ -47,7 +47,7 @@ class LoRALinear(nn.Module):
|
||||
self.lora_b = mx.zeros(shape=(lora_rank, output_dims))
|
||||
|
||||
def __call__(self, x):
|
||||
y = self.linear(x.astype(self.linear.weight.dtype)).astype(x.dtype)
|
||||
y = self.linear(x.astype(self.linear.weight.dtype))
|
||||
z = (x @ self.lora_a) @ self.lora_b
|
||||
return y + 2.0 * z
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user