get_lora_param_count - Tinker Documentation

tinker_cookbook.hyperparam_utils.get_lora_param_count

tinker_cookbook.hyperparam_utils.get_lora_param_count( model_name, lora_rank, train_mlp, train_attn, train_unembed)

Get the number of parameters in the LoRA adapter.

Mirrors the signature of ServiceClient.create_lora_training_client: the returned count reflects exactly which submodules will be adapted.

Parameters:

Returns: Total trainable parameter count. Notes: For MoE expert layers, Tinker uses a shared-outer LoRA scheme: the LoRA factor connected to the model hidden dimension is shared across experts, while the other factor remains expert-specific. This reduces LoRA parameter count and optimizer state while preserving per-expert adaptation. The parameter count returned by this function reflects this sharing.