MCPcopy Index your code
hub / github.com/FireRedTeam/FireRedASR / count_model_parameters

Function count_model_parameters

fireredasr/utils/param.py:6–13  ·  view source on GitHub ↗
(model)

Source from the content-addressed store, hash-verified

4
5
6def count_model_parameters(model):
7 if not isinstance(model, torch.nn.Module):
8 return 0, 0
9 name = f"{model.__class__.__name__} {model.__class__}"
10 num = sum(p.numel() for p in model.parameters() if p.requires_grad)
11 size = num * 4.0 / 1024.0 / 1024.0 # float32, MB
12 logging.info(f"#param of {name} is {num} = {size:.1f} MB (float32)")
13 return num, size

Callers 1

from_argsMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected