Skip to content

Commit

Permalink
Un-ignore ruff W605; autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed Feb 7, 2024
1 parent 6785380 commit 244ce10
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ ignore = [
"E501", # Line length (handled by ruff-format)
"E741", # Ambiguous variable name
"UP007", # X | Y style Unions
"W605", # Invalid escape sequence
]

[tool.ruff.lint.isort]
Expand Down
2 changes: 1 addition & 1 deletion src/peft/tuners/loha/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def _create_and_replace(

# Regexp matching - Find key which matches current target_name in patterns provided
pattern_keys = list(chain(config.rank_pattern.keys(), config.alpha_pattern.keys()))
target_name_key = next(filter(lambda key: re.match(f"(.*\.)?{key}$", current_key), pattern_keys), target_name)
target_name_key = next(filter(lambda key: re.match(rf"(.*\.)?{key}$", current_key), pattern_keys), target_name)

kwargs = config.to_dict()
kwargs["r"] = config.rank_pattern.get(target_name_key, config.r)
Expand Down
2 changes: 1 addition & 1 deletion src/peft/tuners/lokr/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _create_and_replace(

# Regexp matching - Find key which matches current target_name in patterns provided
pattern_keys = list(chain(config.rank_pattern.keys(), config.alpha_pattern.keys()))
target_name_key = next(filter(lambda key: re.match(f"(.*\.)?{key}$", current_key), pattern_keys), target_name)
target_name_key = next(filter(lambda key: re.match(rf"(.*\.)?{key}$", current_key), pattern_keys), target_name)

kwargs = config.to_dict()
kwargs["r"] = config.rank_pattern.get(target_name_key, config.r)
Expand Down
2 changes: 1 addition & 1 deletion src/peft/tuners/lora/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def _create_and_replace(

# Regexp matching - Find key which matches current target_name in patterns provided
pattern_keys = list(chain(lora_config.rank_pattern.keys(), lora_config.alpha_pattern.keys()))
target_name_key = next(filter(lambda key: re.match(f".*\.{key}$", current_key), pattern_keys), current_key)
target_name_key = next(filter(lambda key: re.match(rf".*\.{key}$", current_key), pattern_keys), current_key)
r = lora_config.rank_pattern.get(target_name_key, lora_config.r)
alpha = lora_config.alpha_pattern.get(target_name_key, lora_config.lora_alpha)

Expand Down
2 changes: 1 addition & 1 deletion src/peft/tuners/oft/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def _create_and_replace(

# Regexp matching - Find key which matches current target_name in patterns provided
pattern_keys = list(config.rank_pattern.keys())
target_name_key = next(filter(lambda key: re.match(f"(.*\.)?{key}$", current_key), pattern_keys), target_name)
target_name_key = next(filter(lambda key: re.match(rf"(.*\.)?{key}$", current_key), pattern_keys), target_name)

kwargs = config.to_dict()
kwargs["r"] = config.rank_pattern.get(target_name_key, config.r)
Expand Down

0 comments on commit 244ce10

Please sign in to comment.