Small cleanups related to LoRA weight loading (#13474)
This commit is contained in:
@@ -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]:
|
||||
|
||||
Reference in New Issue
Block a user