Skip to content

Commit

Permalink
support layer replication for peft and fix rslora integration (axolot…
Browse files Browse the repository at this point in the history
  • Loading branch information
winglian authored Mar 27, 2024
1 parent da265dd commit 25afd35
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/axolotl/utils/config/models/input/v0_4_1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
import os
from enum import Enum
from typing import Any, Dict, List, Literal, Optional, Union
from typing import Any, Dict, List, Literal, Optional, Tuple, Union

from pydantic import BaseModel, Field, conlist, field_validator, model_validator
from transformers import SchedulerType
Expand Down Expand Up @@ -179,7 +179,8 @@ class LoraConfig(BaseModel):
peft_layers_to_transform: Optional[List[int]] = None
peft: Optional[PeftConfig] = None
peft_use_dora: Optional[bool] = None
peft_use_relora: Optional[bool] = None
peft_use_rslora: Optional[bool] = None
peft_layer_replication: Optional[List[Tuple[int, int]]] = None

lora_on_cpu: Optional[bool] = None
gptq: Optional[bool] = None
Expand Down
4 changes: 3 additions & 1 deletion src/axolotl/utils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,9 @@ def load_lora(model, cfg, inference=False, config_only=False):
if cfg.peft_use_dora:
lora_config_kwargs["use_dora"] = cfg.peft_use_dora
if cfg.peft_use_rslora:
lora_config_kwargs["use_rslora"] = cfg.use_rslora
lora_config_kwargs["use_rslora"] = cfg.peft_use_rslora
if cfg.peft_layer_replication:
lora_config_kwargs["peft_layer_replication"] = cfg.peft_layer_replication

lora_config = LoraConfig(
r=cfg.lora_r,
Expand Down

0 comments on commit 25afd35

Please sign in to comment.