Skip to content

Commit

Permalink
[docs] Docstring typo (huggingface#1455)
Browse files Browse the repository at this point in the history
* fix typo

* fix
  • Loading branch information
stevhliu authored and BenjaminBossan committed Mar 14, 2024
1 parent 1d76114 commit 4e325e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/peft/tuners/lora/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
_get_submodules,
get_quantization_config,
)
from peft.utils.merge_utils import dare_linear, dare_ties, task_arthimetic, ties
from peft.utils.merge_utils import dare_linear, dare_ties, task_arithmetic, ties

from .config import LoraConfig
from .gptq import dispatch_gptq
Expand Down Expand Up @@ -558,7 +558,7 @@ def _svd_generalized_task_arithmetic_weighted_adapter(
delta_weight = [target.get_delta_weight(adapter) for adapter in valid_adapters]
valid_weights = torch.tensor(valid_weights).to(delta_weight[0].device)
if combination_type == "svd":
delta_weight = task_arthimetic(delta_weight, valid_weights)
delta_weight = task_arithmetic(delta_weight, valid_weights)
elif combination_type == "ties_svd":
delta_weight = ties(delta_weight, valid_weights, density, majority_sign_method)
elif combination_type == "dare_linear_svd":
Expand Down Expand Up @@ -625,7 +625,7 @@ def _generalized_task_arithmetic_weighted_adapter(
dtype = lora_A_deltas[0].dtype
for i, task_tensors in enumerate(lora_deltas):
if combination_type == "linear":
lora_deltas[i] = task_arthimetic(task_tensors, valid_weights)
lora_deltas[i] = task_arithmetic(task_tensors, valid_weights)
elif combination_type == "ties":
lora_deltas[i] = ties(task_tensors, valid_weights, density, majority_sign_method)
elif combination_type == "dare_linear":
Expand Down
4 changes: 2 additions & 2 deletions src/peft/utils/merge_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ def disjoint_merge(task_tensors: torch.Tensor, majority_sign_mask: torch.Tensor)
return mixed_task_tensors / torch.clamp(num_params_preserved, min=1.0)


def task_arthimetic(task_tensors: List[torch.Tensor], weights: torch.Tensor) -> torch.Tensor:
def task_arithmetic(task_tensors: List[torch.Tensor], weights: torch.Tensor) -> torch.Tensor:
"""
Merge the task tensors using `task arthimetic`.
Merge the task tensors using `task arithmetic`.
Args:
task_tensors(`List[torch.Tensor]`):The task tensors to merge.
Expand Down

0 comments on commit 4e325e6

Please sign in to comment.