From 274e79b3262147e52968480bb0f03f4893559ab2 Mon Sep 17 00:00:00 2001 From: omahs <73983677+omahs@users.noreply.github.com> Date: Tue, 6 May 2025 15:45:20 +0200 Subject: [PATCH] Fix typos (#37978) fix typos --- docs/source/en/attention_interface.md | 2 +- docs/source/it/perf_train_cpu.md | 2 +- src/transformers/models/moshi/modeling_moshi.py | 4 ++-- src/transformers/models/rag/modeling_rag.py | 10 +++++----- .../models/seamless_m4t/modeling_seamless_m4t.py | 6 +++--- .../models/seamless_m4t_v2/modeling_seamless_m4t_v2.py | 6 +++--- tests/models/colpali/test_modeling_colpali.py | 2 +- tests/models/deepseek_v3/test_modeling_deepseek_v3.py | 4 ++-- tests/models/marian/test_tokenization_marian.py | 2 +- tests/models/opt/test_modeling_flax_opt.py | 4 ++-- tests/models/paligemma/test_modeling_paligemma.py | 2 +- tests/models/paligemma2/test_modeling_paligemma2.py | 2 +- utils/check_copies.py | 4 ++-- 13 files changed, 25 insertions(+), 25 deletions(-) diff --git a/docs/source/en/attention_interface.md b/docs/source/en/attention_interface.md index 054a0e47131..2afb9222875 100644 --- a/docs/source/en/attention_interface.md +++ b/docs/source/en/attention_interface.md @@ -108,7 +108,7 @@ If in doubt about what args/kwargs a given model sends to the attention function ## Accessing current available implementations Most of the time, you will simply need to `register` a new function. If, however, you need to access an existing one, -and/or perform a few checks, the prefered way is to use the global `ALL_ATTENTION_FUNCTIONS`. It behaves the same way you +and/or perform a few checks, the preferred way is to use the global `ALL_ATTENTION_FUNCTIONS`. It behaves the same way you would expect from a usual Python dictionary: ```python diff --git a/docs/source/it/perf_train_cpu.md b/docs/source/it/perf_train_cpu.md index ff71d10d5c9..25ee63997b5 100644 --- a/docs/source/it/perf_train_cpu.md +++ b/docs/source/it/perf_train_cpu.md @@ -19,7 +19,7 @@ Questa guida si concentra su come addestrare in maniera efficiente grandi modell ## Mixed precision con IPEX -IPEX è ottimizzato per CPU con AVX-512 o superiore, e funziona per le CPU con solo AVX2. Pertanto, si prevede che le prestazioni saranno più vantaggiose per le le CPU Intel con AVX-512 o superiori, mentre le CPU con solo AVX2 (ad esempio, le CPU AMD o le CPU Intel più vecchie) potrebbero ottenere prestazioni migliori con IPEX, ma non sono garantite. IPEX offre ottimizzazioni delle prestazioni per l'addestramento della CPU sia con Float32 che con BFloat16. L'uso di BFloat16 è l'argomento principale delle seguenti sezioni. +IPEX è ottimizzato per CPU con AVX-512 o superiore, e funziona per le CPU con solo AVX2. Pertanto, si prevede che le prestazioni saranno più vantaggiose per le CPU Intel con AVX-512 o superiori, mentre le CPU con solo AVX2 (ad esempio, le CPU AMD o le CPU Intel più vecchie) potrebbero ottenere prestazioni migliori con IPEX, ma non sono garantite. IPEX offre ottimizzazioni delle prestazioni per l'addestramento della CPU sia con Float32 che con BFloat16. L'uso di BFloat16 è l'argomento principale delle seguenti sezioni. Il tipo di dati a bassa precisione BFloat16 è stato supportato in modo nativo su 3rd Generation Xeon® Scalable Processors (aka Cooper Lake) con AVX512 e sarà supportata dalla prossima generazione di Intel® Xeon® Scalable Processors con Intel® Advanced Matrix Extensions (Intel® AMX) instruction set con prestazioni ulteriormente migliorate. L'Auto Mixed Precision per il backende della CPU è stato abilitato da PyTorch-1.10. allo stesso tempo, il supporto di Auto Mixed Precision con BFloat16 per CPU e l'ottimizzazione degli operatori BFloat16 è stata abilitata in modo massiccio in Intel® Extension per PyTorch, and parzialmente aggiornato al branch master di PyTorch. Gli utenti possono ottenere prestazioni migliori ed users experience con IPEX Auto Mixed Precision.. diff --git a/src/transformers/models/moshi/modeling_moshi.py b/src/transformers/models/moshi/modeling_moshi.py index a7387004a6e..ea436706348 100644 --- a/src/transformers/models/moshi/modeling_moshi.py +++ b/src/transformers/models/moshi/modeling_moshi.py @@ -2277,7 +2277,7 @@ class MoshiForConditionalGeneration(MoshiPreTrainedModel, GenerationMixin): generation_config, kwargs = self._prepare_generation_config(kwargs.pop("generation_config", None), **kwargs) input_ids, user_audio_codes, moshi_audio_codes, concat_unconditional_inputs = ( - self._check_and_maybe_initalize_inputs( + self._check_and_maybe_initialize_inputs( input_ids=input_ids, user_input_values=user_input_values, user_audio_codes=user_audio_codes, @@ -2707,7 +2707,7 @@ class MoshiForConditionalGeneration(MoshiPreTrainedModel, GenerationMixin): attention_mask=attention_mask, ) - def _check_and_maybe_initalize_inputs( + def _check_and_maybe_initialize_inputs( self, input_ids=None, user_input_values=None, diff --git a/src/transformers/models/rag/modeling_rag.py b/src/transformers/models/rag/modeling_rag.py index 1adce9f7b06..e3b835492b9 100644 --- a/src/transformers/models/rag/modeling_rag.py +++ b/src/transformers/models/rag/modeling_rag.py @@ -593,8 +593,8 @@ class RagModel(RagPreTrainedModel): context_input_ids, context_attention_mask, retrieved_doc_embeds, - retrived_doc_input_ids, - retrived_doc_attention_mask, + retrieved_doc_input_ids, + retrieved_doc_attention_mask, retrieved_doc_ids, ) = ( retriever_outputs["context_input_ids"], @@ -608,10 +608,10 @@ class RagModel(RagPreTrainedModel): context_input_ids = context_input_ids.to(input_ids) context_attention_mask = context_attention_mask.to(input_ids) - retrived_doc_input_ids = retrived_doc_input_ids.to(input_ids) - retrived_doc_attention_mask = retrived_doc_attention_mask.to(input_ids) + retrieved_doc_input_ids = retrieved_doc_input_ids.to(input_ids) + retrieved_doc_attention_mask = retrieved_doc_attention_mask.to(input_ids) retrieved_doc_embeds = self.ctx_encoder( - retrived_doc_input_ids, attention_mask=retrived_doc_attention_mask, return_dict=True + retrieved_doc_input_ids, attention_mask=retrieved_doc_attention_mask, return_dict=True ).pooler_output retrieved_doc_embeds = retrieved_doc_embeds.view( -1, n_docs, question_encoder_last_hidden_state.shape[1] diff --git a/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py b/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py index d1eda956e07..d610bc66579 100755 --- a/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py +++ b/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py @@ -3391,7 +3391,7 @@ class SeamlessM4TForTextToSpeech(SeamlessM4TPreTrainedModel, GenerationMixin): `Union[SeamlessM4TGenerationOutput, Tuple[Tensor]]`: - If `return_intermediate_token_ids`, returns [`SeamlessM4TGenerationOutput`]. - If not `return_intermediate_token_ids`, returns a tuple composed of waveforms of shape `(batch_size, - sequence_length)`and and `waveform_lengths` which gives the length of each sample. + sequence_length)` and `waveform_lengths` which gives the length of each sample. """ batch_size = len(input_ids) if input_ids is not None else len(kwargs.get("inputs_embeds")) @@ -3721,7 +3721,7 @@ class SeamlessM4TForSpeechToSpeech(SeamlessM4TPreTrainedModel, GenerationMixin): `Union[SeamlessM4TGenerationOutput, Tuple[Tensor]]`: - If `return_intermediate_token_ids`, returns [`SeamlessM4TGenerationOutput`]. - If not `return_intermediate_token_ids`, returns a tuple composed of waveforms of shape `(batch_size, - sequence_length)`and and `waveform_lengths` which gives the length of each sample. + sequence_length)` and `waveform_lengths` which gives the length of each sample. """ batch_size = len(input_features) if input_features is not None else len(kwargs.get("inputs_embeds")) @@ -4132,7 +4132,7 @@ class SeamlessM4TModel(SeamlessM4TPreTrainedModel, GenerationMixin): `Union[SeamlessM4TGenerationOutput, Tuple[Tensor], ModelOutput]`: - If `generate_speech` and `return_intermediate_token_ids`, returns [`SeamlessM4TGenerationOutput`]. - If `generate_speech` and not `return_intermediate_token_ids`, returns a tuple composed of waveforms of - shape `(batch_size, sequence_length)`and and `waveform_lengths` which gives the length of each sample. + shape `(batch_size, sequence_length)` and `waveform_lengths` which gives the length of each sample. - If `generate_speech=False`, it will returns `ModelOutput`. """ if input_ids is None and input_features is None and kwargs.get("inputs_embeds", None) is None: diff --git a/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py b/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py index 5895a85ace5..704b75450f7 100644 --- a/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py +++ b/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py @@ -3691,7 +3691,7 @@ class SeamlessM4Tv2ForTextToSpeech(SeamlessM4Tv2PreTrainedModel, GenerationMixin `Union[SeamlessM4Tv2GenerationOutput, Tuple[Tensor]]`: - If `return_intermediate_token_ids`, returns [`SeamlessM4Tv2GenerationOutput`]. - If not `return_intermediate_token_ids`, returns a tuple composed of waveforms of shape `(batch_size, - sequence_length)`and and `waveform_lengths` which gives the length of each sample. + sequence_length)` and `waveform_lengths` which gives the length of each sample. """ batch_size = len(input_ids) if input_ids is not None else len(kwargs.get("inputs_embeds")) @@ -4062,7 +4062,7 @@ class SeamlessM4Tv2ForSpeechToSpeech(SeamlessM4Tv2PreTrainedModel, GenerationMix `Union[SeamlessM4Tv2GenerationOutput, Tuple[Tensor]]`: - If `return_intermediate_token_ids`, returns [`SeamlessM4Tv2GenerationOutput`]. - If not `return_intermediate_token_ids`, returns a tuple composed of waveforms of shape `(batch_size, - sequence_length)`and and `waveform_lengths` which gives the length of each sample. + sequence_length)` and `waveform_lengths` which gives the length of each sample. """ batch_size = len(input_features) if input_features is not None else len(kwargs.get("inputs_embeds")) @@ -4514,7 +4514,7 @@ class SeamlessM4Tv2Model(SeamlessM4Tv2PreTrainedModel, GenerationMixin): `Union[SeamlessM4Tv2GenerationOutput, Tuple[Tensor], ModelOutput]`: - If `generate_speech` and `return_intermediate_token_ids`, returns [`SeamlessM4Tv2GenerationOutput`]. - If `generate_speech` and not `return_intermediate_token_ids`, returns a tuple composed of waveforms of - shape `(batch_size, sequence_length)`and and `waveform_lengths` which gives the length of each sample. + shape `(batch_size, sequence_length)` and `waveform_lengths` which gives the length of each sample. - If `generate_speech=False`, it will returns `ModelOutput`. """ if input_ids is None and input_features is None and kwargs.get("inputs_embeds", None) is None: diff --git a/tests/models/colpali/test_modeling_colpali.py b/tests/models/colpali/test_modeling_colpali.py index c0bcc917711..48d1dbf20a3 100644 --- a/tests/models/colpali/test_modeling_colpali.py +++ b/tests/models/colpali/test_modeling_colpali.py @@ -275,7 +275,7 @@ class ColPaliForRetrievalModelTest(ModelTesterMixin, unittest.TestCase): pass @unittest.skip( - reason="PaliGemmma's SigLip encoder uses the same initialization scheme as the Flax original implementation" + reason="PaliGemma's SigLip encoder uses the same initialization scheme as the Flax original implementation" ) def test_initialization(self): pass diff --git a/tests/models/deepseek_v3/test_modeling_deepseek_v3.py b/tests/models/deepseek_v3/test_modeling_deepseek_v3.py index 1c2690b54ed..e56dcc7d861 100644 --- a/tests/models/deepseek_v3/test_modeling_deepseek_v3.py +++ b/tests/models/deepseek_v3/test_modeling_deepseek_v3.py @@ -431,7 +431,7 @@ class DeepseekV3ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTeste def test_past_key_values_format(self): """ - Overwritting to pass the expected cache shapes (Deepseek-V3 uses MLA so the cache shapes are non-standard) + Overwriting to pass the expected cache shapes (Deepseek-V3 uses MLA so the cache shapes are non-standard) """ config, inputs = self.model_tester.prepare_config_and_inputs_for_common() batch_size, seq_length = inputs["input_ids"].shape @@ -451,7 +451,7 @@ class DeepseekV3ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTeste @slow def test_eager_matches_sdpa_generate(self): """ - Overwritting the common test as the test is flaky on tiny models + Overwriting the common test as the test is flaky on tiny models """ max_new_tokens = 30 diff --git a/tests/models/marian/test_tokenization_marian.py b/tests/models/marian/test_tokenization_marian.py index 45fee4f1fe6..0f40f0daa86 100644 --- a/tests/models/marian/test_tokenization_marian.py +++ b/tests/models/marian/test_tokenization_marian.py @@ -136,7 +136,7 @@ class MarianTokenizationTest(TokenizerTesterMixin, unittest.TestCase): decode_kwargs={"use_source_tokenizer": True}, ) - def test_tokenizer_integration_seperate_vocabs(self): + def test_tokenizer_integration_separate_vocabs(self): tokenizer = MarianTokenizer.from_pretrained("hf-internal-testing/test-marian-two-vocabs") source_text = "Tämä on testi" diff --git a/tests/models/opt/test_modeling_flax_opt.py b/tests/models/opt/test_modeling_flax_opt.py index 0e38ad69ea4..d922775628a 100644 --- a/tests/models/opt/test_modeling_flax_opt.py +++ b/tests/models/opt/test_modeling_flax_opt.py @@ -69,7 +69,7 @@ class FlaxOPTModelTester: embed_dim=16, word_embed_proj_dim=16, initializer_range=0.02, - attn_implemetation="eager", + attn_implementation="eager", ): self.parent = parent self.batch_size = batch_size @@ -92,7 +92,7 @@ class FlaxOPTModelTester: self.word_embed_proj_dim = word_embed_proj_dim self.initializer_range = initializer_range self.is_encoder_decoder = False - self.attn_implementation = attn_implemetation + self.attn_implementation = attn_implementation def prepare_config_and_inputs(self): input_ids = np.clip(ids_tensor([self.batch_size, self.seq_length - 1], self.vocab_size), 3, self.vocab_size) diff --git a/tests/models/paligemma/test_modeling_paligemma.py b/tests/models/paligemma/test_modeling_paligemma.py index ea00be138db..4b9db1d75d1 100644 --- a/tests/models/paligemma/test_modeling_paligemma.py +++ b/tests/models/paligemma/test_modeling_paligemma.py @@ -297,7 +297,7 @@ class PaliGemmaForConditionalGenerationModelTest(ModelTesterMixin, GenerationTes pass @unittest.skip( - reason="PaliGemmma's SigLip encoder uses the same initialization scheme as the Flax original implementation" + reason="PaliGemma's SigLip encoder uses the same initialization scheme as the Flax original implementation" ) def test_initialization(self): pass diff --git a/tests/models/paligemma2/test_modeling_paligemma2.py b/tests/models/paligemma2/test_modeling_paligemma2.py index 4dad8b75fbb..e13430f2b73 100644 --- a/tests/models/paligemma2/test_modeling_paligemma2.py +++ b/tests/models/paligemma2/test_modeling_paligemma2.py @@ -294,7 +294,7 @@ class PaliGemma2ForConditionalGenerationModelTest(ModelTesterMixin, GenerationTe pass @unittest.skip( - reason="PaliGemmma's SigLip encoder uses the same initialization scheme as the Flax original implementation" + reason="PaliGemma's SigLip encoder uses the same initialization scheme as the Flax original implementation" ) def test_initialization(self): pass diff --git a/utils/check_copies.py b/utils/check_copies.py index e37894c4eab..8a468717551 100644 --- a/utils/check_copies.py +++ b/utils/check_copies.py @@ -18,7 +18,7 @@ Utility that checks whether the copies defined in the library match the original - The list of models in the main README.md matches the ones in the localized READMEs, - Files that are registered as full copies of one another in the `FULL_COPIES` constant of this script. -This also checks the list of models in the README is complete (has all models) and add a line to complete if there is +This also checks the list of models in the README is complete (has all models) and adds a line to complete if there is a model missing. Use from the root of the repo with: @@ -420,7 +420,7 @@ def find_code_in_transformers( # Detail: the `Copied from` statement is originally designed to work with the last part of `TRANSFORMERS_PATH`, # (which is `transformers`). The same should be applied for `MODEL_TEST_PATH`. However, its last part is `models` - # (to only check and search in it) which is a bit confusing. So we keep the copied statement staring with + # (to only check and search in it) which is a bit confusing. So we keep the copied statement starting with # `tests.models.` and change it to `tests` here. if base_path == MODEL_TEST_PATH: base_path = "tests"