Skip to content

tinker_cookbook.hyperparam_utils.get_lora_param_count

tinker_cookbook.hyperparam_utils.get_lora_param_count(model_name, lora_rank, detailed, include_experts, shared_expert_outer_loras)

Get the number of parameters in the LoRA adapter.

Parameters:

  • model_name (str) – HuggingFace model identifier.
  • lora_rank (int) – Rank of the LoRA decomposition.
  • detailed (bool) – If True, return a dict with expert/non-expert/total breakdowns.
  • include_experts (bool) – Whether to include MoE expert layers in the count.
  • shared_expert_outer_loras (bool) – If True, count shared outer dimensions only once across experts (reflects actual parameter sharing).

Returns: Total parameter count as an int, or a detailed breakdown dict if detailed is True.