MCPcopy Create free account
hub / github.com/OpenBMB/AgentCPM-GUI / get_parameter_number

Function get_parameter_number

sft/finetune.py:160–172  ·  view source on GitHub ↗
(model)

Source from the content-addressed store, hash-verified

158 return transform
159
160def get_parameter_number(model):
161 trainable_params, all_param = 0, 0
162 for param in model.parameters():
163 num_params = param.numel()
164 # if using DS Zero 3 and the weights are initialized empty
165 if num_params == 0 and hasattr(param, "ds_numel"):
166 num_params = param.ds_numel
167
168 all_param += num_params
169 if param.requires_grad:
170 trainable_params += num_params
171
172 return {'Total': all_param, 'Trainable': trainable_params}
173
174
175local_rank = 0

Callers 1

trainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected