MCPcopy Create free account
hub / github.com/cli99/llm-analysis / get_num_params_per_layer_mlp

Method get_num_params_per_layer_mlp

llm_analysis/analysis.py:278–285  ·  view source on GitHub ↗

Get the number of parameters in the MLP linear layers, including the intermediate and output matrices. Returns: int: the number of parameters in the two MLP linear layers

(self)

Source from the content-addressed store, hash-verified

276 self.model_config.n_head)
277
278 def get_num_params_per_layer_mlp(self) -> int:
279 """Get the number of parameters in the MLP linear layers, including the
280 intermediate and output matrices.
281
282 Returns:
283 int: the number of parameters in the two MLP linear layers
284 """
285 return 2 * self.model_config.hidden_dim * self.model_config.ffn_embed_dim * self.model_config.moe_num_experts
286
287 def get_num_params_per_layer_router(self) -> int:
288 if self.model_config.moe_num_experts > 1:

Calls

no outgoing calls

Tested by

no test coverage detected