From 62c7ea0201cf27153c0bbd110d277ff9f39b0b1f Mon Sep 17 00:00:00 2001 From: Joao Gante Date: Thu, 13 Feb 2025 15:27:11 +0000 Subject: [PATCH] CI: avoid human error, automatically infer generative models (#33212) * tmp commit * move tests to the right class * remove ALL all_generative_model_classes = ... * skip tf roberta * skip InstructBlipForConditionalGenerationDecoderOnlyTest * videollava * reduce diff * reduce diff * remove on vlms * fix a few more * manual rebase bits * more manual rebase * remove all manual generative model class test entries * fix up to ernie * a few more removals * handle remaining cases * recurrent gemma * it's better here * make fixup * tf idefics is broken * tf bert + generate is broken * don't touch tf :() * don't touch tf :( * make fixup * better comments for test skips * revert tf changes * remove empty line removal * one more * missing one --- src/transformers/models/bert/modeling_bert.py | 8 ++++++++ src/transformers/models/ernie/modeling_ernie.py | 8 ++++++++ tests/generation/test_flax_utils.py | 1 - tests/generation/test_utils.py | 5 +---- tests/models/aria/test_modeling_aria.py | 1 - tests/models/autoformer/test_modeling_autoformer.py | 1 - tests/models/bamba/test_modeling_bamba.py | 10 +--------- tests/models/bark/test_modeling_bark.py | 7 +++++-- tests/models/bart/test_modeling_bart.py | 2 -- tests/models/bart/test_modeling_flax_bart.py | 1 - tests/models/bert/test_modeling_bert.py | 1 - .../bert_generation/test_modeling_bert_generation.py | 1 - tests/models/big_bird/test_modeling_big_bird.py | 1 - .../bigbird_pegasus/test_modeling_bigbird_pegasus.py | 2 -- tests/models/biogpt/test_modeling_biogpt.py | 1 - tests/models/blenderbot/test_modeling_blenderbot.py | 2 -- .../models/blenderbot/test_modeling_flax_blenderbot.py | 1 - .../blenderbot_small/test_modeling_blenderbot_small.py | 2 -- .../test_modeling_flax_blenderbot_small.py | 1 - tests/models/blip_2/test_modeling_blip_2.py | 3 ++- tests/models/bloom/test_modeling_bloom.py | 1 - tests/models/bloom/test_modeling_flax_bloom.py | 2 -- tests/models/bros/test_modeling_bros.py | 1 - tests/models/chameleon/test_modeling_chameleon.py | 1 - tests/models/clvp/test_modeling_clvp.py | 1 - tests/models/codegen/test_modeling_codegen.py | 1 - tests/models/cohere/test_modeling_cohere.py | 1 - tests/models/cohere2/test_modeling_cohere2.py | 1 - tests/models/ctrl/test_modeling_ctrl.py | 1 - tests/models/data2vec/test_modeling_data2vec_text.py | 1 - tests/models/dbrx/test_modeling_dbrx.py | 1 - .../test_modeling_decision_transformer.py | 1 - tests/models/diffllama/test_modeling_diffllama.py | 1 - tests/models/emu3/test_modeling_emu3.py | 2 -- tests/models/ernie/test_modeling_ernie.py | 1 - tests/models/esm/test_modeling_esm.py | 1 - tests/models/esm/test_modeling_esmfold.py | 1 - tests/models/falcon/test_modeling_falcon.py | 1 - .../models/falcon_mamba/test_modeling_falcon_mamba.py | 1 - tests/models/fsmt/test_modeling_fsmt.py | 1 - tests/models/fuyu/test_modeling_fuyu.py | 1 - tests/models/gemma/test_modeling_flax_gemma.py | 1 - tests/models/gemma/test_modeling_gemma.py | 1 - tests/models/gemma2/test_modeling_gemma2.py | 1 - tests/models/git/test_modeling_git.py | 1 - tests/models/glm/test_modeling_glm.py | 1 - tests/models/got_ocr2/test_modeling_got_ocr2.py | 1 - tests/models/gpt2/test_modeling_flax_gpt2.py | 1 - tests/models/gpt2/test_modeling_gpt2.py | 1 - tests/models/gpt_bigcode/test_modeling_gpt_bigcode.py | 1 - tests/models/gpt_neo/test_modeling_flax_gpt_neo.py | 1 - tests/models/gpt_neo/test_modeling_gpt_neo.py | 1 - tests/models/gpt_neox/test_modeling_gpt_neox.py | 1 - .../test_modeling_gpt_neox_japanese.py | 1 - tests/models/gptj/test_modeling_flax_gptj.py | 1 - tests/models/gptj/test_modeling_gptj.py | 1 - tests/models/granite/test_modeling_granite.py | 1 - tests/models/granitemoe/test_modeling_granitemoe.py | 1 - tests/models/helium/test_modeling_helium.py | 1 - tests/models/idefics/test_modeling_idefics.py | 1 - tests/models/idefics2/test_modeling_idefics2.py | 1 - tests/models/idefics3/test_modeling_idefics3.py | 1 - tests/models/imagegpt/test_modeling_imagegpt.py | 1 - tests/models/informer/test_modeling_informer.py | 1 - .../models/instructblip/test_modeling_instructblip.py | 1 - .../test_modeling_instructblipvideo.py | 1 - tests/models/jamba/test_modeling_jamba.py | 1 - tests/models/jetmoe/test_modeling_jetmoe.py | 1 - tests/models/kosmos2/test_modeling_kosmos2.py | 1 - tests/models/led/test_modeling_led.py | 1 - tests/models/llama/test_modeling_flax_llama.py | 1 - tests/models/llama/test_modeling_llama.py | 1 - tests/models/llava/test_modeling_llava.py | 1 - tests/models/llava_next/test_modeling_llava_next.py | 1 - .../llava_next_video/test_modeling_llava_next_video.py | 1 - .../llava_onevision/test_modeling_llava_onevision.py | 1 - tests/models/longt5/test_modeling_flax_longt5.py | 1 - tests/models/longt5/test_modeling_longt5.py | 1 - tests/models/m2m_100/test_modeling_m2m_100.py | 1 - tests/models/mamba/test_modeling_mamba.py | 1 - tests/models/mamba2/test_modeling_mamba2.py | 1 - tests/models/marian/test_modeling_flax_marian.py | 1 - tests/models/marian/test_modeling_marian.py | 2 -- tests/models/mbart/test_modeling_flax_mbart.py | 1 - tests/models/mbart/test_modeling_mbart.py | 2 -- tests/models/mistral/test_modeling_flax_mistral.py | 1 - tests/models/mistral/test_modeling_mistral.py | 1 - tests/models/mixtral/test_modeling_mixtral.py | 1 - tests/models/mllama/test_modeling_mllama.py | 2 -- tests/models/modernbert/test_modeling_modernbert.py | 1 - tests/models/moonshine/test_modeling_moonshine.py | 2 ++ tests/models/moshi/test_modeling_moshi.py | 4 ---- tests/models/mpt/test_modeling_mpt.py | 1 - tests/models/mra/test_modeling_mra.py | 1 - tests/models/mt5/test_modeling_mt5.py | 1 - tests/models/musicgen/test_modeling_musicgen.py | 4 ++++ .../musicgen_melody/test_modeling_musicgen_melody.py | 4 ++++ tests/models/mvp/test_modeling_mvp.py | 2 -- tests/models/nemotron/test_modeling_nemotron.py | 1 - tests/models/nllb_moe/test_modeling_nllb_moe.py | 1 - tests/models/olmo/test_modeling_olmo.py | 1 - tests/models/olmo2/test_modeling_olmo2.py | 1 - tests/models/olmoe/test_modeling_olmoe.py | 1 - tests/models/openai/test_modeling_openai.py | 3 --- tests/models/opt/test_modeling_flax_opt.py | 1 - tests/models/opt/test_modeling_opt.py | 1 - tests/models/paligemma/test_modeling_paligemma.py | 1 - tests/models/paligemma2/test_modeling_paligemma2.py | 1 - .../models/patchtsmixer/test_modeling_patchtsmixer.py | 3 --- tests/models/pegasus/test_modeling_flax_pegasus.py | 1 - tests/models/pegasus/test_modeling_pegasus.py | 2 -- tests/models/pegasus_x/test_modeling_pegasus_x.py | 2 -- tests/models/persimmon/test_modeling_persimmon.py | 1 - tests/models/phi/test_modeling_phi.py | 1 - tests/models/phi3/test_modeling_phi3.py | 1 - tests/models/phimoe/test_modeling_phimoe.py | 1 - tests/models/pix2struct/test_modeling_pix2struct.py | 1 - tests/models/plbart/test_modeling_plbart.py | 2 -- tests/models/pop2piano/test_modeling_pop2piano.py | 1 + tests/models/prophetnet/test_modeling_prophetnet.py | 2 -- tests/models/qwen2/test_modeling_qwen2.py | 1 - tests/models/qwen2_5_vl/test_modeling_qwen2_5_vl.py | 1 - tests/models/qwen2_moe/test_modeling_qwen2_moe.py | 1 - tests/models/qwen2_vl/test_modeling_qwen2_vl.py | 1 - .../recurrent_gemma/test_modeling_recurrent_gemma.py | 3 ++- tests/models/reformer/test_modeling_reformer.py | 2 -- tests/models/rembert/test_modeling_rembert.py | 1 - tests/models/roberta/test_modeling_roberta.py | 1 - .../test_modeling_roberta_prelayernorm.py | 1 - tests/models/roc_bert/test_modeling_roc_bert.py | 1 - tests/models/roformer/test_modeling_roformer.py | 1 - tests/models/rwkv/test_modeling_rwkv.py | 1 - .../models/seamless_m4t/test_modeling_seamless_m4t.py | 4 ++-- .../seamless_m4t_v2/test_modeling_seamless_m4t_v2.py | 4 ++-- .../speech_to_text/test_modeling_speech_to_text.py | 1 - tests/models/speecht5/test_modeling_speecht5.py | 3 --- tests/models/stablelm/test_modeling_stablelm.py | 1 - tests/models/starcoder2/test_modeling_starcoder2.py | 1 - tests/models/superglue/test_modeling_superglue.py | 1 - tests/models/superpoint/test_modeling_superpoint.py | 1 - .../test_modeling_switch_transformers.py | 1 - tests/models/t5/test_modeling_flax_t5.py | 1 - tests/models/t5/test_modeling_t5.py | 1 - .../test_modeling_time_series_transformer.py | 1 - tests/models/trocr/test_modeling_trocr.py | 1 - tests/models/udop/test_modeling_udop.py | 1 - tests/models/umt5/test_modeling_umt5.py | 1 - tests/models/video_llava/test_modeling_video_llava.py | 1 - tests/models/vipllava/test_modeling_vipllava.py | 1 - tests/models/whisper/test_modeling_flax_whisper.py | 1 - tests/models/whisper/test_modeling_whisper.py | 2 -- tests/models/xglm/test_modeling_flax_xglm.py | 1 - tests/models/xglm/test_modeling_xglm.py | 1 - tests/models/xlm/test_modeling_xlm.py | 3 --- .../xlm_roberta_xl/test_modeling_xlm_roberta_xl.py | 1 - tests/models/xlnet/test_modeling_xlnet.py | 3 --- tests/models/xmod/test_modeling_xmod.py | 1 - tests/models/yoso/test_modeling_yoso.py | 1 - tests/models/zamba/test_modeling_zamba.py | 1 - tests/models/zamba2/test_modeling_zamba2.py | 1 - tests/test_modeling_common.py | 5 ++++- tests/test_modeling_flax_common.py | 4 ++++ 162 files changed, 50 insertions(+), 198 deletions(-) diff --git a/src/transformers/models/bert/modeling_bert.py b/src/transformers/models/bert/modeling_bert.py index 0c53963cee79..8e48263c9300 100755 --- a/src/transformers/models/bert/modeling_bert.py +++ b/src/transformers/models/bert/modeling_bert.py @@ -1507,6 +1507,14 @@ def prepare_inputs_for_generation(self, input_ids, attention_mask=None, **model_ return {"input_ids": input_ids, "attention_mask": attention_mask} + @classmethod + def can_generate(cls) -> bool: + """ + Legacy correction: BertForMaskedLM can't call `generate()` from GenerationMixin. + Remove after v4.50, when we stop making `PreTrainedModel` inherit from `GenerationMixin`. + """ + return False + @add_start_docstrings( """Bert Model with a `next sentence prediction (classification)` head on top.""", diff --git a/src/transformers/models/ernie/modeling_ernie.py b/src/transformers/models/ernie/modeling_ernie.py index 2ab1521f19a7..975466f551d2 100644 --- a/src/transformers/models/ernie/modeling_ernie.py +++ b/src/transformers/models/ernie/modeling_ernie.py @@ -1325,6 +1325,14 @@ def prepare_inputs_for_generation(self, input_ids, attention_mask=None, **model_ return {"input_ids": input_ids, "attention_mask": attention_mask} + @classmethod + def can_generate(cls) -> bool: + """ + Legacy correction: ErnieForMaskedLM can't call `generate()` from GenerationMixin. + Remove after v4.50, when we stop making `PreTrainedModel` inherit from `GenerationMixin`. + """ + return False + @add_start_docstrings( """Ernie Model with a `next sentence prediction (classification)` head on top.""", diff --git a/tests/generation/test_flax_utils.py b/tests/generation/test_flax_utils.py index bb0c1828763b..302617c6688d 100644 --- a/tests/generation/test_flax_utils.py +++ b/tests/generation/test_flax_utils.py @@ -66,7 +66,6 @@ def random_attention_mask(shape, rng=None): @require_flax class FlaxGenerationTesterMixin: model_tester = None - all_generative_model_classes = () def _get_input_ids_and_config(self): config, inputs = self.model_tester.prepare_config_and_inputs_for_common() diff --git a/tests/generation/test_utils.py b/tests/generation/test_utils.py index 6c8a5e1285f8..ce31cc844f19 100644 --- a/tests/generation/test_utils.py +++ b/tests/generation/test_utils.py @@ -28,7 +28,7 @@ from packaging import version from parameterized import parameterized -from transformers import AutoConfig, is_torch_available, pipeline +from transformers import AutoConfig, AutoProcessor, AutoTokenizer, is_torch_available, pipeline from transformers.testing_utils import ( is_flaky, require_accelerate, @@ -61,8 +61,6 @@ AutoModelForSeq2SeqLM, AutoModelForSpeechSeq2Seq, AutoModelForVision2Seq, - AutoProcessor, - AutoTokenizer, BartForConditionalGeneration, BartTokenizer, GPT2LMHeadModel, @@ -119,7 +117,6 @@ class GenerationTesterMixin: input_name = "input_ids" model_tester = None - all_generative_model_classes = () max_new_tokens = 3 def prepare_config_and_inputs_for_generate(self, batch_size=2): diff --git a/tests/models/aria/test_modeling_aria.py b/tests/models/aria/test_modeling_aria.py index 9fb57eeec90f..f12ff24b17f1 100644 --- a/tests/models/aria/test_modeling_aria.py +++ b/tests/models/aria/test_modeling_aria.py @@ -189,7 +189,6 @@ class AriaForConditionalGenerationModelTest(ModelTesterMixin, GenerationTesterMi """ all_model_classes = (AriaForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (AriaForConditionalGeneration,) if is_torch_available() else () test_pruning = False test_head_masking = False _is_composite = True diff --git a/tests/models/autoformer/test_modeling_autoformer.py b/tests/models/autoformer/test_modeling_autoformer.py index 3bd4f77b5982..3a2ed6385151 100644 --- a/tests/models/autoformer/test_modeling_autoformer.py +++ b/tests/models/autoformer/test_modeling_autoformer.py @@ -205,7 +205,6 @@ def check_encoder_decoder_model_standalone(self, config, inputs_dict): @require_torch class AutoformerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (AutoformerModel, AutoformerForPrediction) if is_torch_available() else () - all_generative_model_classes = (AutoformerForPrediction,) if is_torch_available() else () pipeline_model_mapping = {"feature-extraction": AutoformerModel} if is_torch_available() else {} test_pruning = False test_head_masking = False diff --git a/tests/models/bamba/test_modeling_bamba.py b/tests/models/bamba/test_modeling_bamba.py index f7f9481e3edd..aa5bbbfba6cb 100644 --- a/tests/models/bamba/test_modeling_bamba.py +++ b/tests/models/bamba/test_modeling_bamba.py @@ -257,15 +257,7 @@ def create_and_check_decoder_model_past_large_inputs( @require_torch class BambaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): - all_model_classes = ( - ( - BambaModel, - BambaForCausalLM, - ) - if is_torch_available() - else () - ) - all_generative_model_classes = (BambaForCausalLM,) if is_torch_available() else () + all_model_classes = (BambaModel, BambaForCausalLM) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": BambaModel, diff --git a/tests/models/bark/test_modeling_bark.py b/tests/models/bark/test_modeling_bark.py index 06638550951a..d94f6d26d6e8 100644 --- a/tests/models/bark/test_modeling_bark.py +++ b/tests/models/bark/test_modeling_bark.py @@ -22,6 +22,7 @@ import pytest from transformers import ( + BarkCausalModel, BarkCoarseConfig, BarkConfig, BarkFineConfig, @@ -53,7 +54,6 @@ import torch from transformers import ( - BarkCausalModel, BarkCoarseModel, BarkFineModel, BarkModel, @@ -527,6 +527,8 @@ def get_pipeline_config(self): @require_torch class BarkSemanticModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): all_model_classes = (BarkSemanticModel,) if is_torch_available() else () + # `BarkSemanticModel` inherits from `BarkCausalModel`, but requires an advanced generation config. + # `BarkCausalModel` does not, so we run generation tests there. all_generative_model_classes = (BarkCausalModel,) if is_torch_available() else () is_encoder_decoder = False @@ -614,8 +616,9 @@ def test_generate_fp16(self): @require_torch class BarkCoarseModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): - # Same tester as BarkSemanticModelTest, except for model_class and config_class all_model_classes = (BarkCoarseModel,) if is_torch_available() else () + # `BarkCoarseModel` inherits from `BarkCausalModel`, but requires an advanced generation config. + # `BarkCausalModel` does not, so we run generation tests there. all_generative_model_classes = (BarkCausalModel,) if is_torch_available() else () is_encoder_decoder = False diff --git a/tests/models/bart/test_modeling_bart.py b/tests/models/bart/test_modeling_bart.py index 6c9db62daec2..1cddb898e9c6 100644 --- a/tests/models/bart/test_modeling_bart.py +++ b/tests/models/bart/test_modeling_bart.py @@ -419,7 +419,6 @@ class BartModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin if is_torch_available() else () ) - all_generative_model_classes = (BartForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": BartModel, @@ -1502,7 +1501,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class BartStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): all_model_classes = (BartDecoder, BartForCausalLM) if is_torch_available() else () - all_generative_model_classes = (BartForCausalLM,) if is_torch_available() else () fx_comptatible = True test_pruning = False is_encoder_decoder = False diff --git a/tests/models/bart/test_modeling_flax_bart.py b/tests/models/bart/test_modeling_flax_bart.py index f97f49149817..87603ce127b3 100644 --- a/tests/models/bart/test_modeling_flax_bart.py +++ b/tests/models/bart/test_modeling_flax_bart.py @@ -336,7 +336,6 @@ class FlaxBartModelTest(FlaxModelTesterMixin, unittest.TestCase, FlaxGenerationT if is_flax_available() else () ) - all_generative_model_classes = (FlaxBartForConditionalGeneration,) if is_flax_available() else () def setUp(self): self.model_tester = FlaxBartModelTester(self) diff --git a/tests/models/bert/test_modeling_bert.py b/tests/models/bert/test_modeling_bert.py index db28e077b4ea..9c8ee2a69ebb 100644 --- a/tests/models/bert/test_modeling_bert.py +++ b/tests/models/bert/test_modeling_bert.py @@ -451,7 +451,6 @@ class BertModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin if is_torch_available() else () ) - all_generative_model_classes = (BertLMHeadModel,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": BertModel, diff --git a/tests/models/bert_generation/test_modeling_bert_generation.py b/tests/models/bert_generation/test_modeling_bert_generation.py index 06fa6b6b12e9..a78bd8c41c1c 100644 --- a/tests/models/bert_generation/test_modeling_bert_generation.py +++ b/tests/models/bert_generation/test_modeling_bert_generation.py @@ -243,7 +243,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class BertGenerationEncoderTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (BertGenerationEncoder, BertGenerationDecoder) if is_torch_available() else () - all_generative_model_classes = (BertGenerationDecoder,) if is_torch_available() else () pipeline_model_mapping = ( {"feature-extraction": BertGenerationEncoder, "text-generation": BertGenerationDecoder} if is_torch_available() diff --git a/tests/models/big_bird/test_modeling_big_bird.py b/tests/models/big_bird/test_modeling_big_bird.py index 8ca17eb14f18..6aca3cbc4109 100644 --- a/tests/models/big_bird/test_modeling_big_bird.py +++ b/tests/models/big_bird/test_modeling_big_bird.py @@ -451,7 +451,6 @@ class BigBirdModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase) if is_torch_available() else () ) - all_generative_model_classes = (BigBirdForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": BigBirdModel, diff --git a/tests/models/bigbird_pegasus/test_modeling_bigbird_pegasus.py b/tests/models/bigbird_pegasus/test_modeling_bigbird_pegasus.py index 5c8ae48e1b03..9103c2d52f62 100644 --- a/tests/models/bigbird_pegasus/test_modeling_bigbird_pegasus.py +++ b/tests/models/bigbird_pegasus/test_modeling_bigbird_pegasus.py @@ -250,7 +250,6 @@ class BigBirdPegasusModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineT if is_torch_available() else () ) - all_generative_model_classes = (BigBirdPegasusForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": BigBirdPegasusModel, @@ -792,7 +791,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class BigBirdPegasusStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): all_model_classes = (BigBirdPegasusDecoder, BigBirdPegasusForCausalLM) if is_torch_available() else () - all_generative_model_classes = (BigBirdPegasusForCausalLM,) if is_torch_available() else () test_pruning = False is_encoder_decoder = False diff --git a/tests/models/biogpt/test_modeling_biogpt.py b/tests/models/biogpt/test_modeling_biogpt.py index 1082f901584e..836f0e8216b6 100644 --- a/tests/models/biogpt/test_modeling_biogpt.py +++ b/tests/models/biogpt/test_modeling_biogpt.py @@ -284,7 +284,6 @@ class BioGptModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMix if is_torch_available() else () ) - all_generative_model_classes = (BioGptForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": BioGptModel, diff --git a/tests/models/blenderbot/test_modeling_blenderbot.py b/tests/models/blenderbot/test_modeling_blenderbot.py index cecedb8a9071..d12154b128c9 100644 --- a/tests/models/blenderbot/test_modeling_blenderbot.py +++ b/tests/models/blenderbot/test_modeling_blenderbot.py @@ -226,7 +226,6 @@ def check_encoder_decoder_model_standalone(self, config, inputs_dict): @require_torch class BlenderbotModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (BlenderbotModel, BlenderbotForConditionalGeneration) if is_torch_available() else () - all_generative_model_classes = (BlenderbotForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": BlenderbotModel, @@ -533,7 +532,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class BlenderbotStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): all_model_classes = (BlenderbotDecoder, BlenderbotForCausalLM) if is_torch_available() else () - all_generative_model_classes = (BlenderbotForCausalLM,) if is_torch_available() else () test_pruning = False is_encoder_decoder = False diff --git a/tests/models/blenderbot/test_modeling_flax_blenderbot.py b/tests/models/blenderbot/test_modeling_flax_blenderbot.py index a39fcada0cab..d5d9c3d7cfb7 100644 --- a/tests/models/blenderbot/test_modeling_flax_blenderbot.py +++ b/tests/models/blenderbot/test_modeling_flax_blenderbot.py @@ -319,7 +319,6 @@ class FlaxBlenderbotModelTest(FlaxModelTesterMixin, unittest.TestCase, FlaxGener if is_flax_available() else () ) - all_generative_model_classes = (FlaxBlenderbotForConditionalGeneration,) if is_flax_available() else () def setUp(self): self.model_tester = FlaxBlenderbotModelTester(self) diff --git a/tests/models/blenderbot_small/test_modeling_blenderbot_small.py b/tests/models/blenderbot_small/test_modeling_blenderbot_small.py index 933d8cccc8c1..c2fcdd852dca 100644 --- a/tests/models/blenderbot_small/test_modeling_blenderbot_small.py +++ b/tests/models/blenderbot_small/test_modeling_blenderbot_small.py @@ -217,7 +217,6 @@ def check_encoder_decoder_model_standalone(self, config, inputs_dict): @require_torch class BlenderbotSmallModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (BlenderbotSmallModel, BlenderbotSmallForConditionalGeneration) if is_torch_available() else () - all_generative_model_classes = (BlenderbotSmallForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": BlenderbotSmallModel, @@ -542,7 +541,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class BlenderbotSmallStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): all_model_classes = (BlenderbotSmallDecoder, BlenderbotSmallForCausalLM) if is_torch_available() else () - all_generative_model_classes = (BlenderbotSmallForCausalLM,) if is_torch_available() else () test_pruning = False is_encoder_decoder = False diff --git a/tests/models/blenderbot_small/test_modeling_flax_blenderbot_small.py b/tests/models/blenderbot_small/test_modeling_flax_blenderbot_small.py index 2d993ad8b411..f09b7f05ce3a 100644 --- a/tests/models/blenderbot_small/test_modeling_flax_blenderbot_small.py +++ b/tests/models/blenderbot_small/test_modeling_flax_blenderbot_small.py @@ -318,7 +318,6 @@ class FlaxBlenderbotSmallModelTest(FlaxModelTesterMixin, unittest.TestCase, Flax if is_flax_available() else () ) - all_generative_model_classes = (FlaxBlenderbotSmallForConditionalGeneration,) if is_flax_available() else () def is_pipeline_test_to_skip( self, diff --git a/tests/models/blip_2/test_modeling_blip_2.py b/tests/models/blip_2/test_modeling_blip_2.py index 775971cf280f..e26232e3eb43 100644 --- a/tests/models/blip_2/test_modeling_blip_2.py +++ b/tests/models/blip_2/test_modeling_blip_2.py @@ -472,7 +472,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class Blip2ForConditionalGenerationDecoderOnlyTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): all_model_classes = (Blip2ForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (Blip2ForConditionalGeneration,) if is_torch_available() else () fx_compatible = False test_head_masking = False test_pruning = False @@ -995,6 +994,8 @@ def prepare_config_and_inputs_for_common(self): @require_torch class Blip2ModelTest(ModelTesterMixin, PipelineTesterMixin, GenerationTesterMixin, unittest.TestCase): all_model_classes = (Blip2ForConditionalGeneration, Blip2Model) if is_torch_available() else () + # Doesn't run generation tests. TODO: fix generation tests for Blip2ForConditionalGeneration + all_generative_model_classes = () pipeline_model_mapping = ( { "feature-extraction": Blip2Model, diff --git a/tests/models/bloom/test_modeling_bloom.py b/tests/models/bloom/test_modeling_bloom.py index b20012c2a197..d5de0e92d480 100644 --- a/tests/models/bloom/test_modeling_bloom.py +++ b/tests/models/bloom/test_modeling_bloom.py @@ -328,7 +328,6 @@ class BloomModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixi else () ) - all_generative_model_classes = (BloomForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": BloomModel, diff --git a/tests/models/bloom/test_modeling_flax_bloom.py b/tests/models/bloom/test_modeling_flax_bloom.py index 91716615de9a..dffee6793652 100644 --- a/tests/models/bloom/test_modeling_flax_bloom.py +++ b/tests/models/bloom/test_modeling_flax_bloom.py @@ -171,7 +171,6 @@ def check_use_cache_forward_with_attn_mask(self, model_class_name, config, input @require_flax class FlaxBloomModelTest(FlaxModelTesterMixin, unittest.TestCase, FlaxGenerationTesterMixin): all_model_classes = (FlaxBloomModel, FlaxBloomForCausalLM) if is_flax_available() else () - all_generative_model_classes = () if is_flax_available() else () def setUp(self): self.model_tester = FlaxBloomModelTester(self) @@ -199,7 +198,6 @@ def test_model_from_pretrained(self): @require_flax class FlaxBloomGenerationTest(unittest.TestCase): all_model_classes = (FlaxBloomForCausalLM,) if is_flax_available() else () - all_generative_model_classes = () if is_flax_available() else () def setUp(self): self.model_id = "bigscience/bloom-560m" diff --git a/tests/models/bros/test_modeling_bros.py b/tests/models/bros/test_modeling_bros.py index 1dbf2a92fb49..d3c11a6f3696 100644 --- a/tests/models/bros/test_modeling_bros.py +++ b/tests/models/bros/test_modeling_bros.py @@ -285,7 +285,6 @@ class BrosModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): if is_torch_available() else () ) - all_generative_model_classes = () if is_torch_available() else () pipeline_model_mapping = ( {"feature-extraction": BrosModel, "token-classification": BrosForTokenClassification} if is_torch_available() diff --git a/tests/models/chameleon/test_modeling_chameleon.py b/tests/models/chameleon/test_modeling_chameleon.py index 56cb9141d6b6..09eec986857a 100644 --- a/tests/models/chameleon/test_modeling_chameleon.py +++ b/tests/models/chameleon/test_modeling_chameleon.py @@ -271,7 +271,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class ChameleonModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (ChameleonModel, ChameleonForConditionalGeneration) if is_torch_available() else () - all_generative_model_classes = (ChameleonForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": ChameleonModel, diff --git a/tests/models/clvp/test_modeling_clvp.py b/tests/models/clvp/test_modeling_clvp.py index 334f01004936..839c831eb9f6 100644 --- a/tests/models/clvp/test_modeling_clvp.py +++ b/tests/models/clvp/test_modeling_clvp.py @@ -281,7 +281,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class ClvpDecoderTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (ClvpModel, ClvpForCausalLM) if is_torch_available() else () - all_generative_model_classes = (ClvpForCausalLM,) if is_torch_available() else () pipeline_model_mapping = {"feature-extraction": ClvpModelForConditionalGeneration} if is_torch_available() else {} test_pruning = False diff --git a/tests/models/codegen/test_modeling_codegen.py b/tests/models/codegen/test_modeling_codegen.py index 59ed05197857..fc8ece13a801 100644 --- a/tests/models/codegen/test_modeling_codegen.py +++ b/tests/models/codegen/test_modeling_codegen.py @@ -322,7 +322,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class CodeGenModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (CodeGenModel, CodeGenForCausalLM) if is_torch_available() else () - all_generative_model_classes = (CodeGenForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( {"feature-extraction": CodeGenModel, "text-generation": CodeGenForCausalLM} if is_torch_available() else {} ) diff --git a/tests/models/cohere/test_modeling_cohere.py b/tests/models/cohere/test_modeling_cohere.py index 47cd68e3f728..1d3a435fdb76 100644 --- a/tests/models/cohere/test_modeling_cohere.py +++ b/tests/models/cohere/test_modeling_cohere.py @@ -274,7 +274,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class CohereModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (CohereModel, CohereForCausalLM) if is_torch_available() else () - all_generative_model_classes = (CohereForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": CohereModel, diff --git a/tests/models/cohere2/test_modeling_cohere2.py b/tests/models/cohere2/test_modeling_cohere2.py index 881856ea70da..ab0af27c00e2 100644 --- a/tests/models/cohere2/test_modeling_cohere2.py +++ b/tests/models/cohere2/test_modeling_cohere2.py @@ -54,7 +54,6 @@ class Cohere2ModelTester(CohereModelTester): @require_torch class Cohere2ModelTest(CohereModelTest, unittest.TestCase): all_model_classes = (Cohere2Model, Cohere2ForCausalLM) if is_torch_available() else () - all_generative_model_classes = (Cohere2ForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": Cohere2Model, diff --git a/tests/models/ctrl/test_modeling_ctrl.py b/tests/models/ctrl/test_modeling_ctrl.py index 88efa9bb1891..285729382f50 100644 --- a/tests/models/ctrl/test_modeling_ctrl.py +++ b/tests/models/ctrl/test_modeling_ctrl.py @@ -193,7 +193,6 @@ def create_and_check_ctrl_for_sequence_classification(self, config, input_ids, h @require_torch class CTRLModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (CTRLModel, CTRLLMHeadModel, CTRLForSequenceClassification) if is_torch_available() else () - all_generative_model_classes = (CTRLLMHeadModel,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": CTRLModel, diff --git a/tests/models/data2vec/test_modeling_data2vec_text.py b/tests/models/data2vec/test_modeling_data2vec_text.py index 45482febd167..7bc2d4eb945f 100644 --- a/tests/models/data2vec/test_modeling_data2vec_text.py +++ b/tests/models/data2vec/test_modeling_data2vec_text.py @@ -373,7 +373,6 @@ class Data2VecTextModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTes if is_torch_available() else () ) - all_generative_model_classes = (Data2VecTextForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": Data2VecTextModel, diff --git a/tests/models/dbrx/test_modeling_dbrx.py b/tests/models/dbrx/test_modeling_dbrx.py index a3d088e2160b..bc0249d666dc 100644 --- a/tests/models/dbrx/test_modeling_dbrx.py +++ b/tests/models/dbrx/test_modeling_dbrx.py @@ -322,7 +322,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class DbrxModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (DbrxModel, DbrxForCausalLM) if is_torch_available() else () - all_generative_model_classes = (DbrxForCausalLM,) if is_torch_available() else () pipeline_model_mapping = {"text-generation": DbrxForCausalLM} if is_torch_available() else {} test_headmasking = False test_pruning = False diff --git a/tests/models/decision_transformer/test_modeling_decision_transformer.py b/tests/models/decision_transformer/test_modeling_decision_transformer.py index b1a4d0938f71..f22911db9580 100644 --- a/tests/models/decision_transformer/test_modeling_decision_transformer.py +++ b/tests/models/decision_transformer/test_modeling_decision_transformer.py @@ -127,7 +127,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class DecisionTransformerModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (DecisionTransformerModel,) if is_torch_available() else () - all_generative_model_classes = () pipeline_model_mapping = {"feature-extraction": DecisionTransformerModel} if is_torch_available() else {} # Ignoring of a failing test from GenerationTesterMixin, as the model does not use inputs_ids diff --git a/tests/models/diffllama/test_modeling_diffllama.py b/tests/models/diffllama/test_modeling_diffllama.py index da1fe24bda4f..81b963cfc47f 100644 --- a/tests/models/diffllama/test_modeling_diffllama.py +++ b/tests/models/diffllama/test_modeling_diffllama.py @@ -296,7 +296,6 @@ class DiffLlamaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTester if is_torch_available() else () ) - all_generative_model_classes = (DiffLlamaForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": DiffLlamaModel, diff --git a/tests/models/emu3/test_modeling_emu3.py b/tests/models/emu3/test_modeling_emu3.py index c0e84f5c5e44..4563cc17dfce 100644 --- a/tests/models/emu3/test_modeling_emu3.py +++ b/tests/models/emu3/test_modeling_emu3.py @@ -124,7 +124,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class Emu3Text2TextModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (Emu3ForCausalLM,) if is_torch_available() else () - all_generative_model_classes = (Emu3ForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "text-generation": Emu3ForCausalLM, @@ -312,7 +311,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class Emu3Vision2TextModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (Emu3ForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (Emu3ForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = {} test_headmasking = False test_pruning = False diff --git a/tests/models/ernie/test_modeling_ernie.py b/tests/models/ernie/test_modeling_ernie.py index 232d91760344..33ebef8e7b62 100644 --- a/tests/models/ernie/test_modeling_ernie.py +++ b/tests/models/ernie/test_modeling_ernie.py @@ -442,7 +442,6 @@ class ErnieModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixi if is_torch_available() else () ) - all_generative_model_classes = (ErnieForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": ErnieModel, diff --git a/tests/models/esm/test_modeling_esm.py b/tests/models/esm/test_modeling_esm.py index 1bffcca22211..7504ec2462eb 100644 --- a/tests/models/esm/test_modeling_esm.py +++ b/tests/models/esm/test_modeling_esm.py @@ -195,7 +195,6 @@ class EsmModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): if is_torch_available() else () ) - all_generative_model_classes = () pipeline_model_mapping = ( { "feature-extraction": EsmModel, diff --git a/tests/models/esm/test_modeling_esmfold.py b/tests/models/esm/test_modeling_esmfold.py index ada6b773b589..7450f0295f77 100644 --- a/tests/models/esm/test_modeling_esmfold.py +++ b/tests/models/esm/test_modeling_esmfold.py @@ -169,7 +169,6 @@ class EsmFoldModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase) test_mismatched_shapes = False all_model_classes = (EsmForProteinFolding,) if is_torch_available() else () - all_generative_model_classes = () pipeline_model_mapping = {} if is_torch_available() else {} test_sequence_classification_problem_types = False diff --git a/tests/models/falcon/test_modeling_falcon.py b/tests/models/falcon/test_modeling_falcon.py index b92b4782998c..2838df380745 100644 --- a/tests/models/falcon/test_modeling_falcon.py +++ b/tests/models/falcon/test_modeling_falcon.py @@ -290,7 +290,6 @@ class FalconModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMix if is_torch_available() else () ) - all_generative_model_classes = (FalconForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": FalconModel, diff --git a/tests/models/falcon_mamba/test_modeling_falcon_mamba.py b/tests/models/falcon_mamba/test_modeling_falcon_mamba.py index 75835da1a468..6ac432766ac1 100644 --- a/tests/models/falcon_mamba/test_modeling_falcon_mamba.py +++ b/tests/models/falcon_mamba/test_modeling_falcon_mamba.py @@ -247,7 +247,6 @@ def prepare_config_and_inputs_for_common(self): # Copied from transformers.tests.models.mamba.MambaModelTest with Mamba->Falcon,mamba->falcon_mamba,FalconMambaCache->MambaCache class FalconMambaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (FalconMambaModel, FalconMambaForCausalLM) if is_torch_available() else () - all_generative_model_classes = (FalconMambaForCausalLM,) if is_torch_available() else () has_attentions = False # FalconMamba does not support attentions fx_compatible = False # FIXME let's try to support this @ArthurZucker test_torchscript = False # FIXME let's try to support this @ArthurZucker diff --git a/tests/models/fsmt/test_modeling_fsmt.py b/tests/models/fsmt/test_modeling_fsmt.py index 0d7f4d0cab72..95789c844aec 100644 --- a/tests/models/fsmt/test_modeling_fsmt.py +++ b/tests/models/fsmt/test_modeling_fsmt.py @@ -163,7 +163,6 @@ def prepare_fsmt_inputs_dict( @require_torch class FSMTModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (FSMTModel, FSMTForConditionalGeneration) if is_torch_available() else () - all_generative_model_classes = (FSMTForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": FSMTModel, diff --git a/tests/models/fuyu/test_modeling_fuyu.py b/tests/models/fuyu/test_modeling_fuyu.py index 634dfcf61565..1b308973fb14 100644 --- a/tests/models/fuyu/test_modeling_fuyu.py +++ b/tests/models/fuyu/test_modeling_fuyu.py @@ -268,7 +268,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class FuyuModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (FuyuForCausalLM,) if is_torch_available() else () - all_generative_model_classes = (FuyuForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( {"text-generation": FuyuForCausalLM, "image-text-to-text": FuyuForCausalLM} if is_torch_available() else {} ) diff --git a/tests/models/gemma/test_modeling_flax_gemma.py b/tests/models/gemma/test_modeling_flax_gemma.py index 0f3c5df4f136..3a56cbfb6b54 100644 --- a/tests/models/gemma/test_modeling_flax_gemma.py +++ b/tests/models/gemma/test_modeling_flax_gemma.py @@ -176,7 +176,6 @@ def check_use_cache_forward_with_attn_mask(self, model_class_name, config, input @require_flax class FlaxGemmaModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase): all_model_classes = (FlaxGemmaModel, FlaxGemmaForCausalLM) if is_flax_available() else () - all_generative_model_classes = (FlaxGemmaForCausalLM,) if is_flax_available() else () def setUp(self): self.model_tester = FlaxGemmaModelTester(self) diff --git a/tests/models/gemma/test_modeling_gemma.py b/tests/models/gemma/test_modeling_gemma.py index e8483f8c7c7d..ffadf3377e0a 100644 --- a/tests/models/gemma/test_modeling_gemma.py +++ b/tests/models/gemma/test_modeling_gemma.py @@ -300,7 +300,6 @@ class GemmaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixi if is_torch_available() else () ) - all_generative_model_classes = (GemmaForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": GemmaModel, diff --git a/tests/models/gemma2/test_modeling_gemma2.py b/tests/models/gemma2/test_modeling_gemma2.py index 8d02565b4b5a..c881ecaea559 100644 --- a/tests/models/gemma2/test_modeling_gemma2.py +++ b/tests/models/gemma2/test_modeling_gemma2.py @@ -63,7 +63,6 @@ class Gemma2ModelTest(GemmaModelTest, unittest.TestCase): if is_torch_available() else () ) - all_generative_model_classes = (Gemma2ForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": Gemma2Model, diff --git a/tests/models/git/test_modeling_git.py b/tests/models/git/test_modeling_git.py index e4251c700ed6..9912d9b6fea8 100644 --- a/tests/models/git/test_modeling_git.py +++ b/tests/models/git/test_modeling_git.py @@ -399,7 +399,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class GitModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (GitModel, GitForCausalLM) if is_torch_available() else () - all_generative_model_classes = (GitForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": GitModel, diff --git a/tests/models/glm/test_modeling_glm.py b/tests/models/glm/test_modeling_glm.py index 8642fe826ca2..e4ceec2d0978 100644 --- a/tests/models/glm/test_modeling_glm.py +++ b/tests/models/glm/test_modeling_glm.py @@ -286,7 +286,6 @@ class GlmModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, if is_torch_available() else () ) - all_generative_model_classes = (GlmForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": GlmModel, diff --git a/tests/models/got_ocr2/test_modeling_got_ocr2.py b/tests/models/got_ocr2/test_modeling_got_ocr2.py index ba3755237df1..ac044de5ca96 100644 --- a/tests/models/got_ocr2/test_modeling_got_ocr2.py +++ b/tests/models/got_ocr2/test_modeling_got_ocr2.py @@ -169,7 +169,6 @@ def create_and_check_model_fp16_autocast_forward(self, config, input_ids, pixel_ @require_torch class GotOcr2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (GotOcr2ForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (GotOcr2ForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "image-to-text": GotOcr2ForConditionalGeneration, diff --git a/tests/models/gpt2/test_modeling_flax_gpt2.py b/tests/models/gpt2/test_modeling_flax_gpt2.py index fbf2d6c333fd..2e98930e4c69 100644 --- a/tests/models/gpt2/test_modeling_flax_gpt2.py +++ b/tests/models/gpt2/test_modeling_flax_gpt2.py @@ -211,7 +211,6 @@ def check_bool_attention_mask_in_generation(self, model_class_name, config, inpu @require_flax class FlaxGPT2ModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase): all_model_classes = (FlaxGPT2Model, FlaxGPT2LMHeadModel) if is_flax_available() else () - all_generative_model_classes = (FlaxGPT2LMHeadModel,) if is_flax_available() else () def setUp(self): self.model_tester = FlaxGPT2ModelTester(self) diff --git a/tests/models/gpt2/test_modeling_gpt2.py b/tests/models/gpt2/test_modeling_gpt2.py index b75827c21538..b45c84fc6445 100644 --- a/tests/models/gpt2/test_modeling_gpt2.py +++ b/tests/models/gpt2/test_modeling_gpt2.py @@ -492,7 +492,6 @@ class GPT2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin if is_torch_available() else () ) - all_generative_model_classes = (GPT2LMHeadModel, GPT2DoubleHeadsModel) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": GPT2Model, diff --git a/tests/models/gpt_bigcode/test_modeling_gpt_bigcode.py b/tests/models/gpt_bigcode/test_modeling_gpt_bigcode.py index c854a7e71167..18b2e6408888 100644 --- a/tests/models/gpt_bigcode/test_modeling_gpt_bigcode.py +++ b/tests/models/gpt_bigcode/test_modeling_gpt_bigcode.py @@ -390,7 +390,6 @@ class GPTBigCodeModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTeste if is_torch_available() else () ) - all_generative_model_classes = (GPTBigCodeForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": GPTBigCodeModel, diff --git a/tests/models/gpt_neo/test_modeling_flax_gpt_neo.py b/tests/models/gpt_neo/test_modeling_flax_gpt_neo.py index ca41495a842c..490d58c8d112 100644 --- a/tests/models/gpt_neo/test_modeling_flax_gpt_neo.py +++ b/tests/models/gpt_neo/test_modeling_flax_gpt_neo.py @@ -183,7 +183,6 @@ def check_use_cache_forward_with_attn_mask(self, model_class_name, config, input @require_flax class FlaxGPTNeoModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase): all_model_classes = (FlaxGPTNeoModel, FlaxGPTNeoForCausalLM) if is_flax_available() else () - all_generative_model_classes = (FlaxGPTNeoForCausalLM,) if is_flax_available() else () def setUp(self): self.model_tester = FlaxGPTNeoModelTester(self) diff --git a/tests/models/gpt_neo/test_modeling_gpt_neo.py b/tests/models/gpt_neo/test_modeling_gpt_neo.py index 245fee4b71f1..213c3ed497f1 100644 --- a/tests/models/gpt_neo/test_modeling_gpt_neo.py +++ b/tests/models/gpt_neo/test_modeling_gpt_neo.py @@ -376,7 +376,6 @@ class GPTNeoModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMix if is_torch_available() else () ) - all_generative_model_classes = (GPTNeoForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": GPTNeoModel, diff --git a/tests/models/gpt_neox/test_modeling_gpt_neox.py b/tests/models/gpt_neox/test_modeling_gpt_neox.py index 1580526b6f36..34a8e54f700d 100644 --- a/tests/models/gpt_neox/test_modeling_gpt_neox.py +++ b/tests/models/gpt_neox/test_modeling_gpt_neox.py @@ -274,7 +274,6 @@ class GPTNeoXModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMi if is_torch_available() else () ) - all_generative_model_classes = (GPTNeoXForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": GPTNeoXModel, diff --git a/tests/models/gpt_neox_japanese/test_modeling_gpt_neox_japanese.py b/tests/models/gpt_neox_japanese/test_modeling_gpt_neox_japanese.py index 784323afefdc..22bd64708131 100644 --- a/tests/models/gpt_neox_japanese/test_modeling_gpt_neox_japanese.py +++ b/tests/models/gpt_neox_japanese/test_modeling_gpt_neox_japanese.py @@ -198,7 +198,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class GPTNeoXModelJapaneseTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (GPTNeoXJapaneseModel, GPTNeoXJapaneseForCausalLM) if is_torch_available() else () - all_generative_model_classes = (GPTNeoXJapaneseForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( {"feature-extraction": GPTNeoXJapaneseModel, "text-generation": GPTNeoXJapaneseForCausalLM} if is_torch_available() diff --git a/tests/models/gptj/test_modeling_flax_gptj.py b/tests/models/gptj/test_modeling_flax_gptj.py index aa3b7a99aa0f..ece207ee5dbb 100644 --- a/tests/models/gptj/test_modeling_flax_gptj.py +++ b/tests/models/gptj/test_modeling_flax_gptj.py @@ -180,7 +180,6 @@ def check_use_cache_forward_with_attn_mask(self, model_class_name, config, input @require_flax class FlaxGPTJModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase): all_model_classes = (FlaxGPTJModel, FlaxGPTJForCausalLM) if is_flax_available() else () - all_generative_model_classes = (FlaxGPTJForCausalLM,) if is_flax_available() else () def setUp(self): self.model_tester = FlaxGPTJModelTester(self) diff --git a/tests/models/gptj/test_modeling_gptj.py b/tests/models/gptj/test_modeling_gptj.py index 10d5515f4670..793afc7f5c30 100644 --- a/tests/models/gptj/test_modeling_gptj.py +++ b/tests/models/gptj/test_modeling_gptj.py @@ -341,7 +341,6 @@ class GPTJModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin if is_torch_available() else () ) - all_generative_model_classes = (GPTJForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": GPTJModel, diff --git a/tests/models/granite/test_modeling_granite.py b/tests/models/granite/test_modeling_granite.py index a7ef3024de6b..469e96fd8304 100644 --- a/tests/models/granite/test_modeling_granite.py +++ b/tests/models/granite/test_modeling_granite.py @@ -281,7 +281,6 @@ class GraniteModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMi if is_torch_available() else () ) - all_generative_model_classes = (GraniteForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": GraniteModel, diff --git a/tests/models/granitemoe/test_modeling_granitemoe.py b/tests/models/granitemoe/test_modeling_granitemoe.py index 9e7b7c944214..0e64d29c9189 100644 --- a/tests/models/granitemoe/test_modeling_granitemoe.py +++ b/tests/models/granitemoe/test_modeling_granitemoe.py @@ -280,7 +280,6 @@ class GraniteMoeModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.Test if is_torch_available() else () ) - all_generative_model_classes = (GraniteMoeForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": GraniteMoeModel, diff --git a/tests/models/helium/test_modeling_helium.py b/tests/models/helium/test_modeling_helium.py index 3ad2cf736678..fb7321100776 100644 --- a/tests/models/helium/test_modeling_helium.py +++ b/tests/models/helium/test_modeling_helium.py @@ -55,7 +55,6 @@ class HeliumModelTest(GemmaModelTest, unittest.TestCase): if is_torch_available() else () ) - all_generative_model_classes = (HeliumForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": HeliumModel, diff --git a/tests/models/idefics/test_modeling_idefics.py b/tests/models/idefics/test_modeling_idefics.py index 1306dc50d974..5d19f5b02025 100644 --- a/tests/models/idefics/test_modeling_idefics.py +++ b/tests/models/idefics/test_modeling_idefics.py @@ -593,7 +593,6 @@ def test_sdpa_can_dispatch_non_composite_models(self): @require_torch class IdeficsForVisionText2TextTest(IdeficsModelTest, GenerationTesterMixin, unittest.TestCase): all_model_classes = (IdeficsForVisionText2Text,) if is_torch_available() else () - all_generative_model_classes = (IdeficsForVisionText2Text,) if is_torch_available() else () def setUp(self): self.model_tester = IdeficsModelTester( diff --git a/tests/models/idefics2/test_modeling_idefics2.py b/tests/models/idefics2/test_modeling_idefics2.py index 8cafc606bd2c..56df4bb801b6 100644 --- a/tests/models/idefics2/test_modeling_idefics2.py +++ b/tests/models/idefics2/test_modeling_idefics2.py @@ -369,7 +369,6 @@ class Idefics2ForConditionalGenerationModelTest(GenerationTesterMixin, ModelTest """ all_model_classes = (Idefics2ForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (Idefics2ForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = {"image-text-to-text": Idefics2ForConditionalGeneration} if is_torch_available() else () fx_compatible = False test_pruning = False diff --git a/tests/models/idefics3/test_modeling_idefics3.py b/tests/models/idefics3/test_modeling_idefics3.py index a20c01a98379..dae54afe6208 100644 --- a/tests/models/idefics3/test_modeling_idefics3.py +++ b/tests/models/idefics3/test_modeling_idefics3.py @@ -327,7 +327,6 @@ class Idefics3ForConditionalGenerationModelTest(GenerationTesterMixin, ModelTest """ all_model_classes = (Idefics3ForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (Idefics3ForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = {"image-text-to-text": Idefics3ForConditionalGeneration} if is_torch_available() else () fx_compatible = False test_pruning = False diff --git a/tests/models/imagegpt/test_modeling_imagegpt.py b/tests/models/imagegpt/test_modeling_imagegpt.py index b21054525c51..a2d65f4d4b6d 100644 --- a/tests/models/imagegpt/test_modeling_imagegpt.py +++ b/tests/models/imagegpt/test_modeling_imagegpt.py @@ -230,7 +230,6 @@ class ImageGPTModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterM all_model_classes = ( (ImageGPTForCausalImageModeling, ImageGPTForImageClassification, ImageGPTModel) if is_torch_available() else () ) - all_generative_model_classes = (ImageGPTForCausalImageModeling,) if is_torch_available() else () pipeline_model_mapping = ( {"image-feature-extraction": ImageGPTModel, "image-classification": ImageGPTForImageClassification} if is_torch_available() diff --git a/tests/models/informer/test_modeling_informer.py b/tests/models/informer/test_modeling_informer.py index d6a5220aac27..5415717cd4b8 100644 --- a/tests/models/informer/test_modeling_informer.py +++ b/tests/models/informer/test_modeling_informer.py @@ -190,7 +190,6 @@ def check_encoder_decoder_model_standalone(self, config, inputs_dict): @require_torch class InformerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (InformerModel, InformerForPrediction) if is_torch_available() else () - all_generative_model_classes = (InformerForPrediction,) if is_torch_available() else () pipeline_model_mapping = {"feature-extraction": InformerModel} if is_torch_available() else {} is_encoder_decoder = True test_pruning = False diff --git a/tests/models/instructblip/test_modeling_instructblip.py b/tests/models/instructblip/test_modeling_instructblip.py index 434784f05a85..e072499ad3f1 100644 --- a/tests/models/instructblip/test_modeling_instructblip.py +++ b/tests/models/instructblip/test_modeling_instructblip.py @@ -477,7 +477,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class InstructBlipForConditionalGenerationDecoderOnlyTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): all_model_classes = (InstructBlipForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (InstructBlipForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = {"image-text-to-text": InstructBlipForConditionalGeneration} fx_compatible = False test_head_masking = False diff --git a/tests/models/instructblipvideo/test_modeling_instructblipvideo.py b/tests/models/instructblipvideo/test_modeling_instructblipvideo.py index e8ed52b72338..0534b4f5ea73 100644 --- a/tests/models/instructblipvideo/test_modeling_instructblipvideo.py +++ b/tests/models/instructblipvideo/test_modeling_instructblipvideo.py @@ -496,7 +496,6 @@ class InstructBlipVideoForConditionalGenerationDecoderOnlyTest( ModelTesterMixin, GenerationTesterMixin, unittest.TestCase ): all_model_classes = (InstructBlipVideoForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (InstructBlipVideoForConditionalGeneration,) if is_torch_available() else () fx_compatible = False test_head_masking = False test_pruning = False diff --git a/tests/models/jamba/test_modeling_jamba.py b/tests/models/jamba/test_modeling_jamba.py index 263b35345ba0..0036c21521cd 100644 --- a/tests/models/jamba/test_modeling_jamba.py +++ b/tests/models/jamba/test_modeling_jamba.py @@ -327,7 +327,6 @@ class JambaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixi if is_torch_available() else () ) - all_generative_model_classes = (JambaForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": JambaModel, diff --git a/tests/models/jetmoe/test_modeling_jetmoe.py b/tests/models/jetmoe/test_modeling_jetmoe.py index 757783950b90..4538ad56108b 100644 --- a/tests/models/jetmoe/test_modeling_jetmoe.py +++ b/tests/models/jetmoe/test_modeling_jetmoe.py @@ -280,7 +280,6 @@ class JetMoeModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMix all_model_classes = ( (JetMoeModel, JetMoeForCausalLM, JetMoeForSequenceClassification) if is_torch_available() else () ) - all_generative_model_classes = (JetMoeForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": JetMoeModel, diff --git a/tests/models/kosmos2/test_modeling_kosmos2.py b/tests/models/kosmos2/test_modeling_kosmos2.py index bb318ba13221..315130b232cf 100644 --- a/tests/models/kosmos2/test_modeling_kosmos2.py +++ b/tests/models/kosmos2/test_modeling_kosmos2.py @@ -259,7 +259,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class Kosmos2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (Kosmos2Model, Kosmos2ForConditionalGeneration) if is_torch_available() else () - all_generative_model_classes = (Kosmos2ForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": Kosmos2Model, diff --git a/tests/models/led/test_modeling_led.py b/tests/models/led/test_modeling_led.py index b6a3db5c943a..4b9d2e283fb8 100644 --- a/tests/models/led/test_modeling_led.py +++ b/tests/models/led/test_modeling_led.py @@ -281,7 +281,6 @@ class LEDModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, if is_torch_available() else () ) - all_generative_model_classes = (LEDForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": LEDModel, diff --git a/tests/models/llama/test_modeling_flax_llama.py b/tests/models/llama/test_modeling_flax_llama.py index a81398786b43..da326e797d61 100644 --- a/tests/models/llama/test_modeling_flax_llama.py +++ b/tests/models/llama/test_modeling_flax_llama.py @@ -176,7 +176,6 @@ def check_use_cache_forward_with_attn_mask(self, model_class_name, config, input @require_flax class FlaxLlamaModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase): all_model_classes = (FlaxLlamaModel, FlaxLlamaForCausalLM) if is_flax_available() else () - all_generative_model_classes = (FlaxLlamaForCausalLM,) if is_flax_available() else () def setUp(self): self.model_tester = FlaxLlamaModelTester(self) diff --git a/tests/models/llama/test_modeling_llama.py b/tests/models/llama/test_modeling_llama.py index c2abf19b2241..01d807fbdba2 100644 --- a/tests/models/llama/test_modeling_llama.py +++ b/tests/models/llama/test_modeling_llama.py @@ -289,7 +289,6 @@ class LlamaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixi if is_torch_available() else () ) - all_generative_model_classes = (LlamaForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": LlamaModel, diff --git a/tests/models/llava/test_modeling_llava.py b/tests/models/llava/test_modeling_llava.py index 5e19a74f221a..25e1a747ce9f 100644 --- a/tests/models/llava/test_modeling_llava.py +++ b/tests/models/llava/test_modeling_llava.py @@ -181,7 +181,6 @@ class LlavaForConditionalGenerationModelTest(ModelTesterMixin, GenerationTesterM """ all_model_classes = (LlavaForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (LlavaForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( {"image-to-text": LlavaForConditionalGeneration, "image-text-to-text": LlavaForConditionalGeneration} if is_torch_available() diff --git a/tests/models/llava_next/test_modeling_llava_next.py b/tests/models/llava_next/test_modeling_llava_next.py index acfd3fde6314..eaeda3cecb7b 100644 --- a/tests/models/llava_next/test_modeling_llava_next.py +++ b/tests/models/llava_next/test_modeling_llava_next.py @@ -215,7 +215,6 @@ class LlavaNextForConditionalGenerationModelTest(ModelTesterMixin, GenerationTes """ all_model_classes = (LlavaNextForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (LlavaNextForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = {"image-text-to-text": LlavaNextForConditionalGeneration} if is_torch_available() else {} test_pruning = False test_head_masking = False diff --git a/tests/models/llava_next_video/test_modeling_llava_next_video.py b/tests/models/llava_next_video/test_modeling_llava_next_video.py index f7cf66b248f3..0f4642402644 100644 --- a/tests/models/llava_next_video/test_modeling_llava_next_video.py +++ b/tests/models/llava_next_video/test_modeling_llava_next_video.py @@ -231,7 +231,6 @@ class LlavaNextVideoForConditionalGenerationModelTest(ModelTesterMixin, Generati """ all_model_classes = (LlavaNextVideoForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (LlavaNextVideoForConditionalGeneration,) if is_torch_available() else () test_pruning = False test_head_masking = False _is_composite = True diff --git a/tests/models/llava_onevision/test_modeling_llava_onevision.py b/tests/models/llava_onevision/test_modeling_llava_onevision.py index 2674aaabd8cc..63be10a774db 100644 --- a/tests/models/llava_onevision/test_modeling_llava_onevision.py +++ b/tests/models/llava_onevision/test_modeling_llava_onevision.py @@ -215,7 +215,6 @@ class LlavaOnevisionForConditionalGenerationModelTest(ModelTesterMixin, Generati """ all_model_classes = (LlavaOnevisionForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (LlavaOnevisionForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( {"image-text-to-text": LlavaOnevisionForConditionalGeneration} if is_torch_available() else {} ) diff --git a/tests/models/longt5/test_modeling_flax_longt5.py b/tests/models/longt5/test_modeling_flax_longt5.py index 9449cfa5e35a..f779ceefc5bd 100644 --- a/tests/models/longt5/test_modeling_flax_longt5.py +++ b/tests/models/longt5/test_modeling_flax_longt5.py @@ -237,7 +237,6 @@ def prepare_config_and_inputs_for_common(self): @require_flax class FlaxLongT5ModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase): all_model_classes = (FlaxLongT5Model, FlaxLongT5ForConditionalGeneration) if is_flax_available() else () - all_generative_model_classes = (FlaxLongT5ForConditionalGeneration,) if is_flax_available() else () is_encoder_decoder = True def setUp(self): diff --git a/tests/models/longt5/test_modeling_longt5.py b/tests/models/longt5/test_modeling_longt5.py index a166a6dab709..38b159679f04 100644 --- a/tests/models/longt5/test_modeling_longt5.py +++ b/tests/models/longt5/test_modeling_longt5.py @@ -502,7 +502,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class LongT5ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (LongT5Model, LongT5ForConditionalGeneration) if is_torch_available() else () - all_generative_model_classes = (LongT5ForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": LongT5Model, diff --git a/tests/models/m2m_100/test_modeling_m2m_100.py b/tests/models/m2m_100/test_modeling_m2m_100.py index b4ddb483d8c7..015a2c5f3875 100644 --- a/tests/models/m2m_100/test_modeling_m2m_100.py +++ b/tests/models/m2m_100/test_modeling_m2m_100.py @@ -240,7 +240,6 @@ class M2M100ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMix if is_torch_available() else () ) - all_generative_model_classes = (M2M100ForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": M2M100Model, diff --git a/tests/models/mamba/test_modeling_mamba.py b/tests/models/mamba/test_modeling_mamba.py index 1ac0a25b6805..0c1bbef910f9 100644 --- a/tests/models/mamba/test_modeling_mamba.py +++ b/tests/models/mamba/test_modeling_mamba.py @@ -239,7 +239,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class MambaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (MambaModel, MambaForCausalLM) if is_torch_available() else () - all_generative_model_classes = (MambaForCausalLM,) if is_torch_available() else () has_attentions = False # Mamba does not support attentions fx_compatible = False # FIXME let's try to support this @ArthurZucker test_torchscript = False # FIXME let's try to support this @ArthurZucker diff --git a/tests/models/mamba2/test_modeling_mamba2.py b/tests/models/mamba2/test_modeling_mamba2.py index c5b787f64389..0fae7e830c07 100644 --- a/tests/models/mamba2/test_modeling_mamba2.py +++ b/tests/models/mamba2/test_modeling_mamba2.py @@ -214,7 +214,6 @@ def create_and_check_mamba2_slow_vs_fast_forward(self, config, input_ids, *args, @require_torch class Mamba2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (Mamba2Model, Mamba2ForCausalLM) if is_torch_available() else () - all_generative_model_classes = (Mamba2ForCausalLM,) if is_torch_available() else () has_attentions = False # Mamba does not support attentions fx_compatible = False # FIXME let's try to support this @molbap test_torchscript = False # FIXME I think this should be doable @molbap @ArthurZucker diff --git a/tests/models/marian/test_modeling_flax_marian.py b/tests/models/marian/test_modeling_flax_marian.py index 6510c0d732d3..9f15291754de 100644 --- a/tests/models/marian/test_modeling_flax_marian.py +++ b/tests/models/marian/test_modeling_flax_marian.py @@ -231,7 +231,6 @@ def check_use_cache_forward_with_attn_mask(self, model_class_name, config, input class FlaxMarianModelTest(FlaxModelTesterMixin, unittest.TestCase, FlaxGenerationTesterMixin): is_encoder_decoder = True all_model_classes = (FlaxMarianModel, FlaxMarianMTModel) if is_flax_available() else () - all_generative_model_classes = (FlaxMarianMTModel,) if is_flax_available() else () def setUp(self): self.model_tester = FlaxMarianModelTester(self) diff --git a/tests/models/marian/test_modeling_marian.py b/tests/models/marian/test_modeling_marian.py index aed5381fcc70..f27ee53575d5 100644 --- a/tests/models/marian/test_modeling_marian.py +++ b/tests/models/marian/test_modeling_marian.py @@ -237,7 +237,6 @@ def check_encoder_decoder_model_standalone(self, config, inputs_dict): @require_torch class MarianModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (MarianModel, MarianMTModel) if is_torch_available() else () - all_generative_model_classes = (MarianMTModel,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": MarianModel, @@ -871,7 +870,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class MarianStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): all_model_classes = (MarianDecoder, MarianForCausalLM) if is_torch_available() else () - all_generative_model_classes = (MarianForCausalLM,) if is_torch_available() else () test_pruning = False is_encoder_decoder = False diff --git a/tests/models/mbart/test_modeling_flax_mbart.py b/tests/models/mbart/test_modeling_flax_mbart.py index 737728587352..6e0230646051 100644 --- a/tests/models/mbart/test_modeling_flax_mbart.py +++ b/tests/models/mbart/test_modeling_flax_mbart.py @@ -342,7 +342,6 @@ class FlaxMBartModelTest(FlaxModelTesterMixin, unittest.TestCase, FlaxGeneration if is_flax_available() else () ) - all_generative_model_classes = (FlaxMBartForConditionalGeneration,) if is_flax_available() else () def setUp(self): self.model_tester = FlaxMBartModelTester(self) diff --git a/tests/models/mbart/test_modeling_mbart.py b/tests/models/mbart/test_modeling_mbart.py index 10b59877f19a..9ff5ef33bdb2 100644 --- a/tests/models/mbart/test_modeling_mbart.py +++ b/tests/models/mbart/test_modeling_mbart.py @@ -229,7 +229,6 @@ class MBartModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixi if is_torch_available() else () ) - all_generative_model_classes = (MBartForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": MBartModel, @@ -727,7 +726,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class MBartStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): all_model_classes = (MBartDecoder, MBartForCausalLM) if is_torch_available() else () - all_generative_model_classes = (MBartForCausalLM,) if is_torch_available() else () test_pruning = False is_encoder_decoder = False diff --git a/tests/models/mistral/test_modeling_flax_mistral.py b/tests/models/mistral/test_modeling_flax_mistral.py index 047bf4c6d433..c78a402fa90c 100644 --- a/tests/models/mistral/test_modeling_flax_mistral.py +++ b/tests/models/mistral/test_modeling_flax_mistral.py @@ -187,7 +187,6 @@ def check_use_cache_forward_with_attn_mask(self, model_class_name, config, input @require_flax class FlaxMistralModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase): all_model_classes = (FlaxMistralModel, FlaxMistralForCausalLM) if is_flax_available() else () - all_generative_model_classes = (FlaxMistralForCausalLM,) if is_flax_available() else () def setUp(self): self.model_tester = FlaxMistralModelTester(self) diff --git a/tests/models/mistral/test_modeling_mistral.py b/tests/models/mistral/test_modeling_mistral.py index c4003da46230..bbd6aee82a78 100644 --- a/tests/models/mistral/test_modeling_mistral.py +++ b/tests/models/mistral/test_modeling_mistral.py @@ -301,7 +301,6 @@ class MistralModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMi if is_torch_available() else () ) - all_generative_model_classes = (MistralForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": MistralModel, diff --git a/tests/models/mixtral/test_modeling_mixtral.py b/tests/models/mixtral/test_modeling_mixtral.py index cf192b8bd79e..7ad879243933 100644 --- a/tests/models/mixtral/test_modeling_mixtral.py +++ b/tests/models/mixtral/test_modeling_mixtral.py @@ -300,7 +300,6 @@ class MixtralModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMi if is_torch_available() else () ) - all_generative_model_classes = (MixtralForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": MixtralModel, diff --git a/tests/models/mllama/test_modeling_mllama.py b/tests/models/mllama/test_modeling_mllama.py index 40541fc8277d..9dcc712346a9 100644 --- a/tests/models/mllama/test_modeling_mllama.py +++ b/tests/models/mllama/test_modeling_mllama.py @@ -124,7 +124,6 @@ class MllamaForCausalLMModelTest(ModelTesterMixin, GenerationTesterMixin, unitte """ all_model_classes = (MllamaForCausalLM,) if is_torch_available() else () - all_generative_model_classes = (MllamaForCausalLM,) if is_torch_available() else () test_pruning = False test_head_masking = False @@ -264,7 +263,6 @@ class MllamaForConditionalGenerationModelTest(ModelTesterMixin, GenerationTester """ all_model_classes = (MllamaForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (MllamaForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = {"image-text-to-text": MllamaForConditionalGeneration} if is_torch_available() else () test_pruning = False test_head_masking = False diff --git a/tests/models/modernbert/test_modeling_modernbert.py b/tests/models/modernbert/test_modeling_modernbert.py index c7c34bf06150..5cd26b352366 100644 --- a/tests/models/modernbert/test_modeling_modernbert.py +++ b/tests/models/modernbert/test_modeling_modernbert.py @@ -229,7 +229,6 @@ class ModernBertModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTeste if is_torch_available() else () ) - all_generative_model_classes = () pipeline_model_mapping = ( { "feature-extraction": ModernBertModel, diff --git a/tests/models/moonshine/test_modeling_moonshine.py b/tests/models/moonshine/test_modeling_moonshine.py index 465ecec2083c..bf30f2c3d522 100644 --- a/tests/models/moonshine/test_modeling_moonshine.py +++ b/tests/models/moonshine/test_modeling_moonshine.py @@ -170,6 +170,8 @@ def prepare_config_and_inputs_for_common(self): @require_torch class MoonshineModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (MoonshineModel, MoonshineForConditionalGeneration) if is_torch_available() else () + # Doesn't run generation tests. TODO (eustache): remove this line and then make CI green + all_generative_model_classes = () pipeline_model_mapping = ( { "automatic-speech-recognition": MoonshineForConditionalGeneration, diff --git a/tests/models/moshi/test_modeling_moshi.py b/tests/models/moshi/test_modeling_moshi.py index f637fb9efa32..37b4bc46baa6 100644 --- a/tests/models/moshi/test_modeling_moshi.py +++ b/tests/models/moshi/test_modeling_moshi.py @@ -152,9 +152,6 @@ def prepare_config_and_inputs_for_common(self, batch_size=None): @require_torch class MoshiDecoderTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (MoshiModel, MoshiForCausalLM) if is_torch_available() else () - all_generative_model_classes = ( - (MoshiForCausalLM,) if is_torch_available() else () - ) # we don't want to run all the generation tests, only a specific subset test_pruning = False test_resize_embeddings = True test_head_masking = False @@ -528,7 +525,6 @@ def prepare_config_and_inputs_for_common(self, batch_size=None): @require_torch class MoshiTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): all_model_classes = (MoshiForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (MoshiForConditionalGeneration,) if is_torch_available() else () test_pruning = False # training is not supported yet for Moshi test_headmasking = False test_resize_embeddings = False diff --git a/tests/models/mpt/test_modeling_mpt.py b/tests/models/mpt/test_modeling_mpt.py index 5507c127bb94..1f581f875cd1 100644 --- a/tests/models/mpt/test_modeling_mpt.py +++ b/tests/models/mpt/test_modeling_mpt.py @@ -354,7 +354,6 @@ class MptModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, else () ) - all_generative_model_classes = (MptForCausalLM,) if is_torch_available() else () fx_compatible = False test_missing_keys = False test_pruning = False diff --git a/tests/models/mra/test_modeling_mra.py b/tests/models/mra/test_modeling_mra.py index cb5713bc2b59..dfeebf28bcf6 100644 --- a/tests/models/mra/test_modeling_mra.py +++ b/tests/models/mra/test_modeling_mra.py @@ -298,7 +298,6 @@ class MraModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): test_torchscript = False has_attentions = False - all_generative_model_classes = () pipeline_model_mapping = ( { "feature-extraction": MraModel, diff --git a/tests/models/mt5/test_modeling_mt5.py b/tests/models/mt5/test_modeling_mt5.py index 1628d3a5893e..3c3256da8b24 100644 --- a/tests/models/mt5/test_modeling_mt5.py +++ b/tests/models/mt5/test_modeling_mt5.py @@ -553,7 +553,6 @@ class MT5ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, if is_torch_available() else () ) - all_generative_model_classes = (MT5ForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": MT5Model, diff --git a/tests/models/musicgen/test_modeling_musicgen.py b/tests/models/musicgen/test_modeling_musicgen.py index c1aba2838273..3852d8c3c4ff 100644 --- a/tests/models/musicgen/test_modeling_musicgen.py +++ b/tests/models/musicgen/test_modeling_musicgen.py @@ -176,6 +176,8 @@ def prepare_config_and_inputs_for_common(self): @require_torch class MusicgenDecoderTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (MusicgenModel, MusicgenForCausalLM) if is_torch_available() else () + # Doesn't run generation tests. See `greedy_sample_model_classes` below + all_generative_model_classes = () greedy_sample_model_classes = ( (MusicgenForCausalLM,) if is_torch_available() else () ) # we don't want to run all the generation tests, only a specific subset @@ -801,6 +803,8 @@ def prepare_config_and_inputs_for_common(self): @require_torch class MusicgenTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (MusicgenForConditionalGeneration,) if is_torch_available() else () + # Doesn't run generation tests. See `greedy_sample_model_classes` below + all_generative_model_classes = () greedy_sample_model_classes = (MusicgenForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = {"text-to-audio": MusicgenForConditionalGeneration} if is_torch_available() else {} test_pruning = False # training is not supported yet for MusicGen diff --git a/tests/models/musicgen_melody/test_modeling_musicgen_melody.py b/tests/models/musicgen_melody/test_modeling_musicgen_melody.py index 0066c08720d6..7cb31adaedbd 100644 --- a/tests/models/musicgen_melody/test_modeling_musicgen_melody.py +++ b/tests/models/musicgen_melody/test_modeling_musicgen_melody.py @@ -182,6 +182,8 @@ def prepare_config_and_inputs_for_common(self): @require_torch class MusicgenMelodyDecoderTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): all_model_classes = (MusicgenMelodyModel, MusicgenMelodyForCausalLM) if is_torch_available() else () + # Doesn't run generation tests. See `greedy_sample_model_classes` below + all_generative_model_classes = () greedy_sample_model_classes = ( (MusicgenMelodyForCausalLM,) if is_torch_available() else () ) # the model uses a custom generation method so we only run a specific subset of the generation tests @@ -820,6 +822,8 @@ def prepare_config_and_inputs_for_common(self): # Copied from tests.models.musicgen.test_modeling_musicgen.MusicgenTest with Musicgen->MusicgenMelody, musicgen->musicgen_melody, EncoderDecoder->DecoderOnly, input_values->input_features class MusicgenMelodyTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (MusicgenMelodyForConditionalGeneration,) if is_torch_available() else () + # Doesn't run generation tests. See `greedy_sample_model_classes` below + all_generative_model_classes = () greedy_sample_model_classes = (MusicgenMelodyForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = {"text-to-audio": MusicgenMelodyForConditionalGeneration} if is_torch_available() else {} test_pruning = False # training is not supported yet for MusicGen diff --git a/tests/models/mvp/test_modeling_mvp.py b/tests/models/mvp/test_modeling_mvp.py index 92aa2d27d731..52734b2eb8dd 100644 --- a/tests/models/mvp/test_modeling_mvp.py +++ b/tests/models/mvp/test_modeling_mvp.py @@ -418,7 +418,6 @@ class MvpModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, if is_torch_available() else () ) - all_generative_model_classes = (MvpForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": MvpModel, @@ -803,7 +802,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class MvpStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): all_model_classes = (MvpDecoder, MvpForCausalLM) if is_torch_available() else () - all_generative_model_classes = (MvpForCausalLM,) if is_torch_available() else () fx_comptatible = True test_pruning = False is_encoder_decoder = False diff --git a/tests/models/nemotron/test_modeling_nemotron.py b/tests/models/nemotron/test_modeling_nemotron.py index 249706c1c470..fd905f8e0c59 100644 --- a/tests/models/nemotron/test_modeling_nemotron.py +++ b/tests/models/nemotron/test_modeling_nemotron.py @@ -75,7 +75,6 @@ class NemotronModelTest(GemmaModelTest): if is_torch_available() else () ) - all_generative_model_classes = (NemotronForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": NemotronModel, diff --git a/tests/models/nllb_moe/test_modeling_nllb_moe.py b/tests/models/nllb_moe/test_modeling_nllb_moe.py index 851bb25edfb5..b3ae5779bd27 100644 --- a/tests/models/nllb_moe/test_modeling_nllb_moe.py +++ b/tests/models/nllb_moe/test_modeling_nllb_moe.py @@ -247,7 +247,6 @@ def check_encoder_decoder_model_standalone(self, config, inputs_dict): @require_torch class NllbMoeModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (NllbMoeModel, NllbMoeForConditionalGeneration) if is_torch_available() else () - all_generative_model_classes = (NllbMoeForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": NllbMoeModel, diff --git a/tests/models/olmo/test_modeling_olmo.py b/tests/models/olmo/test_modeling_olmo.py index 22e85bc339d8..a96eb9111359 100644 --- a/tests/models/olmo/test_modeling_olmo.py +++ b/tests/models/olmo/test_modeling_olmo.py @@ -274,7 +274,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class OlmoModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (OlmoModel, OlmoForCausalLM) if is_torch_available() else () - all_generative_model_classes = (OlmoForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": OlmoModel, diff --git a/tests/models/olmo2/test_modeling_olmo2.py b/tests/models/olmo2/test_modeling_olmo2.py index ce2bd0519314..51496188f9fc 100644 --- a/tests/models/olmo2/test_modeling_olmo2.py +++ b/tests/models/olmo2/test_modeling_olmo2.py @@ -273,7 +273,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class Olmo2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (Olmo2Model, Olmo2ForCausalLM) if is_torch_available() else () - all_generative_model_classes = (Olmo2ForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": Olmo2Model, diff --git a/tests/models/olmoe/test_modeling_olmoe.py b/tests/models/olmoe/test_modeling_olmoe.py index c95b68625d0a..07d904699faa 100644 --- a/tests/models/olmoe/test_modeling_olmoe.py +++ b/tests/models/olmoe/test_modeling_olmoe.py @@ -287,7 +287,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class OlmoeModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (OlmoeModel, OlmoeForCausalLM) if is_torch_available() else () - all_generative_model_classes = (OlmoeForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": OlmoeModel, diff --git a/tests/models/openai/test_modeling_openai.py b/tests/models/openai/test_modeling_openai.py index 8a61b05e831d..c47485568496 100644 --- a/tests/models/openai/test_modeling_openai.py +++ b/tests/models/openai/test_modeling_openai.py @@ -195,9 +195,6 @@ class OpenAIGPTModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTester if is_torch_available() else () ) - all_generative_model_classes = ( - (OpenAIGPTLMHeadModel,) if is_torch_available() else () - ) # TODO (PVP): Add Double HeadsModel when generate() function is changed accordingly pipeline_model_mapping = ( { "feature-extraction": OpenAIGPTModel, diff --git a/tests/models/opt/test_modeling_flax_opt.py b/tests/models/opt/test_modeling_flax_opt.py index 5ebf23d86a32..c5c3d10f23c5 100644 --- a/tests/models/opt/test_modeling_flax_opt.py +++ b/tests/models/opt/test_modeling_flax_opt.py @@ -205,7 +205,6 @@ def check_use_cache_forward_with_attn_mask(self, model_class_name, config, input @require_flax class FlaxOPTModelTest(FlaxModelTesterMixin, unittest.TestCase, FlaxGenerationTesterMixin): all_model_classes = (FlaxOPTModel, FlaxOPTForCausalLM) if is_flax_available() else () - all_generative_model_classes = () if is_flax_available() else () def setUp(self): self.model_tester = FlaxOPTModelTester(self) diff --git a/tests/models/opt/test_modeling_opt.py b/tests/models/opt/test_modeling_opt.py index 8bae2af80450..3e3d2159a022 100644 --- a/tests/models/opt/test_modeling_opt.py +++ b/tests/models/opt/test_modeling_opt.py @@ -211,7 +211,6 @@ class OPTModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, if is_torch_available() else () ) - all_generative_model_classes = (OPTForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": OPTModel, diff --git a/tests/models/paligemma/test_modeling_paligemma.py b/tests/models/paligemma/test_modeling_paligemma.py index 7d686576bd83..570ccf374272 100644 --- a/tests/models/paligemma/test_modeling_paligemma.py +++ b/tests/models/paligemma/test_modeling_paligemma.py @@ -179,7 +179,6 @@ class PaliGemmaForConditionalGenerationModelTest(ModelTesterMixin, GenerationTes """ all_model_classes = (PaliGemmaForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (PaliGemmaForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = {"image-text-to-text": PaliGemmaForConditionalGeneration} fx_compatible = False test_pruning = False diff --git a/tests/models/paligemma2/test_modeling_paligemma2.py b/tests/models/paligemma2/test_modeling_paligemma2.py index 451d4cc17a06..8eb9c9a2d92f 100644 --- a/tests/models/paligemma2/test_modeling_paligemma2.py +++ b/tests/models/paligemma2/test_modeling_paligemma2.py @@ -175,7 +175,6 @@ class PaliGemma2ForConditionalGenerationModelTest(ModelTesterMixin, GenerationTe """ all_model_classes = (PaliGemmaForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (PaliGemmaForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = {"image-text-to-text": PaliGemmaForConditionalGeneration} fx_compatible = False test_pruning = False diff --git a/tests/models/patchtsmixer/test_modeling_patchtsmixer.py b/tests/models/patchtsmixer/test_modeling_patchtsmixer.py index 7c8e0be72be1..939072d825fe 100644 --- a/tests/models/patchtsmixer/test_modeling_patchtsmixer.py +++ b/tests/models/patchtsmixer/test_modeling_patchtsmixer.py @@ -219,9 +219,6 @@ class PatchTSMixerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test if is_torch_available() else () ) - all_generative_model_classes = ( - (PatchTSMixerForPrediction, PatchTSMixerForPretraining) if is_torch_available() else () - ) pipeline_model_mapping = {"feature-extraction": PatchTSMixerModel} if is_torch_available() else {} is_encoder_decoder = False test_pruning = False diff --git a/tests/models/pegasus/test_modeling_flax_pegasus.py b/tests/models/pegasus/test_modeling_flax_pegasus.py index 62b9077f0d47..e70770ccc1cd 100644 --- a/tests/models/pegasus/test_modeling_flax_pegasus.py +++ b/tests/models/pegasus/test_modeling_flax_pegasus.py @@ -230,7 +230,6 @@ class FlaxPegasusModelTest(FlaxModelTesterMixin, unittest.TestCase): if is_flax_available() else () ) - all_generative_model_classes = (FlaxPegasusForConditionalGeneration,) if is_flax_available() else () is_encoder_decoder = True test_pruning = False test_head_masking = False diff --git a/tests/models/pegasus/test_modeling_pegasus.py b/tests/models/pegasus/test_modeling_pegasus.py index 2bd102b904e3..90e0fcaabc91 100644 --- a/tests/models/pegasus/test_modeling_pegasus.py +++ b/tests/models/pegasus/test_modeling_pegasus.py @@ -235,7 +235,6 @@ def check_encoder_decoder_model_standalone(self, config, inputs_dict): @require_torch class PegasusModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (PegasusModel, PegasusForConditionalGeneration) if is_torch_available() else () - all_generative_model_classes = (PegasusForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": PegasusModel, @@ -562,7 +561,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class PegasusStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): all_model_classes = (PegasusDecoder, PegasusForCausalLM) if is_torch_available() else () - all_generative_model_classes = (PegasusForCausalLM,) if is_torch_available() else () test_resize_position_embeddings = True test_pruning = False is_encoder_decoder = False diff --git a/tests/models/pegasus_x/test_modeling_pegasus_x.py b/tests/models/pegasus_x/test_modeling_pegasus_x.py index 2c3b74edd17a..97451ce766a1 100644 --- a/tests/models/pegasus_x/test_modeling_pegasus_x.py +++ b/tests/models/pegasus_x/test_modeling_pegasus_x.py @@ -203,7 +203,6 @@ def check_encoder_decoder_model_standalone(self, config, inputs_dict): @require_torch class PegasusXModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (PegasusXModel, PegasusXForConditionalGeneration) if is_torch_available() else () - all_generative_model_classes = (PegasusXForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": PegasusXModel, @@ -850,7 +849,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class PegasusXStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): all_model_classes = (PegasusXDecoder,) if is_torch_available() else () - all_generative_model_classes = () test_pruning = False is_encoder_decoder = False test_head_masking = False diff --git a/tests/models/persimmon/test_modeling_persimmon.py b/tests/models/persimmon/test_modeling_persimmon.py index c8725a5badce..744788cf6447 100644 --- a/tests/models/persimmon/test_modeling_persimmon.py +++ b/tests/models/persimmon/test_modeling_persimmon.py @@ -296,7 +296,6 @@ class PersimmonModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTester else {} ) - all_generative_model_classes = (PersimmonForCausalLM,) if is_torch_available() else () test_headmasking = False test_pruning = False diff --git a/tests/models/phi/test_modeling_phi.py b/tests/models/phi/test_modeling_phi.py index c54d4ebee5c3..9b7d44ca1cb7 100644 --- a/tests/models/phi/test_modeling_phi.py +++ b/tests/models/phi/test_modeling_phi.py @@ -278,7 +278,6 @@ class PhiModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, if is_torch_available() else () ) - all_generative_model_classes = (PhiForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": PhiModel, diff --git a/tests/models/phi3/test_modeling_phi3.py b/tests/models/phi3/test_modeling_phi3.py index 1b2717858784..a6a9ab4e63f2 100644 --- a/tests/models/phi3/test_modeling_phi3.py +++ b/tests/models/phi3/test_modeling_phi3.py @@ -333,7 +333,6 @@ class Phi3ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin if is_torch_available() else () ) - all_generative_model_classes = (Phi3ForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": Phi3Model, diff --git a/tests/models/phimoe/test_modeling_phimoe.py b/tests/models/phimoe/test_modeling_phimoe.py index 9ce4ae009104..40448a0a85e8 100644 --- a/tests/models/phimoe/test_modeling_phimoe.py +++ b/tests/models/phimoe/test_modeling_phimoe.py @@ -338,7 +338,6 @@ class PhimoeModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMix all_model_classes = ( (PhimoeModel, PhimoeForCausalLM, PhimoeForSequenceClassification) if is_torch_available() else () ) - all_generative_model_classes = (PhimoeForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": PhimoeModel, diff --git a/tests/models/pix2struct/test_modeling_pix2struct.py b/tests/models/pix2struct/test_modeling_pix2struct.py index 3b051db37c91..cbef43f3fb33 100644 --- a/tests/models/pix2struct/test_modeling_pix2struct.py +++ b/tests/models/pix2struct/test_modeling_pix2struct.py @@ -421,7 +421,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class Pix2StructModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (Pix2StructForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (Pix2StructForConditionalGeneration,) if is_torch_available() else {} pipeline_model_mapping = ( {"image-to-text": Pix2StructForConditionalGeneration, "image-text-to-text": Pix2StructForConditionalGeneration} if is_torch_available() diff --git a/tests/models/plbart/test_modeling_plbart.py b/tests/models/plbart/test_modeling_plbart.py index 6f38539a6341..6a4e5df59921 100644 --- a/tests/models/plbart/test_modeling_plbart.py +++ b/tests/models/plbart/test_modeling_plbart.py @@ -224,7 +224,6 @@ class PLBartModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMix all_model_classes = ( (PLBartModel, PLBartForConditionalGeneration, PLBartForSequenceClassification) if is_torch_available() else () ) - all_generative_model_classes = (PLBartForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": PLBartModel, @@ -658,7 +657,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class PLBartStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): all_model_classes = (PLBartDecoder, PLBartForCausalLM) if is_torch_available() else () - all_generative_model_classes = (PLBartForCausalLM,) if is_torch_available() else () test_pruning = False is_encoder_decoder = False diff --git a/tests/models/pop2piano/test_modeling_pop2piano.py b/tests/models/pop2piano/test_modeling_pop2piano.py index 47cf47f6adaa..50d25aaf5cca 100644 --- a/tests/models/pop2piano/test_modeling_pop2piano.py +++ b/tests/models/pop2piano/test_modeling_pop2piano.py @@ -507,6 +507,7 @@ def prepare_config_and_inputs_for_common(self): @require_torch class Pop2PianoModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (Pop2PianoForConditionalGeneration,) if is_torch_available() else () + # Doesn't run generation tests. Has custom generation method with a different interface all_generative_model_classes = () pipeline_model_mapping = ( {"automatic-speech-recognition": Pop2PianoForConditionalGeneration} if is_torch_available() else {} diff --git a/tests/models/prophetnet/test_modeling_prophetnet.py b/tests/models/prophetnet/test_modeling_prophetnet.py index 1f86a7662c8f..2687cd67f7fd 100644 --- a/tests/models/prophetnet/test_modeling_prophetnet.py +++ b/tests/models/prophetnet/test_modeling_prophetnet.py @@ -888,7 +888,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class ProphetNetModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (ProphetNetModel, ProphetNetForConditionalGeneration) if is_torch_available() else () - all_generative_model_classes = (ProphetNetForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": ProphetNetModel, @@ -1127,7 +1126,6 @@ def test_generate_with_head_masking(self): @require_torch class ProphetNetStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): all_model_classes = (ProphetNetDecoder, ProphetNetForCausalLM) if is_torch_available() else () - all_generative_model_classes = (ProphetNetForCausalLM,) if is_torch_available() else () test_pruning = False test_resize_embeddings = False diff --git a/tests/models/qwen2/test_modeling_qwen2.py b/tests/models/qwen2/test_modeling_qwen2.py index e426aee98c24..e4b9a299e8f6 100644 --- a/tests/models/qwen2/test_modeling_qwen2.py +++ b/tests/models/qwen2/test_modeling_qwen2.py @@ -312,7 +312,6 @@ class Qwen2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixi if is_torch_available() else () ) - all_generative_model_classes = (Qwen2ForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": Qwen2Model, diff --git a/tests/models/qwen2_5_vl/test_modeling_qwen2_5_vl.py b/tests/models/qwen2_5_vl/test_modeling_qwen2_5_vl.py index a0628e15b179..cfcfd3a620c9 100644 --- a/tests/models/qwen2_5_vl/test_modeling_qwen2_5_vl.py +++ b/tests/models/qwen2_5_vl/test_modeling_qwen2_5_vl.py @@ -229,7 +229,6 @@ class Qwen2_5_VLModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.Test """ all_model_classes = (Qwen2_5_VLForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (Qwen2_5_VLForConditionalGeneration,) if is_torch_available() else () test_pruning = False test_head_masking = False diff --git a/tests/models/qwen2_moe/test_modeling_qwen2_moe.py b/tests/models/qwen2_moe/test_modeling_qwen2_moe.py index 126450eacc5b..570b678ec3eb 100644 --- a/tests/models/qwen2_moe/test_modeling_qwen2_moe.py +++ b/tests/models/qwen2_moe/test_modeling_qwen2_moe.py @@ -337,7 +337,6 @@ class Qwen2MoeModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterM if is_torch_available() else () ) - all_generative_model_classes = (Qwen2MoeForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": Qwen2MoeModel, diff --git a/tests/models/qwen2_vl/test_modeling_qwen2_vl.py b/tests/models/qwen2_vl/test_modeling_qwen2_vl.py index 68f94bc8f8a0..655effb09d74 100644 --- a/tests/models/qwen2_vl/test_modeling_qwen2_vl.py +++ b/tests/models/qwen2_vl/test_modeling_qwen2_vl.py @@ -225,7 +225,6 @@ class Qwen2VLModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCas """ all_model_classes = (Qwen2VLForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (Qwen2VLForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = {"image-text-to-text": Qwen2VLForConditionalGeneration} test_pruning = False test_head_masking = False diff --git a/tests/models/recurrent_gemma/test_modeling_recurrent_gemma.py b/tests/models/recurrent_gemma/test_modeling_recurrent_gemma.py index a7cfc2a04f58..3519604c8c0e 100644 --- a/tests/models/recurrent_gemma/test_modeling_recurrent_gemma.py +++ b/tests/models/recurrent_gemma/test_modeling_recurrent_gemma.py @@ -283,7 +283,8 @@ def prepare_config_and_inputs_for_common(self): @require_torch class RecurrentGemmaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (RecurrentGemmaForCausalLM,) if is_torch_available() else () - # all_generative_model_classes = (RecurrentGemmaForCausalLM,) if is_torch_available() else () #TODO @gante not fully supported + # Doesn't run generation tests. TODO @gante not fully supported + all_generative_model_classes = () pipeline_model_mapping = ( { "feature-extraction": RecurrentGemmaModel, diff --git a/tests/models/reformer/test_modeling_reformer.py b/tests/models/reformer/test_modeling_reformer.py index 24b59b2f1b87..d7e1e3c69153 100644 --- a/tests/models/reformer/test_modeling_reformer.py +++ b/tests/models/reformer/test_modeling_reformer.py @@ -603,7 +603,6 @@ class ReformerLocalAttnModelTest(ReformerTesterMixin, GenerationTesterMixin, Mod if is_torch_available() else () ) - all_generative_model_classes = (ReformerModelWithLMHead,) if is_torch_available() else () test_pruning = False test_headmasking = False test_torchscript = False @@ -716,7 +715,6 @@ class ReformerLSHAttnModelTest( if is_torch_available() else () ) - all_generative_model_classes = (ReformerModelWithLMHead,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": ReformerModel, diff --git a/tests/models/rembert/test_modeling_rembert.py b/tests/models/rembert/test_modeling_rembert.py index f0e9e7a050b1..d5f9e0d5eccf 100644 --- a/tests/models/rembert/test_modeling_rembert.py +++ b/tests/models/rembert/test_modeling_rembert.py @@ -373,7 +373,6 @@ class RemBertModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase) if is_torch_available() else () ) - all_generative_model_classes = (RemBertForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": RemBertModel, diff --git a/tests/models/roberta/test_modeling_roberta.py b/tests/models/roberta/test_modeling_roberta.py index 11171ee93453..5d688075a803 100644 --- a/tests/models/roberta/test_modeling_roberta.py +++ b/tests/models/roberta/test_modeling_roberta.py @@ -380,7 +380,6 @@ class RobertaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMi if is_torch_available() else () ) - all_generative_model_classes = (RobertaForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": RobertaModel, diff --git a/tests/models/roberta_prelayernorm/test_modeling_roberta_prelayernorm.py b/tests/models/roberta_prelayernorm/test_modeling_roberta_prelayernorm.py index 1333e2d5989f..11fbf6de35a3 100644 --- a/tests/models/roberta_prelayernorm/test_modeling_roberta_prelayernorm.py +++ b/tests/models/roberta_prelayernorm/test_modeling_roberta_prelayernorm.py @@ -378,7 +378,6 @@ class RobertaPreLayerNormModelTest(ModelTesterMixin, GenerationTesterMixin, Pipe if is_torch_available() else () ) - all_generative_model_classes = (RobertaPreLayerNormForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": RobertaPreLayerNormModel, diff --git a/tests/models/roc_bert/test_modeling_roc_bert.py b/tests/models/roc_bert/test_modeling_roc_bert.py index b1c7fa652134..2f13664e18b8 100644 --- a/tests/models/roc_bert/test_modeling_roc_bert.py +++ b/tests/models/roc_bert/test_modeling_roc_bert.py @@ -570,7 +570,6 @@ class RoCBertModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase) if is_torch_available() else () ) - all_generative_model_classes = (RoCBertForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": RoCBertModel, diff --git a/tests/models/roformer/test_modeling_roformer.py b/tests/models/roformer/test_modeling_roformer.py index bdae0aea13dc..7ad8165c8483 100644 --- a/tests/models/roformer/test_modeling_roformer.py +++ b/tests/models/roformer/test_modeling_roformer.py @@ -392,7 +392,6 @@ class RoFormerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase if is_torch_available() else () ) - all_generative_model_classes = (RoFormerForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": RoFormerModel, diff --git a/tests/models/rwkv/test_modeling_rwkv.py b/tests/models/rwkv/test_modeling_rwkv.py index 6517c96509c4..bade708ff9bc 100644 --- a/tests/models/rwkv/test_modeling_rwkv.py +++ b/tests/models/rwkv/test_modeling_rwkv.py @@ -234,7 +234,6 @@ class RwkvModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin pipeline_model_mapping = ( {"feature-extraction": RwkvModel, "text-generation": RwkvForCausalLM} if is_torch_available() else {} ) - all_generative_model_classes = (RwkvForCausalLM,) if is_torch_available() else () fx_compatible = False test_missing_keys = False test_model_parallel = False diff --git a/tests/models/seamless_m4t/test_modeling_seamless_m4t.py b/tests/models/seamless_m4t/test_modeling_seamless_m4t.py index cb09d44421f4..a68030c86b17 100644 --- a/tests/models/seamless_m4t/test_modeling_seamless_m4t.py +++ b/tests/models/seamless_m4t/test_modeling_seamless_m4t.py @@ -358,7 +358,6 @@ class SeamlessM4TModelWithSpeechInputTest(ModelTesterMixin, unittest.TestCase): if is_torch_available() else () ) - all_generative_model_classes = (SeamlessM4TForSpeechToText,) if is_torch_available() else () def setUp(self): self.model_tester = SeamlessM4TModelTester(self, input_modality="speech") @@ -602,7 +601,8 @@ class SeamlessM4TModelWithTextInputTest( if is_torch_available() else () ) - all_generative_model_classes = (SeamlessM4TForTextToText,) if is_torch_available() else () + # Doesn't run generation tests. Has custom generation method with a different interface + all_generative_model_classes = () pipeline_model_mapping = ( { "automatic-speech-recognition": SeamlessM4TForSpeechToText, diff --git a/tests/models/seamless_m4t_v2/test_modeling_seamless_m4t_v2.py b/tests/models/seamless_m4t_v2/test_modeling_seamless_m4t_v2.py index 276375c7e854..c53bc4a8b186 100644 --- a/tests/models/seamless_m4t_v2/test_modeling_seamless_m4t_v2.py +++ b/tests/models/seamless_m4t_v2/test_modeling_seamless_m4t_v2.py @@ -374,7 +374,6 @@ class SeamlessM4Tv2ModelWithSpeechInputTest(ModelTesterMixin, unittest.TestCase) if is_torch_available() else () ) - all_generative_model_classes = (SeamlessM4Tv2ForSpeechToText,) if is_torch_available() else () def setUp(self): self.model_tester = SeamlessM4Tv2ModelTester(self, input_modality="speech") @@ -615,7 +614,8 @@ class SeamlessM4Tv2ModelWithTextInputTest(ModelTesterMixin, GenerationTesterMixi if is_torch_available() else () ) - all_generative_model_classes = (SeamlessM4Tv2ForTextToText,) if is_torch_available() else () + # Doesn't run generation tests. Has custom generation method with a different interface + all_generative_model_classes = () def setUp(self): self.model_tester = SeamlessM4Tv2ModelTester(self, input_modality="text") diff --git a/tests/models/speech_to_text/test_modeling_speech_to_text.py b/tests/models/speech_to_text/test_modeling_speech_to_text.py index 253cda7e49cb..7250cc221098 100644 --- a/tests/models/speech_to_text/test_modeling_speech_to_text.py +++ b/tests/models/speech_to_text/test_modeling_speech_to_text.py @@ -271,7 +271,6 @@ def check_encoder_decoder_model_standalone(self, config, inputs_dict): @require_torch class Speech2TextModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (Speech2TextModel, Speech2TextForConditionalGeneration) if is_torch_available() else () - all_generative_model_classes = (Speech2TextForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( {"automatic-speech-recognition": Speech2TextForConditionalGeneration, "feature-extraction": Speech2TextModel} if is_torch_available() diff --git a/tests/models/speecht5/test_modeling_speecht5.py b/tests/models/speecht5/test_modeling_speecht5.py index 38f75ac5c01d..efc384e7051d 100644 --- a/tests/models/speecht5/test_modeling_speecht5.py +++ b/tests/models/speecht5/test_modeling_speecht5.py @@ -362,7 +362,6 @@ def create_and_check_decoder_model_past_large_inputs(self, config, inputs_dict): @require_torch class SpeechT5ForSpeechToTextTest(ModelTesterMixin, unittest.TestCase): all_model_classes = (SpeechT5ForSpeechToText,) if is_torch_available() else () - all_generative_model_classes = (SpeechT5ForSpeechToText,) if is_torch_available() else () is_encoder_decoder = True test_pruning = False test_headmasking = False @@ -880,7 +879,6 @@ def create_and_check_model_forward(self, config, inputs_dict): @require_torch class SpeechT5ForTextToSpeechTest(ModelTesterMixin, unittest.TestCase): all_model_classes = (SpeechT5ForTextToSpeech,) if is_torch_available() else () - all_generative_model_classes = (SpeechT5ForTextToSpeech,) if is_torch_available() else () is_encoder_decoder = True test_pruning = False test_headmasking = False @@ -1423,7 +1421,6 @@ def create_and_check_model_forward(self, config, inputs_dict): @require_torch class SpeechT5ForSpeechToSpeechTest(ModelTesterMixin, unittest.TestCase): all_model_classes = (SpeechT5ForSpeechToSpeech,) if is_torch_available() else () - all_generative_model_classes = (SpeechT5ForSpeechToSpeech,) if is_torch_available() else () is_encoder_decoder = True test_pruning = False test_headmasking = False diff --git a/tests/models/stablelm/test_modeling_stablelm.py b/tests/models/stablelm/test_modeling_stablelm.py index 7c237b0bcfc1..946b220e0ea9 100644 --- a/tests/models/stablelm/test_modeling_stablelm.py +++ b/tests/models/stablelm/test_modeling_stablelm.py @@ -299,7 +299,6 @@ class StableLmModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterM else {} ) - all_generative_model_classes = (StableLmForCausalLM,) if is_torch_available() else () test_headmasking = False test_pruning = False diff --git a/tests/models/starcoder2/test_modeling_starcoder2.py b/tests/models/starcoder2/test_modeling_starcoder2.py index d6993469e043..9f06697a1948 100644 --- a/tests/models/starcoder2/test_modeling_starcoder2.py +++ b/tests/models/starcoder2/test_modeling_starcoder2.py @@ -294,7 +294,6 @@ class Starcoder2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTeste if is_torch_available() else () ) - all_generative_model_classes = (Starcoder2ForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": Starcoder2Model, diff --git a/tests/models/superglue/test_modeling_superglue.py b/tests/models/superglue/test_modeling_superglue.py index 0dda82ed8ad9..1d6ccc59d619 100644 --- a/tests/models/superglue/test_modeling_superglue.py +++ b/tests/models/superglue/test_modeling_superglue.py @@ -119,7 +119,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class SuperGlueModelTest(ModelTesterMixin, unittest.TestCase): all_model_classes = (SuperGlueForKeypointMatching,) if is_torch_available() else () - all_generative_model_classes = () if is_torch_available() else () fx_compatible = False test_pruning = False diff --git a/tests/models/superpoint/test_modeling_superpoint.py b/tests/models/superpoint/test_modeling_superpoint.py index 11f4fe11fc76..6fe2df000255 100644 --- a/tests/models/superpoint/test_modeling_superpoint.py +++ b/tests/models/superpoint/test_modeling_superpoint.py @@ -113,7 +113,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class SuperPointModelTest(ModelTesterMixin, unittest.TestCase): all_model_classes = (SuperPointForKeypointDetection,) if is_torch_available() else () - all_generative_model_classes = () if is_torch_available() else () fx_compatible = False test_pruning = False diff --git a/tests/models/switch_transformers/test_modeling_switch_transformers.py b/tests/models/switch_transformers/test_modeling_switch_transformers.py index 32597f8ce286..03de2f72d01d 100644 --- a/tests/models/switch_transformers/test_modeling_switch_transformers.py +++ b/tests/models/switch_transformers/test_modeling_switch_transformers.py @@ -557,7 +557,6 @@ class SwitchTransformersModelTest(ModelTesterMixin, GenerationTesterMixin, Pipel all_model_classes = ( (SwitchTransformersModel, SwitchTransformersForConditionalGeneration) if is_torch_available() else () ) - all_generative_model_classes = (SwitchTransformersForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": SwitchTransformersModel, diff --git a/tests/models/t5/test_modeling_flax_t5.py b/tests/models/t5/test_modeling_flax_t5.py index 204b84989be0..516fb5c6d528 100644 --- a/tests/models/t5/test_modeling_flax_t5.py +++ b/tests/models/t5/test_modeling_flax_t5.py @@ -229,7 +229,6 @@ def prepare_config_and_inputs_for_common(self): @require_flax class FlaxT5ModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase): all_model_classes = (FlaxT5Model, FlaxT5ForConditionalGeneration) if is_flax_available() else () - all_generative_model_classes = (FlaxT5ForConditionalGeneration,) if is_flax_available() else () is_encoder_decoder = True def setUp(self): diff --git a/tests/models/t5/test_modeling_t5.py b/tests/models/t5/test_modeling_t5.py index 854a73f16b37..9886684d6088 100644 --- a/tests/models/t5/test_modeling_t5.py +++ b/tests/models/t5/test_modeling_t5.py @@ -557,7 +557,6 @@ class T5ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, if is_torch_available() else () ) - all_generative_model_classes = (T5ForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": T5Model, diff --git a/tests/models/time_series_transformer/test_modeling_time_series_transformer.py b/tests/models/time_series_transformer/test_modeling_time_series_transformer.py index 5f049bd92466..c886bb08856c 100644 --- a/tests/models/time_series_transformer/test_modeling_time_series_transformer.py +++ b/tests/models/time_series_transformer/test_modeling_time_series_transformer.py @@ -179,7 +179,6 @@ class TimeSeriesTransformerModelTest(ModelTesterMixin, PipelineTesterMixin, unit all_model_classes = ( (TimeSeriesTransformerModel, TimeSeriesTransformerForPrediction) if is_torch_available() else () ) - all_generative_model_classes = (TimeSeriesTransformerForPrediction,) if is_torch_available() else () pipeline_model_mapping = {"feature-extraction": TimeSeriesTransformerModel} if is_torch_available() else {} is_encoder_decoder = True test_pruning = False diff --git a/tests/models/trocr/test_modeling_trocr.py b/tests/models/trocr/test_modeling_trocr.py index aa9e09759415..26654546f648 100644 --- a/tests/models/trocr/test_modeling_trocr.py +++ b/tests/models/trocr/test_modeling_trocr.py @@ -161,7 +161,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class TrOCRStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (TrOCRDecoder, TrOCRForCausalLM) if is_torch_available() else () - all_generative_model_classes = (TrOCRForCausalLM,) if is_torch_available() else () pipeline_model_mapping = {"text-generation": TrOCRForCausalLM} if is_torch_available() else {} fx_compatible = True test_pruning = False diff --git a/tests/models/udop/test_modeling_udop.py b/tests/models/udop/test_modeling_udop.py index d55400799dbd..e750d50b62d1 100644 --- a/tests/models/udop/test_modeling_udop.py +++ b/tests/models/udop/test_modeling_udop.py @@ -274,7 +274,6 @@ class UdopModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): if is_torch_available() else () ) - all_generative_model_classes = (UdopForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( {"feature-extraction": UdopModel, "image-text-to-text": UdopForConditionalGeneration} if is_torch_available() diff --git a/tests/models/umt5/test_modeling_umt5.py b/tests/models/umt5/test_modeling_umt5.py index 377668851c58..e9a5d7e64221 100644 --- a/tests/models/umt5/test_modeling_umt5.py +++ b/tests/models/umt5/test_modeling_umt5.py @@ -295,7 +295,6 @@ class UMT5ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin if is_torch_available() else () ) - all_generative_model_classes = (UMT5ForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": UMT5Model, diff --git a/tests/models/video_llava/test_modeling_video_llava.py b/tests/models/video_llava/test_modeling_video_llava.py index cead90bd869b..b8d4d4167e57 100644 --- a/tests/models/video_llava/test_modeling_video_llava.py +++ b/tests/models/video_llava/test_modeling_video_llava.py @@ -192,7 +192,6 @@ class VideoLlavaForConditionalGenerationModelTest(ModelTesterMixin, GenerationTe """ all_model_classes = (VideoLlavaForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (VideoLlavaForConditionalGeneration,) if is_torch_available() else () fx_compatible = False test_pruning = False test_resize_embeddings = True diff --git a/tests/models/vipllava/test_modeling_vipllava.py b/tests/models/vipllava/test_modeling_vipllava.py index 44d2550bb492..f6a601c8a02d 100644 --- a/tests/models/vipllava/test_modeling_vipllava.py +++ b/tests/models/vipllava/test_modeling_vipllava.py @@ -167,7 +167,6 @@ class VipLlavaForConditionalGenerationModelTest(ModelTesterMixin, GenerationTest """ all_model_classes = (VipLlavaForConditionalGeneration,) if is_torch_available() else () - all_generative_model_classes = (VipLlavaForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = {"image-text-to-text": VipLlavaForConditionalGeneration} if is_torch_available() else {} fx_compatible = False test_pruning = False diff --git a/tests/models/whisper/test_modeling_flax_whisper.py b/tests/models/whisper/test_modeling_flax_whisper.py index 065c6536481d..f018d0d4198c 100644 --- a/tests/models/whisper/test_modeling_flax_whisper.py +++ b/tests/models/whisper/test_modeling_flax_whisper.py @@ -190,7 +190,6 @@ def make_partial_class(full_class, *args, **kwargs): @require_flax class FlaxWhisperModelTest(FlaxModelTesterMixin, unittest.TestCase): all_model_classes = (FlaxWhisperForConditionalGeneration, FlaxWhisperModel) if is_flax_available() else () - all_generative_model_classes = (FlaxWhisperForConditionalGeneration,) if is_flax_available() else () is_encoder_decoder = True test_pruning = False test_head_masking = False diff --git a/tests/models/whisper/test_modeling_whisper.py b/tests/models/whisper/test_modeling_whisper.py index 916517add7b2..9a951c9306d3 100644 --- a/tests/models/whisper/test_modeling_whisper.py +++ b/tests/models/whisper/test_modeling_whisper.py @@ -376,7 +376,6 @@ def check_encoder_decoder_model_standalone(self, config, inputs_dict): @require_torch class WhisperModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (WhisperModel, WhisperForConditionalGeneration) if is_torch_available() else () - all_generative_model_classes = (WhisperForConditionalGeneration,) if is_torch_available() else () pipeline_model_mapping = ( { "audio-classification": WhisperForAudioClassification, @@ -3966,7 +3965,6 @@ def create_and_check_decoder_model_attention_mask_past(self, config, input_ids): @require_torch class WhisperStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): all_model_classes = (WhisperDecoder, WhisperForCausalLM) if is_torch_available() else () - all_generative_model_classes = (WhisperForCausalLM,) if is_torch_available() else () fx_comptatible = False test_pruning = False is_encoder_decoder = False diff --git a/tests/models/xglm/test_modeling_flax_xglm.py b/tests/models/xglm/test_modeling_flax_xglm.py index b9a43ff88b7d..b34aee8f3fa8 100644 --- a/tests/models/xglm/test_modeling_flax_xglm.py +++ b/tests/models/xglm/test_modeling_flax_xglm.py @@ -183,7 +183,6 @@ def check_use_cache_forward_with_attn_mask(self, model_class_name, config, input @require_flax class FlaxXGLMModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase): all_model_classes = (FlaxXGLMModel, FlaxXGLMForCausalLM) if is_flax_available() else () - all_generative_model_classes = (FlaxXGLMForCausalLM,) if is_flax_available() else () def setUp(self): self.model_tester = FlaxXGLMModelTester(self) diff --git a/tests/models/xglm/test_modeling_xglm.py b/tests/models/xglm/test_modeling_xglm.py index 85862c7af146..e321aaf643e8 100644 --- a/tests/models/xglm/test_modeling_xglm.py +++ b/tests/models/xglm/test_modeling_xglm.py @@ -283,7 +283,6 @@ def prepare_config_and_inputs_for_common(self): @require_torch class XGLMModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (XGLMModel, XGLMForCausalLM) if is_torch_available() else () - all_generative_model_classes = (XGLMForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( {"feature-extraction": XGLMModel, "text-generation": XGLMForCausalLM} if is_torch_available() else {} ) diff --git a/tests/models/xlm/test_modeling_xlm.py b/tests/models/xlm/test_modeling_xlm.py index d2eefced08fa..afe0a20a00cc 100644 --- a/tests/models/xlm/test_modeling_xlm.py +++ b/tests/models/xlm/test_modeling_xlm.py @@ -374,9 +374,6 @@ class XLMModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, if is_torch_available() else () ) - all_generative_model_classes = ( - (XLMWithLMHeadModel,) if is_torch_available() else () - ) # TODO (PVP): Check other models whether language generation is also applicable pipeline_model_mapping = ( { "feature-extraction": XLMModel, diff --git a/tests/models/xlm_roberta_xl/test_modeling_xlm_roberta_xl.py b/tests/models/xlm_roberta_xl/test_modeling_xlm_roberta_xl.py index 9fac147c6176..094f977f15fc 100644 --- a/tests/models/xlm_roberta_xl/test_modeling_xlm_roberta_xl.py +++ b/tests/models/xlm_roberta_xl/test_modeling_xlm_roberta_xl.py @@ -372,7 +372,6 @@ class XLMRobertaXLModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTes if is_torch_available() else () ) - all_generative_model_classes = (XLMRobertaXLForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": XLMRobertaXLModel, diff --git a/tests/models/xlnet/test_modeling_xlnet.py b/tests/models/xlnet/test_modeling_xlnet.py index 4636efed10b1..23a9ee0d89ea 100644 --- a/tests/models/xlnet/test_modeling_xlnet.py +++ b/tests/models/xlnet/test_modeling_xlnet.py @@ -523,9 +523,6 @@ class XLNetModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixi if is_torch_available() else () ) - all_generative_model_classes = ( - (XLNetLMHeadModel,) if is_torch_available() else () - ) # TODO (PVP): Check other models whether language generation is also applicable pipeline_model_mapping = ( { "feature-extraction": XLNetModel, diff --git a/tests/models/xmod/test_modeling_xmod.py b/tests/models/xmod/test_modeling_xmod.py index 80a3ac13b06c..fd0be2da7e65 100644 --- a/tests/models/xmod/test_modeling_xmod.py +++ b/tests/models/xmod/test_modeling_xmod.py @@ -369,7 +369,6 @@ class XmodModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin if is_torch_available() else () ) - all_generative_model_classes = (XmodForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": XmodModel, diff --git a/tests/models/yoso/test_modeling_yoso.py b/tests/models/yoso/test_modeling_yoso.py index 2f13e91fc558..ec52c950aac4 100644 --- a/tests/models/yoso/test_modeling_yoso.py +++ b/tests/models/yoso/test_modeling_yoso.py @@ -296,7 +296,6 @@ class YosoModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): test_headmasking = False test_torchscript = False - all_generative_model_classes = () pipeline_model_mapping = ( { "feature-extraction": YosoModel, diff --git a/tests/models/zamba/test_modeling_zamba.py b/tests/models/zamba/test_modeling_zamba.py index 662a4d060b74..fc1c89322245 100644 --- a/tests/models/zamba/test_modeling_zamba.py +++ b/tests/models/zamba/test_modeling_zamba.py @@ -291,7 +291,6 @@ class ZambaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixi if is_torch_available() else () ) - all_generative_model_classes = (ZambaForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": ZambaModel, diff --git a/tests/models/zamba2/test_modeling_zamba2.py b/tests/models/zamba2/test_modeling_zamba2.py index c876e598e867..58f6b8e595e0 100644 --- a/tests/models/zamba2/test_modeling_zamba2.py +++ b/tests/models/zamba2/test_modeling_zamba2.py @@ -302,7 +302,6 @@ class Zamba2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMix if is_torch_available() else () ) - all_generative_model_classes = (Zamba2ForCausalLM,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": Zamba2Model, diff --git a/tests/test_modeling_common.py b/tests/test_modeling_common.py index 0b437d9356ff..9dd5877c8b90 100755 --- a/tests/test_modeling_common.py +++ b/tests/test_modeling_common.py @@ -212,7 +212,6 @@ def sdpa_kernel(enable_flash, enable_math, enable_mem_efficient): class ModelTesterMixin: model_tester = None all_model_classes = () - all_generative_model_classes = () fx_compatible = False test_torchscript = True test_pruning = True @@ -230,6 +229,10 @@ class ModelTesterMixin: _is_composite = False model_split_percents = [0.5, 0.7, 0.9] + @property + def all_generative_model_classes(self): + return tuple(model_class for model_class in self.all_model_classes if model_class.can_generate()) + def _prepare_for_class(self, inputs_dict, model_class, return_labels=False): inputs_dict = copy.deepcopy(inputs_dict) if model_class.__name__ in get_values(MODEL_FOR_MULTIPLE_CHOICE_MAPPING_NAMES): diff --git a/tests/test_modeling_flax_common.py b/tests/test_modeling_flax_common.py index bfe1648de049..e6e3a860772d 100644 --- a/tests/test_modeling_flax_common.py +++ b/tests/test_modeling_flax_common.py @@ -133,6 +133,10 @@ class FlaxModelTesterMixin: test_head_masking = False has_attentions = True + @property + def all_generative_model_classes(self): + return tuple(model_class for model_class in self.all_model_classes if model_class.can_generate()) + def _prepare_for_class(self, inputs_dict, model_class): inputs_dict = copy.deepcopy(inputs_dict)