Args: format_name: The LoRA format type up_suffix: Suffix for the up (B) weight matrix (e.g., ".lora_up.weight") down_suffix: Suffix for the down (A) weight matrix (e.g., ".lora_down.weight") has_weight_suffix: Whether the format includes .wei
(
self,
format_name: LoRAFormat,
up_suffix: str,
down_suffix: str,
has_weight_suffix: bool = True,
mid_suffix: Optional[str] = None,
)
| 35 | """Defines a single LoRA format pattern and how to extract its components.""" |
| 36 | |
| 37 | def __init__( |
| 38 | self, |
| 39 | format_name: LoRAFormat, |
| 40 | up_suffix: str, |
| 41 | down_suffix: str, |
| 42 | has_weight_suffix: bool = True, |
| 43 | mid_suffix: Optional[str] = None, |
| 44 | ): |
| 45 | """ |
| 46 | Args: |
| 47 | format_name: The LoRA format type |
| 48 | up_suffix: Suffix for the up (B) weight matrix (e.g., ".lora_up.weight") |
| 49 | down_suffix: Suffix for the down (A) weight matrix (e.g., ".lora_down.weight") |
| 50 | has_weight_suffix: Whether the format includes .weight suffix |
| 51 | mid_suffix: Optional suffix for mid weight (only used in standard format) |
| 52 | """ |
| 53 | self.format_name = format_name |
| 54 | self.up_suffix = up_suffix |
| 55 | self.down_suffix = down_suffix |
| 56 | self.has_weight_suffix = has_weight_suffix |
| 57 | self.mid_suffix = mid_suffix |
| 58 | |
| 59 | def get_base_key(self, key: str, detected_suffix: str) -> Optional[str]: |
| 60 | """Extract base key by removing the detected suffix.""" |
nothing calls this directly
no outgoing calls
no test coverage detected