mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-08-29 01:46:09 +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):
|
||||
if isinstance(module, (nn.QuantizedLinear, nn.QuantizedEmbedding)):
|
||||
return module.weight.size * 32 // module.bits
|
||||
if hasattr(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()))
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user