MCPcopy Create free account
hub / github.com/Standard-Intelligence/hertz-dev / param_count

Function param_count

utils/interp.py:31–42  ·  view source on GitHub ↗
(module)

Source from the content-addressed store, hash-verified

29 print_colored(*args, **kwargs)
30
31def param_count(module):
32 def count_parameters(model):
33 return sum(p.numel() for p in model.parameters() if p.requires_grad)
34
35 total_params = count_parameters(module)
36 output = [f'Total model parameters: {total_params:,}', '---------------------------']
37
38 for name, child in module.named_children():
39 params = count_parameters(child)
40 output.append(f'{name} parameters: {params:,}')
41
42 return '\n'.join(output)
43
44def model_size_estimation(module):
45 def estimate_size(model):

Callers

nothing calls this directly

Calls 1

count_parametersFunction · 0.85

Tested by

no test coverage detected