fix: use staticmethod istead of classmethod
Browse files- modeling_lora.py +4 -4
modeling_lora.py
CHANGED
|
@@ -196,13 +196,13 @@ class LoRAParametrization(nn.Module):
|
|
| 196 |
),
|
| 197 |
)
|
| 198 |
|
| 199 |
-
@
|
| 200 |
-
def select_task_for_layer(
|
| 201 |
if isinstance(layer, LoRAParametrization):
|
| 202 |
layer.current_task = task_idx
|
| 203 |
|
| 204 |
-
@
|
| 205 |
-
def merge_lora_into_layer(
|
| 206 |
if hasattr(layer, "parametrizations"):
|
| 207 |
for attr_name in layer.parametrizations.keys():
|
| 208 |
parametrize.remove_parametrizations(layer, attr_name, leave_parametrized=True)
|
|
|
|
| 196 |
),
|
| 197 |
)
|
| 198 |
|
| 199 |
+
@staticmethod
|
| 200 |
+
def select_task_for_layer(layer: nn.Module, task_idx: Optional[int] = None):
|
| 201 |
if isinstance(layer, LoRAParametrization):
|
| 202 |
layer.current_task = task_idx
|
| 203 |
|
| 204 |
+
@staticmethod
|
| 205 |
+
def merge_lora_into_layer(layer: nn.Module):
|
| 206 |
if hasattr(layer, "parametrizations"):
|
| 207 |
for attr_name in layer.parametrizations.keys():
|
| 208 |
parametrize.remove_parametrizations(layer, attr_name, leave_parametrized=True)
|