mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-06-25 01:41:19 +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))
|
self.lora_b = mx.zeros(shape=(lora_rank, output_dims))
|
||||||
|
|
||||||
def __call__(self, x):
|
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
|
z = (x @ self.lora_a) @ self.lora_b
|
||||||
return y + 2.0 * z
|
return y + 2.0 * z
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user