lora_llama3_2_1b¶
- torchtune.models.llama3_2.lora_llama3_2_1b(lora_attn_modules: List[Literal['q_proj', 'k_proj', 'v_proj', 'output_proj']], apply_lora_to_mlp: bool = False, apply_lora_to_output: bool = False, lora_rank: int = 8, lora_alpha: float = 16, lora_dropout: float = 0.0, use_dora: bool = False, quantize_base: bool = False) TransformerDecoder [source]¶
Builder for creating a Llama3.2 1B model with LoRA enabled. The Llama3.2 defaults are the same as in
llama3_2_1b()
, while LoRA default params are based on https://github.com/tloen/alpaca-lora/blob/8bb8579e403dc78e37fe81ffbb253c413007323f/finetune.py#L41-L43.- Parameters:
lora_attn_modules (List[LORA_ATTN_MODULES]) – list of which linear layers LoRA should be applied to in each self-attention block. Options are
{"q_proj", "k_proj", "v_proj", "output_proj"}
.apply_lora_to_mlp (bool) – whether to apply LoRA to the MLP in each transformer layer. Default: False
apply_lora_to_output (bool) – whether to apply LoRA to the model’s final output projection. Default: False
lora_rank (int) – rank of each low-rank approximation
lora_alpha (float) – scaling factor for the low-rank approximation
lora_dropout (float) – dropout probability for the low-rank approximation
use_dora (bool) – Decompose the LoRA weight into magnitude and direction, as introduced in “DoRA: Weight-Decomposed Low-Rank Adaptation” (https://arxiv.org/abs/2402.09353).
quantize_base (bool) – Whether to quantize base model weights
- Returns:
Instantiation of Llama3.2 1B model with LoRA applied
- Return type: