mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-08-29 09:56:24 +08:00
count bias too
This commit is contained in:
parent
46109e4141
commit
4345c7c8bb
@ -250,8 +250,9 @@ def remove_lora_layers(model: nn.Module) -> nn.Module:
|
|||||||
|
|
||||||
|
|
||||||
def nparams(module):
|
def nparams(module):
|
||||||
if isinstance(module, (nn.QuantizedLinear, nn.QuantizedEmbedding)):
|
if hasattr(module, "bits"):
|
||||||
return module.weight.size * 32 // module.bits
|
n = 0 if not hasattr(module, "bias") else module.bias.size
|
||||||
|
return n + module.weight.size * 32 // module.bits
|
||||||
return sum(v.size for _, v in tree_flatten(module.parameters()))
|
return sum(v.size for _, v in tree_flatten(module.parameters()))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user