Small cleanups related to LoRA weight loading (#13474)

This commit is contained in:
Glen Liu
2025-11-18 12:14:34 -05:00
committed by GitHub
parent 6e9b154981
commit d79e12941c
3 changed files with 4 additions and 20 deletions

View File

@@ -1,4 +1,3 @@
import re
from dataclasses import dataclass
from enum import Enum
from typing import Iterable, Optional, Set, Tuple
@@ -46,16 +45,6 @@ class LoRAType(Enum):
LORA_B = 1
def get_layer_id(name: str) -> int:
"""
Extract integer id of layer from its name in string.
"""
match = re.search(r"layers\.(\d+)\.", name)
if match is None:
return None
return int(match.group(1))
def get_hidden_dim(
module_name: str, config: AutoConfig, base_model: torch.nn.Module, layer_idx: int
) -> Tuple[int]: