From fceca3fd8b94ce3105e18007c7d330f826ff23ca Mon Sep 17 00:00:00 2001 From: markus583 Date: Sun, 16 Jun 2024 13:26:05 +0000 Subject: [PATCH] noqa --- .github/workflows/python.yml | 2 +- adapters/tests/test_encoder_decoder.py | 2 +- wtpsplit/__init__.py | 2 +- wtpsplit/data_acquisition/extract_all_data.py | 2 +- wtpsplit/evaluation/intrinsic_ted.py | 2 +- wtpsplit/evaluation/llm_sentence.py | 2 +- wtpsplit/utils.py | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index e9f65718..11f1f4a2 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -25,7 +25,7 @@ jobs: - name: Lint with ruff run: | # stop the build if there are Python syntax errors or undefined names - ruff --output-format=github --select=E9,F63,F7,F82 --ignore=E722 --target-version=py37 . + ruff --output-format=github --select=E9,F63,F7,F82 --target-version=py37 . # default set of ruff rules with GitHub Annotations ruff --output-format=github --target-version=py37 . - name: Test with pytest diff --git a/adapters/tests/test_encoder_decoder.py b/adapters/tests/test_encoder_decoder.py index 708a6bfb..46a3e20c 100644 --- a/adapters/tests/test_encoder_decoder.py +++ b/adapters/tests/test_encoder_decoder.py @@ -4,7 +4,7 @@ import adapters from hf_transformers.tests.models.encoder_decoder.test_modeling_encoder_decoder import * # Imported to execute model tests from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, BertConfig -from transformers.testing_utils import require_torch, torch_device +from transformers.testing_utils import require_torch from .methods import ( BottleneckAdapterTestMixin, diff --git a/wtpsplit/__init__.py b/wtpsplit/__init__.py index 9a4307fe..c3a268bb 100644 --- a/wtpsplit/__init__.py +++ b/wtpsplit/__init__.py @@ -512,7 +512,7 @@ def __init__( # merge lora weights into transformer for 0 efficiency overhead self.model.model.merge_adapter("sat-lora") self.use_lora = True - except: + except: # noqa if lora_path: print(f"LoRA at {lora_path} not found, using base model...") else: diff --git a/wtpsplit/data_acquisition/extract_all_data.py b/wtpsplit/data_acquisition/extract_all_data.py index 68a923bf..b8a867b9 100644 --- a/wtpsplit/data_acquisition/extract_all_data.py +++ b/wtpsplit/data_acquisition/extract_all_data.py @@ -93,7 +93,7 @@ def corrupt_asr(sentences, lang): try: tokenizer = MosesTokenizer(lang) - except: + except: # noqa corrupted_sentences = [ preprocess_sentence("".join([char for char in sentence if char not in punct_chars]).lower()) for sentence in sentences diff --git a/wtpsplit/evaluation/intrinsic_ted.py b/wtpsplit/evaluation/intrinsic_ted.py index 8ada2671..2853d3c4 100644 --- a/wtpsplit/evaluation/intrinsic_ted.py +++ b/wtpsplit/evaluation/intrinsic_ted.py @@ -261,7 +261,7 @@ def main(args): ): try: model_path = os.path.join(args.model_path, os.listdir(args.model_path)[0], "en") - except: + except: # noqa model_path = args.model_path print(model_path) else: diff --git a/wtpsplit/evaluation/llm_sentence.py b/wtpsplit/evaluation/llm_sentence.py index 28468707..64f9cbe0 100644 --- a/wtpsplit/evaluation/llm_sentence.py +++ b/wtpsplit/evaluation/llm_sentence.py @@ -425,7 +425,7 @@ def align_llm_output(row): ) # same as aligned_in, aligned_llm, but with additional formatting. Latter used to debug only. formatted_alignment = alignment._format_alignment(aligned_in, aligned_llm).split("\n") - except: # ruff: ignore=E722 + except: # noqa print("Alignment failed: ", row.name) formatted_alignment = [row["test_chunks"], "", " " * len(row["test_chunks"])] return pd.Series( diff --git a/wtpsplit/utils.py b/wtpsplit/utils.py index cfae534a..015730a7 100644 --- a/wtpsplit/utils.py +++ b/wtpsplit/utils.py @@ -229,7 +229,7 @@ def corrupt_asr(text: str, lang): corrupted_sentences = [ tokenizer.detokenize(corrupted_tokens).lower() for corrupted_tokens in corrupted_tokenized_sentences ] - except: + except: # noqa corrupted_sentences = [ "".join([char for char in sentence if char not in Constants.PUNCTUATION_CHARS]).lower() for sentence in sentences