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
This commit is contained in:
Joao Gante 2025-02-13 15:27:11 +00:00 committed by GitHub
parent 06231fdfc7
commit 62c7ea0201
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
162 changed files with 50 additions and 198 deletions

View File

@ -1507,6 +1507,14 @@ class BertForMaskedLM(BertPreTrainedModel):
return {"input_ids": input_ids, "attention_mask": attention_mask} 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( @add_start_docstrings(
"""Bert Model with a `next sentence prediction (classification)` head on top.""", """Bert Model with a `next sentence prediction (classification)` head on top.""",

View File

@ -1325,6 +1325,14 @@ class ErnieForMaskedLM(ErniePreTrainedModel):
return {"input_ids": input_ids, "attention_mask": attention_mask} 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( @add_start_docstrings(
"""Ernie Model with a `next sentence prediction (classification)` head on top.""", """Ernie Model with a `next sentence prediction (classification)` head on top.""",

View File

@ -66,7 +66,6 @@ def random_attention_mask(shape, rng=None):
@require_flax @require_flax
class FlaxGenerationTesterMixin: class FlaxGenerationTesterMixin:
model_tester = None model_tester = None
all_generative_model_classes = ()
def _get_input_ids_and_config(self): def _get_input_ids_and_config(self):
config, inputs = self.model_tester.prepare_config_and_inputs_for_common() config, inputs = self.model_tester.prepare_config_and_inputs_for_common()

View File

@ -28,7 +28,7 @@ import pytest
from packaging import version from packaging import version
from parameterized import parameterized 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 ( from transformers.testing_utils import (
is_flaky, is_flaky,
require_accelerate, require_accelerate,
@ -61,8 +61,6 @@ if is_torch_available():
AutoModelForSeq2SeqLM, AutoModelForSeq2SeqLM,
AutoModelForSpeechSeq2Seq, AutoModelForSpeechSeq2Seq,
AutoModelForVision2Seq, AutoModelForVision2Seq,
AutoProcessor,
AutoTokenizer,
BartForConditionalGeneration, BartForConditionalGeneration,
BartTokenizer, BartTokenizer,
GPT2LMHeadModel, GPT2LMHeadModel,
@ -119,7 +117,6 @@ from transformers.utils import is_sklearn_available
class GenerationTesterMixin: class GenerationTesterMixin:
input_name = "input_ids" input_name = "input_ids"
model_tester = None model_tester = None
all_generative_model_classes = ()
max_new_tokens = 3 max_new_tokens = 3
def prepare_config_and_inputs_for_generate(self, batch_size=2): def prepare_config_and_inputs_for_generate(self, batch_size=2):

View File

@ -189,7 +189,6 @@ class AriaForConditionalGenerationModelTest(ModelTesterMixin, GenerationTesterMi
""" """
all_model_classes = (AriaForConditionalGeneration,) if is_torch_available() else () all_model_classes = (AriaForConditionalGeneration,) if is_torch_available() else ()
all_generative_model_classes = (AriaForConditionalGeneration,) if is_torch_available() else ()
test_pruning = False test_pruning = False
test_head_masking = False test_head_masking = False
_is_composite = True _is_composite = True

View File

@ -205,7 +205,6 @@ class AutoformerModelTester:
@require_torch @require_torch
class AutoformerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): class AutoformerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (AutoformerModel, AutoformerForPrediction) if is_torch_available() else () 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 {} pipeline_model_mapping = {"feature-extraction": AutoformerModel} if is_torch_available() else {}
test_pruning = False test_pruning = False
test_head_masking = False test_head_masking = False

View File

@ -257,15 +257,7 @@ class BambaModelTester:
@require_torch @require_torch
class BambaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class BambaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = ( all_model_classes = (BambaModel, BambaForCausalLM) if is_torch_available() else ()
(
BambaModel,
BambaForCausalLM,
)
if is_torch_available()
else ()
)
all_generative_model_classes = (BambaForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": BambaModel, "feature-extraction": BambaModel,

View File

@ -22,6 +22,7 @@ import unittest
import pytest import pytest
from transformers import ( from transformers import (
BarkCausalModel,
BarkCoarseConfig, BarkCoarseConfig,
BarkConfig, BarkConfig,
BarkFineConfig, BarkFineConfig,
@ -53,7 +54,6 @@ if is_torch_available():
import torch import torch
from transformers import ( from transformers import (
BarkCausalModel,
BarkCoarseModel, BarkCoarseModel,
BarkFineModel, BarkFineModel,
BarkModel, BarkModel,
@ -527,6 +527,8 @@ class BarkModelTester:
@require_torch @require_torch
class BarkSemanticModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): class BarkSemanticModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase):
all_model_classes = (BarkSemanticModel,) if is_torch_available() else () 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 () all_generative_model_classes = (BarkCausalModel,) if is_torch_available() else ()
is_encoder_decoder = False is_encoder_decoder = False
@ -614,8 +616,9 @@ class BarkSemanticModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.Te
@require_torch @require_torch
class BarkCoarseModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): 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 () 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 () all_generative_model_classes = (BarkCausalModel,) if is_torch_available() else ()
is_encoder_decoder = False is_encoder_decoder = False

View File

@ -419,7 +419,6 @@ class BartModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (BartForConditionalGeneration,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": BartModel, "feature-extraction": BartModel,
@ -1502,7 +1501,6 @@ class BartStandaloneDecoderModelTester:
@require_torch @require_torch
class BartStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): class BartStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase):
all_model_classes = (BartDecoder, BartForCausalLM) if is_torch_available() else () all_model_classes = (BartDecoder, BartForCausalLM) if is_torch_available() else ()
all_generative_model_classes = (BartForCausalLM,) if is_torch_available() else ()
fx_comptatible = True fx_comptatible = True
test_pruning = False test_pruning = False
is_encoder_decoder = False is_encoder_decoder = False

View File

@ -336,7 +336,6 @@ class FlaxBartModelTest(FlaxModelTesterMixin, unittest.TestCase, FlaxGenerationT
if is_flax_available() if is_flax_available()
else () else ()
) )
all_generative_model_classes = (FlaxBartForConditionalGeneration,) if is_flax_available() else ()
def setUp(self): def setUp(self):
self.model_tester = FlaxBartModelTester(self) self.model_tester = FlaxBartModelTester(self)

View File

@ -451,7 +451,6 @@ class BertModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (BertLMHeadModel,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": BertModel, "feature-extraction": BertModel,

View File

@ -243,7 +243,6 @@ class BertGenerationEncoderTester:
@require_torch @require_torch
class BertGenerationEncoderTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class BertGenerationEncoderTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (BertGenerationEncoder, BertGenerationDecoder) if is_torch_available() else () all_model_classes = (BertGenerationEncoder, BertGenerationDecoder) if is_torch_available() else ()
all_generative_model_classes = (BertGenerationDecoder,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{"feature-extraction": BertGenerationEncoder, "text-generation": BertGenerationDecoder} {"feature-extraction": BertGenerationEncoder, "text-generation": BertGenerationDecoder}
if is_torch_available() if is_torch_available()

View File

@ -451,7 +451,6 @@ class BigBirdModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase)
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (BigBirdForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": BigBirdModel, "feature-extraction": BigBirdModel,

View File

@ -250,7 +250,6 @@ class BigBirdPegasusModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineT
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (BigBirdPegasusForConditionalGeneration,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": BigBirdPegasusModel, "feature-extraction": BigBirdPegasusModel,
@ -792,7 +791,6 @@ class BigBirdPegasusStandaloneDecoderModelTester:
@require_torch @require_torch
class BigBirdPegasusStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): class BigBirdPegasusStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase):
all_model_classes = (BigBirdPegasusDecoder, BigBirdPegasusForCausalLM) if is_torch_available() else () all_model_classes = (BigBirdPegasusDecoder, BigBirdPegasusForCausalLM) if is_torch_available() else ()
all_generative_model_classes = (BigBirdPegasusForCausalLM,) if is_torch_available() else ()
test_pruning = False test_pruning = False
is_encoder_decoder = False is_encoder_decoder = False

View File

@ -284,7 +284,6 @@ class BioGptModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMix
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (BioGptForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": BioGptModel, "feature-extraction": BioGptModel,

View File

@ -226,7 +226,6 @@ class BlenderbotModelTester:
@require_torch @require_torch
class BlenderbotModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class BlenderbotModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (BlenderbotModel, BlenderbotForConditionalGeneration) if is_torch_available() else () all_model_classes = (BlenderbotModel, BlenderbotForConditionalGeneration) if is_torch_available() else ()
all_generative_model_classes = (BlenderbotForConditionalGeneration,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": BlenderbotModel, "feature-extraction": BlenderbotModel,
@ -533,7 +532,6 @@ class BlenderbotStandaloneDecoderModelTester:
@require_torch @require_torch
class BlenderbotStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): class BlenderbotStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase):
all_model_classes = (BlenderbotDecoder, BlenderbotForCausalLM) if is_torch_available() else () all_model_classes = (BlenderbotDecoder, BlenderbotForCausalLM) if is_torch_available() else ()
all_generative_model_classes = (BlenderbotForCausalLM,) if is_torch_available() else ()
test_pruning = False test_pruning = False
is_encoder_decoder = False is_encoder_decoder = False

View File

@ -319,7 +319,6 @@ class FlaxBlenderbotModelTest(FlaxModelTesterMixin, unittest.TestCase, FlaxGener
if is_flax_available() if is_flax_available()
else () else ()
) )
all_generative_model_classes = (FlaxBlenderbotForConditionalGeneration,) if is_flax_available() else ()
def setUp(self): def setUp(self):
self.model_tester = FlaxBlenderbotModelTester(self) self.model_tester = FlaxBlenderbotModelTester(self)

View File

@ -217,7 +217,6 @@ class BlenderbotSmallModelTester:
@require_torch @require_torch
class BlenderbotSmallModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class BlenderbotSmallModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (BlenderbotSmallModel, BlenderbotSmallForConditionalGeneration) if is_torch_available() else () all_model_classes = (BlenderbotSmallModel, BlenderbotSmallForConditionalGeneration) if is_torch_available() else ()
all_generative_model_classes = (BlenderbotSmallForConditionalGeneration,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": BlenderbotSmallModel, "feature-extraction": BlenderbotSmallModel,
@ -542,7 +541,6 @@ class BlenderbotSmallStandaloneDecoderModelTester:
@require_torch @require_torch
class BlenderbotSmallStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): class BlenderbotSmallStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase):
all_model_classes = (BlenderbotSmallDecoder, BlenderbotSmallForCausalLM) if is_torch_available() else () all_model_classes = (BlenderbotSmallDecoder, BlenderbotSmallForCausalLM) if is_torch_available() else ()
all_generative_model_classes = (BlenderbotSmallForCausalLM,) if is_torch_available() else ()
test_pruning = False test_pruning = False
is_encoder_decoder = False is_encoder_decoder = False

View File

@ -318,7 +318,6 @@ class FlaxBlenderbotSmallModelTest(FlaxModelTesterMixin, unittest.TestCase, Flax
if is_flax_available() if is_flax_available()
else () else ()
) )
all_generative_model_classes = (FlaxBlenderbotSmallForConditionalGeneration,) if is_flax_available() else ()
def is_pipeline_test_to_skip( def is_pipeline_test_to_skip(
self, self,

View File

@ -472,7 +472,6 @@ class Blip2ForConditionalGenerationDecoderOnlyModelTester:
@require_torch @require_torch
class Blip2ForConditionalGenerationDecoderOnlyTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): class Blip2ForConditionalGenerationDecoderOnlyTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase):
all_model_classes = (Blip2ForConditionalGeneration,) if is_torch_available() else () all_model_classes = (Blip2ForConditionalGeneration,) if is_torch_available() else ()
all_generative_model_classes = (Blip2ForConditionalGeneration,) if is_torch_available() else ()
fx_compatible = False fx_compatible = False
test_head_masking = False test_head_masking = False
test_pruning = False test_pruning = False
@ -995,6 +994,8 @@ class Blip2ModelTester:
@require_torch @require_torch
class Blip2ModelTest(ModelTesterMixin, PipelineTesterMixin, GenerationTesterMixin, unittest.TestCase): class Blip2ModelTest(ModelTesterMixin, PipelineTesterMixin, GenerationTesterMixin, unittest.TestCase):
all_model_classes = (Blip2ForConditionalGeneration, Blip2Model) if is_torch_available() else () 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 = ( pipeline_model_mapping = (
{ {
"feature-extraction": Blip2Model, "feature-extraction": Blip2Model,

View File

@ -328,7 +328,6 @@ class BloomModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixi
else () else ()
) )
all_generative_model_classes = (BloomForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": BloomModel, "feature-extraction": BloomModel,

View File

@ -171,7 +171,6 @@ class FlaxBloomModelTester:
@require_flax @require_flax
class FlaxBloomModelTest(FlaxModelTesterMixin, unittest.TestCase, FlaxGenerationTesterMixin): class FlaxBloomModelTest(FlaxModelTesterMixin, unittest.TestCase, FlaxGenerationTesterMixin):
all_model_classes = (FlaxBloomModel, FlaxBloomForCausalLM) if is_flax_available() else () all_model_classes = (FlaxBloomModel, FlaxBloomForCausalLM) if is_flax_available() else ()
all_generative_model_classes = () if is_flax_available() else ()
def setUp(self): def setUp(self):
self.model_tester = FlaxBloomModelTester(self) self.model_tester = FlaxBloomModelTester(self)
@ -199,7 +198,6 @@ class FlaxBloomModelTest(FlaxModelTesterMixin, unittest.TestCase, FlaxGeneration
@require_flax @require_flax
class FlaxBloomGenerationTest(unittest.TestCase): class FlaxBloomGenerationTest(unittest.TestCase):
all_model_classes = (FlaxBloomForCausalLM,) if is_flax_available() else () all_model_classes = (FlaxBloomForCausalLM,) if is_flax_available() else ()
all_generative_model_classes = () if is_flax_available() else ()
def setUp(self): def setUp(self):
self.model_id = "bigscience/bloom-560m" self.model_id = "bigscience/bloom-560m"

View File

@ -285,7 +285,6 @@ class BrosModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = () if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{"feature-extraction": BrosModel, "token-classification": BrosForTokenClassification} {"feature-extraction": BrosModel, "token-classification": BrosForTokenClassification}
if is_torch_available() if is_torch_available()

View File

@ -271,7 +271,6 @@ class ChameleonModelTester:
@require_torch @require_torch
class ChameleonModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class ChameleonModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (ChameleonModel, ChameleonForConditionalGeneration) if is_torch_available() else () all_model_classes = (ChameleonModel, ChameleonForConditionalGeneration) if is_torch_available() else ()
all_generative_model_classes = (ChameleonForConditionalGeneration,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": ChameleonModel, "feature-extraction": ChameleonModel,

View File

@ -281,7 +281,6 @@ class ClvpDecoderTester:
@require_torch @require_torch
class ClvpDecoderTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class ClvpDecoderTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (ClvpModel, ClvpForCausalLM) if is_torch_available() else () 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 {} pipeline_model_mapping = {"feature-extraction": ClvpModelForConditionalGeneration} if is_torch_available() else {}
test_pruning = False test_pruning = False

View File

@ -322,7 +322,6 @@ class CodeGenModelTester:
@require_torch @require_torch
class CodeGenModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class CodeGenModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (CodeGenModel, CodeGenForCausalLM) if is_torch_available() else () all_model_classes = (CodeGenModel, CodeGenForCausalLM) if is_torch_available() else ()
all_generative_model_classes = (CodeGenForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{"feature-extraction": CodeGenModel, "text-generation": CodeGenForCausalLM} if is_torch_available() else {} {"feature-extraction": CodeGenModel, "text-generation": CodeGenForCausalLM} if is_torch_available() else {}
) )

View File

@ -274,7 +274,6 @@ class CohereModelTester:
@require_torch @require_torch
class CohereModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class CohereModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (CohereModel, CohereForCausalLM) if is_torch_available() else () all_model_classes = (CohereModel, CohereForCausalLM) if is_torch_available() else ()
all_generative_model_classes = (CohereForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": CohereModel, "feature-extraction": CohereModel,

View File

@ -54,7 +54,6 @@ class Cohere2ModelTester(CohereModelTester):
@require_torch @require_torch
class Cohere2ModelTest(CohereModelTest, unittest.TestCase): class Cohere2ModelTest(CohereModelTest, unittest.TestCase):
all_model_classes = (Cohere2Model, Cohere2ForCausalLM) if is_torch_available() else () all_model_classes = (Cohere2Model, Cohere2ForCausalLM) if is_torch_available() else ()
all_generative_model_classes = (Cohere2ForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": Cohere2Model, "feature-extraction": Cohere2Model,

View File

@ -193,7 +193,6 @@ class CTRLModelTester:
@require_torch @require_torch
class CTRLModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class CTRLModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (CTRLModel, CTRLLMHeadModel, CTRLForSequenceClassification) if is_torch_available() else () all_model_classes = (CTRLModel, CTRLLMHeadModel, CTRLForSequenceClassification) if is_torch_available() else ()
all_generative_model_classes = (CTRLLMHeadModel,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": CTRLModel, "feature-extraction": CTRLModel,

View File

@ -373,7 +373,6 @@ class Data2VecTextModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTes
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (Data2VecTextForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": Data2VecTextModel, "feature-extraction": Data2VecTextModel,

View File

@ -322,7 +322,6 @@ class DbrxModelTester:
@require_torch @require_torch
class DbrxModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class DbrxModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (DbrxModel, DbrxForCausalLM) if is_torch_available() else () 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 {} pipeline_model_mapping = {"text-generation": DbrxForCausalLM} if is_torch_available() else {}
test_headmasking = False test_headmasking = False
test_pruning = False test_pruning = False

View File

@ -127,7 +127,6 @@ class DecisionTransformerModelTester:
@require_torch @require_torch
class DecisionTransformerModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class DecisionTransformerModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (DecisionTransformerModel,) if is_torch_available() else () all_model_classes = (DecisionTransformerModel,) if is_torch_available() else ()
all_generative_model_classes = ()
pipeline_model_mapping = {"feature-extraction": DecisionTransformerModel} if is_torch_available() else {} 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 # Ignoring of a failing test from GenerationTesterMixin, as the model does not use inputs_ids

View File

@ -296,7 +296,6 @@ class DiffLlamaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTester
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (DiffLlamaForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": DiffLlamaModel, "feature-extraction": DiffLlamaModel,

View File

@ -124,7 +124,6 @@ class Emu3Text2TextModelTester:
@require_torch @require_torch
class Emu3Text2TextModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class Emu3Text2TextModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (Emu3ForCausalLM,) if is_torch_available() else () all_model_classes = (Emu3ForCausalLM,) if is_torch_available() else ()
all_generative_model_classes = (Emu3ForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"text-generation": Emu3ForCausalLM, "text-generation": Emu3ForCausalLM,
@ -312,7 +311,6 @@ class Emu3Vision2TextModelTester:
@require_torch @require_torch
class Emu3Vision2TextModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class Emu3Vision2TextModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (Emu3ForConditionalGeneration,) if is_torch_available() else () all_model_classes = (Emu3ForConditionalGeneration,) if is_torch_available() else ()
all_generative_model_classes = (Emu3ForConditionalGeneration,) if is_torch_available() else ()
pipeline_model_mapping = {} pipeline_model_mapping = {}
test_headmasking = False test_headmasking = False
test_pruning = False test_pruning = False

View File

@ -442,7 +442,6 @@ class ErnieModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixi
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (ErnieForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": ErnieModel, "feature-extraction": ErnieModel,

View File

@ -195,7 +195,6 @@ class EsmModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": EsmModel, "feature-extraction": EsmModel,

View File

@ -169,7 +169,6 @@ class EsmFoldModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase)
test_mismatched_shapes = False test_mismatched_shapes = False
all_model_classes = (EsmForProteinFolding,) if is_torch_available() else () all_model_classes = (EsmForProteinFolding,) if is_torch_available() else ()
all_generative_model_classes = ()
pipeline_model_mapping = {} if is_torch_available() else {} pipeline_model_mapping = {} if is_torch_available() else {}
test_sequence_classification_problem_types = False test_sequence_classification_problem_types = False

View File

@ -290,7 +290,6 @@ class FalconModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMix
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (FalconForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": FalconModel, "feature-extraction": FalconModel,

View File

@ -247,7 +247,6 @@ class FalconMambaModelTester:
# Copied from transformers.tests.models.mamba.MambaModelTest with Mamba->Falcon,mamba->falcon_mamba,FalconMambaCache->MambaCache # Copied from transformers.tests.models.mamba.MambaModelTest with Mamba->Falcon,mamba->falcon_mamba,FalconMambaCache->MambaCache
class FalconMambaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class FalconMambaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (FalconMambaModel, FalconMambaForCausalLM) if is_torch_available() else () 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 has_attentions = False # FalconMamba does not support attentions
fx_compatible = False # FIXME let's try to support this @ArthurZucker fx_compatible = False # FIXME let's try to support this @ArthurZucker
test_torchscript = False # FIXME let's try to support this @ArthurZucker test_torchscript = False # FIXME let's try to support this @ArthurZucker

View File

@ -163,7 +163,6 @@ def prepare_fsmt_inputs_dict(
@require_torch @require_torch
class FSMTModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class FSMTModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (FSMTModel, FSMTForConditionalGeneration) if is_torch_available() else () all_model_classes = (FSMTModel, FSMTForConditionalGeneration) if is_torch_available() else ()
all_generative_model_classes = (FSMTForConditionalGeneration,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": FSMTModel, "feature-extraction": FSMTModel,

View File

@ -268,7 +268,6 @@ class FuyuModelTester:
@require_torch @require_torch
class FuyuModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class FuyuModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (FuyuForCausalLM,) if is_torch_available() else () all_model_classes = (FuyuForCausalLM,) if is_torch_available() else ()
all_generative_model_classes = (FuyuForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{"text-generation": FuyuForCausalLM, "image-text-to-text": FuyuForCausalLM} if is_torch_available() else {} {"text-generation": FuyuForCausalLM, "image-text-to-text": FuyuForCausalLM} if is_torch_available() else {}
) )

View File

@ -176,7 +176,6 @@ class FlaxGemmaModelTester:
@require_flax @require_flax
class FlaxGemmaModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase): class FlaxGemmaModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase):
all_model_classes = (FlaxGemmaModel, FlaxGemmaForCausalLM) if is_flax_available() else () all_model_classes = (FlaxGemmaModel, FlaxGemmaForCausalLM) if is_flax_available() else ()
all_generative_model_classes = (FlaxGemmaForCausalLM,) if is_flax_available() else ()
def setUp(self): def setUp(self):
self.model_tester = FlaxGemmaModelTester(self) self.model_tester = FlaxGemmaModelTester(self)

View File

@ -300,7 +300,6 @@ class GemmaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixi
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (GemmaForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": GemmaModel, "feature-extraction": GemmaModel,

View File

@ -63,7 +63,6 @@ class Gemma2ModelTest(GemmaModelTest, unittest.TestCase):
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (Gemma2ForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": Gemma2Model, "feature-extraction": Gemma2Model,

View File

@ -399,7 +399,6 @@ class GitModelTester:
@require_torch @require_torch
class GitModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class GitModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (GitModel, GitForCausalLM) if is_torch_available() else () all_model_classes = (GitModel, GitForCausalLM) if is_torch_available() else ()
all_generative_model_classes = (GitForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": GitModel, "feature-extraction": GitModel,

View File

@ -286,7 +286,6 @@ class GlmModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin,
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (GlmForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": GlmModel, "feature-extraction": GlmModel,

View File

@ -169,7 +169,6 @@ class GotOcr2VisionText2TextModelTester:
@require_torch @require_torch
class GotOcr2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class GotOcr2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (GotOcr2ForConditionalGeneration,) if is_torch_available() else () all_model_classes = (GotOcr2ForConditionalGeneration,) if is_torch_available() else ()
all_generative_model_classes = (GotOcr2ForConditionalGeneration,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"image-to-text": GotOcr2ForConditionalGeneration, "image-to-text": GotOcr2ForConditionalGeneration,

View File

@ -211,7 +211,6 @@ class FlaxGPT2ModelTester:
@require_flax @require_flax
class FlaxGPT2ModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase): class FlaxGPT2ModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase):
all_model_classes = (FlaxGPT2Model, FlaxGPT2LMHeadModel) if is_flax_available() else () all_model_classes = (FlaxGPT2Model, FlaxGPT2LMHeadModel) if is_flax_available() else ()
all_generative_model_classes = (FlaxGPT2LMHeadModel,) if is_flax_available() else ()
def setUp(self): def setUp(self):
self.model_tester = FlaxGPT2ModelTester(self) self.model_tester = FlaxGPT2ModelTester(self)

View File

@ -492,7 +492,6 @@ class GPT2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (GPT2LMHeadModel, GPT2DoubleHeadsModel) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": GPT2Model, "feature-extraction": GPT2Model,

View File

@ -390,7 +390,6 @@ class GPTBigCodeModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTeste
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (GPTBigCodeForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": GPTBigCodeModel, "feature-extraction": GPTBigCodeModel,

View File

@ -183,7 +183,6 @@ class FlaxGPTNeoModelTester:
@require_flax @require_flax
class FlaxGPTNeoModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase): class FlaxGPTNeoModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase):
all_model_classes = (FlaxGPTNeoModel, FlaxGPTNeoForCausalLM) if is_flax_available() else () all_model_classes = (FlaxGPTNeoModel, FlaxGPTNeoForCausalLM) if is_flax_available() else ()
all_generative_model_classes = (FlaxGPTNeoForCausalLM,) if is_flax_available() else ()
def setUp(self): def setUp(self):
self.model_tester = FlaxGPTNeoModelTester(self) self.model_tester = FlaxGPTNeoModelTester(self)

View File

@ -376,7 +376,6 @@ class GPTNeoModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMix
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (GPTNeoForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": GPTNeoModel, "feature-extraction": GPTNeoModel,

View File

@ -274,7 +274,6 @@ class GPTNeoXModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMi
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (GPTNeoXForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": GPTNeoXModel, "feature-extraction": GPTNeoXModel,

View File

@ -198,7 +198,6 @@ class GPTNeoXJapaneseModelTester:
@require_torch @require_torch
class GPTNeoXModelJapaneseTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class GPTNeoXModelJapaneseTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (GPTNeoXJapaneseModel, GPTNeoXJapaneseForCausalLM) if is_torch_available() else () all_model_classes = (GPTNeoXJapaneseModel, GPTNeoXJapaneseForCausalLM) if is_torch_available() else ()
all_generative_model_classes = (GPTNeoXJapaneseForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{"feature-extraction": GPTNeoXJapaneseModel, "text-generation": GPTNeoXJapaneseForCausalLM} {"feature-extraction": GPTNeoXJapaneseModel, "text-generation": GPTNeoXJapaneseForCausalLM}
if is_torch_available() if is_torch_available()

View File

@ -180,7 +180,6 @@ class FlaxGPTJModelTester:
@require_flax @require_flax
class FlaxGPTJModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase): class FlaxGPTJModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase):
all_model_classes = (FlaxGPTJModel, FlaxGPTJForCausalLM) if is_flax_available() else () all_model_classes = (FlaxGPTJModel, FlaxGPTJForCausalLM) if is_flax_available() else ()
all_generative_model_classes = (FlaxGPTJForCausalLM,) if is_flax_available() else ()
def setUp(self): def setUp(self):
self.model_tester = FlaxGPTJModelTester(self) self.model_tester = FlaxGPTJModelTester(self)

View File

@ -341,7 +341,6 @@ class GPTJModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (GPTJForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": GPTJModel, "feature-extraction": GPTJModel,

View File

@ -281,7 +281,6 @@ class GraniteModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMi
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (GraniteForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": GraniteModel, "feature-extraction": GraniteModel,

View File

@ -280,7 +280,6 @@ class GraniteMoeModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.Test
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (GraniteMoeForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": GraniteMoeModel, "feature-extraction": GraniteMoeModel,

View File

@ -55,7 +55,6 @@ class HeliumModelTest(GemmaModelTest, unittest.TestCase):
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (HeliumForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": HeliumModel, "feature-extraction": HeliumModel,

View File

@ -593,7 +593,6 @@ class IdeficsModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase)
@require_torch @require_torch
class IdeficsForVisionText2TextTest(IdeficsModelTest, GenerationTesterMixin, unittest.TestCase): class IdeficsForVisionText2TextTest(IdeficsModelTest, GenerationTesterMixin, unittest.TestCase):
all_model_classes = (IdeficsForVisionText2Text,) if is_torch_available() else () all_model_classes = (IdeficsForVisionText2Text,) if is_torch_available() else ()
all_generative_model_classes = (IdeficsForVisionText2Text,) if is_torch_available() else ()
def setUp(self): def setUp(self):
self.model_tester = IdeficsModelTester( self.model_tester = IdeficsModelTester(

View File

@ -369,7 +369,6 @@ class Idefics2ForConditionalGenerationModelTest(GenerationTesterMixin, ModelTest
""" """
all_model_classes = (Idefics2ForConditionalGeneration,) if is_torch_available() else () 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 () pipeline_model_mapping = {"image-text-to-text": Idefics2ForConditionalGeneration} if is_torch_available() else ()
fx_compatible = False fx_compatible = False
test_pruning = False test_pruning = False

View File

@ -327,7 +327,6 @@ class Idefics3ForConditionalGenerationModelTest(GenerationTesterMixin, ModelTest
""" """
all_model_classes = (Idefics3ForConditionalGeneration,) if is_torch_available() else () 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 () pipeline_model_mapping = {"image-text-to-text": Idefics3ForConditionalGeneration} if is_torch_available() else ()
fx_compatible = False fx_compatible = False
test_pruning = False test_pruning = False

View File

@ -230,7 +230,6 @@ class ImageGPTModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterM
all_model_classes = ( all_model_classes = (
(ImageGPTForCausalImageModeling, ImageGPTForImageClassification, ImageGPTModel) if is_torch_available() else () (ImageGPTForCausalImageModeling, ImageGPTForImageClassification, ImageGPTModel) if is_torch_available() else ()
) )
all_generative_model_classes = (ImageGPTForCausalImageModeling,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{"image-feature-extraction": ImageGPTModel, "image-classification": ImageGPTForImageClassification} {"image-feature-extraction": ImageGPTModel, "image-classification": ImageGPTForImageClassification}
if is_torch_available() if is_torch_available()

View File

@ -190,7 +190,6 @@ class InformerModelTester:
@require_torch @require_torch
class InformerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): class InformerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (InformerModel, InformerForPrediction) if is_torch_available() else () 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 {} pipeline_model_mapping = {"feature-extraction": InformerModel} if is_torch_available() else {}
is_encoder_decoder = True is_encoder_decoder = True
test_pruning = False test_pruning = False

View File

@ -477,7 +477,6 @@ class InstructBlipForConditionalGenerationDecoderOnlyModelTester:
@require_torch @require_torch
class InstructBlipForConditionalGenerationDecoderOnlyTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): class InstructBlipForConditionalGenerationDecoderOnlyTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase):
all_model_classes = (InstructBlipForConditionalGeneration,) if is_torch_available() else () 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} pipeline_model_mapping = {"image-text-to-text": InstructBlipForConditionalGeneration}
fx_compatible = False fx_compatible = False
test_head_masking = False test_head_masking = False

View File

@ -496,7 +496,6 @@ class InstructBlipVideoForConditionalGenerationDecoderOnlyTest(
ModelTesterMixin, GenerationTesterMixin, unittest.TestCase ModelTesterMixin, GenerationTesterMixin, unittest.TestCase
): ):
all_model_classes = (InstructBlipVideoForConditionalGeneration,) if is_torch_available() else () all_model_classes = (InstructBlipVideoForConditionalGeneration,) if is_torch_available() else ()
all_generative_model_classes = (InstructBlipVideoForConditionalGeneration,) if is_torch_available() else ()
fx_compatible = False fx_compatible = False
test_head_masking = False test_head_masking = False
test_pruning = False test_pruning = False

View File

@ -327,7 +327,6 @@ class JambaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixi
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (JambaForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": JambaModel, "feature-extraction": JambaModel,

View File

@ -280,7 +280,6 @@ class JetMoeModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMix
all_model_classes = ( all_model_classes = (
(JetMoeModel, JetMoeForCausalLM, JetMoeForSequenceClassification) if is_torch_available() else () (JetMoeModel, JetMoeForCausalLM, JetMoeForSequenceClassification) if is_torch_available() else ()
) )
all_generative_model_classes = (JetMoeForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": JetMoeModel, "feature-extraction": JetMoeModel,

View File

@ -259,7 +259,6 @@ class Kosmos2ModelTester:
@require_torch @require_torch
class Kosmos2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class Kosmos2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (Kosmos2Model, Kosmos2ForConditionalGeneration) if is_torch_available() else () all_model_classes = (Kosmos2Model, Kosmos2ForConditionalGeneration) if is_torch_available() else ()
all_generative_model_classes = (Kosmos2ForConditionalGeneration,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": Kosmos2Model, "feature-extraction": Kosmos2Model,

View File

@ -281,7 +281,6 @@ class LEDModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin,
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (LEDForConditionalGeneration,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": LEDModel, "feature-extraction": LEDModel,

View File

@ -176,7 +176,6 @@ class FlaxLlamaModelTester:
@require_flax @require_flax
class FlaxLlamaModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase): class FlaxLlamaModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase):
all_model_classes = (FlaxLlamaModel, FlaxLlamaForCausalLM) if is_flax_available() else () all_model_classes = (FlaxLlamaModel, FlaxLlamaForCausalLM) if is_flax_available() else ()
all_generative_model_classes = (FlaxLlamaForCausalLM,) if is_flax_available() else ()
def setUp(self): def setUp(self):
self.model_tester = FlaxLlamaModelTester(self) self.model_tester = FlaxLlamaModelTester(self)

View File

@ -289,7 +289,6 @@ class LlamaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixi
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (LlamaForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": LlamaModel, "feature-extraction": LlamaModel,

View File

@ -181,7 +181,6 @@ class LlavaForConditionalGenerationModelTest(ModelTesterMixin, GenerationTesterM
""" """
all_model_classes = (LlavaForConditionalGeneration,) if is_torch_available() else () all_model_classes = (LlavaForConditionalGeneration,) if is_torch_available() else ()
all_generative_model_classes = (LlavaForConditionalGeneration,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{"image-to-text": LlavaForConditionalGeneration, "image-text-to-text": LlavaForConditionalGeneration} {"image-to-text": LlavaForConditionalGeneration, "image-text-to-text": LlavaForConditionalGeneration}
if is_torch_available() if is_torch_available()

View File

@ -215,7 +215,6 @@ class LlavaNextForConditionalGenerationModelTest(ModelTesterMixin, GenerationTes
""" """
all_model_classes = (LlavaNextForConditionalGeneration,) if is_torch_available() else () 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 {} pipeline_model_mapping = {"image-text-to-text": LlavaNextForConditionalGeneration} if is_torch_available() else {}
test_pruning = False test_pruning = False
test_head_masking = False test_head_masking = False

View File

@ -231,7 +231,6 @@ class LlavaNextVideoForConditionalGenerationModelTest(ModelTesterMixin, Generati
""" """
all_model_classes = (LlavaNextVideoForConditionalGeneration,) if is_torch_available() else () all_model_classes = (LlavaNextVideoForConditionalGeneration,) if is_torch_available() else ()
all_generative_model_classes = (LlavaNextVideoForConditionalGeneration,) if is_torch_available() else ()
test_pruning = False test_pruning = False
test_head_masking = False test_head_masking = False
_is_composite = True _is_composite = True

View File

@ -215,7 +215,6 @@ class LlavaOnevisionForConditionalGenerationModelTest(ModelTesterMixin, Generati
""" """
all_model_classes = (LlavaOnevisionForConditionalGeneration,) if is_torch_available() else () all_model_classes = (LlavaOnevisionForConditionalGeneration,) if is_torch_available() else ()
all_generative_model_classes = (LlavaOnevisionForConditionalGeneration,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{"image-text-to-text": LlavaOnevisionForConditionalGeneration} if is_torch_available() else {} {"image-text-to-text": LlavaOnevisionForConditionalGeneration} if is_torch_available() else {}
) )

View File

@ -237,7 +237,6 @@ class FlaxLongT5ModelTester:
@require_flax @require_flax
class FlaxLongT5ModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase): class FlaxLongT5ModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase):
all_model_classes = (FlaxLongT5Model, FlaxLongT5ForConditionalGeneration) if is_flax_available() else () all_model_classes = (FlaxLongT5Model, FlaxLongT5ForConditionalGeneration) if is_flax_available() else ()
all_generative_model_classes = (FlaxLongT5ForConditionalGeneration,) if is_flax_available() else ()
is_encoder_decoder = True is_encoder_decoder = True
def setUp(self): def setUp(self):

View File

@ -502,7 +502,6 @@ class LongT5ModelTester:
@require_torch @require_torch
class LongT5ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class LongT5ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (LongT5Model, LongT5ForConditionalGeneration) if is_torch_available() else () all_model_classes = (LongT5Model, LongT5ForConditionalGeneration) if is_torch_available() else ()
all_generative_model_classes = (LongT5ForConditionalGeneration,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": LongT5Model, "feature-extraction": LongT5Model,

View File

@ -240,7 +240,6 @@ class M2M100ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMix
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (M2M100ForConditionalGeneration,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": M2M100Model, "feature-extraction": M2M100Model,

View File

@ -239,7 +239,6 @@ class MambaModelTester:
@require_torch @require_torch
class MambaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class MambaModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (MambaModel, MambaForCausalLM) if is_torch_available() else () 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 has_attentions = False # Mamba does not support attentions
fx_compatible = False # FIXME let's try to support this @ArthurZucker fx_compatible = False # FIXME let's try to support this @ArthurZucker
test_torchscript = False # FIXME let's try to support this @ArthurZucker test_torchscript = False # FIXME let's try to support this @ArthurZucker

View File

@ -214,7 +214,6 @@ class Mamba2ModelTester:
@require_torch @require_torch
class Mamba2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class Mamba2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (Mamba2Model, Mamba2ForCausalLM) if is_torch_available() else () 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 has_attentions = False # Mamba does not support attentions
fx_compatible = False # FIXME let's try to support this @molbap fx_compatible = False # FIXME let's try to support this @molbap
test_torchscript = False # FIXME I think this should be doable @molbap @ArthurZucker test_torchscript = False # FIXME I think this should be doable @molbap @ArthurZucker

View File

@ -231,7 +231,6 @@ class FlaxMarianModelTester:
class FlaxMarianModelTest(FlaxModelTesterMixin, unittest.TestCase, FlaxGenerationTesterMixin): class FlaxMarianModelTest(FlaxModelTesterMixin, unittest.TestCase, FlaxGenerationTesterMixin):
is_encoder_decoder = True is_encoder_decoder = True
all_model_classes = (FlaxMarianModel, FlaxMarianMTModel) if is_flax_available() else () all_model_classes = (FlaxMarianModel, FlaxMarianMTModel) if is_flax_available() else ()
all_generative_model_classes = (FlaxMarianMTModel,) if is_flax_available() else ()
def setUp(self): def setUp(self):
self.model_tester = FlaxMarianModelTester(self) self.model_tester = FlaxMarianModelTester(self)

View File

@ -237,7 +237,6 @@ class MarianModelTester:
@require_torch @require_torch
class MarianModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class MarianModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (MarianModel, MarianMTModel) if is_torch_available() else () all_model_classes = (MarianModel, MarianMTModel) if is_torch_available() else ()
all_generative_model_classes = (MarianMTModel,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": MarianModel, "feature-extraction": MarianModel,
@ -871,7 +870,6 @@ class MarianStandaloneDecoderModelTester:
@require_torch @require_torch
class MarianStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): class MarianStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase):
all_model_classes = (MarianDecoder, MarianForCausalLM) if is_torch_available() else () all_model_classes = (MarianDecoder, MarianForCausalLM) if is_torch_available() else ()
all_generative_model_classes = (MarianForCausalLM,) if is_torch_available() else ()
test_pruning = False test_pruning = False
is_encoder_decoder = False is_encoder_decoder = False

View File

@ -342,7 +342,6 @@ class FlaxMBartModelTest(FlaxModelTesterMixin, unittest.TestCase, FlaxGeneration
if is_flax_available() if is_flax_available()
else () else ()
) )
all_generative_model_classes = (FlaxMBartForConditionalGeneration,) if is_flax_available() else ()
def setUp(self): def setUp(self):
self.model_tester = FlaxMBartModelTester(self) self.model_tester = FlaxMBartModelTester(self)

View File

@ -229,7 +229,6 @@ class MBartModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixi
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (MBartForConditionalGeneration,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": MBartModel, "feature-extraction": MBartModel,
@ -727,7 +726,6 @@ class MBartStandaloneDecoderModelTester:
@require_torch @require_torch
class MBartStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): class MBartStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase):
all_model_classes = (MBartDecoder, MBartForCausalLM) if is_torch_available() else () all_model_classes = (MBartDecoder, MBartForCausalLM) if is_torch_available() else ()
all_generative_model_classes = (MBartForCausalLM,) if is_torch_available() else ()
test_pruning = False test_pruning = False
is_encoder_decoder = False is_encoder_decoder = False

View File

@ -187,7 +187,6 @@ class FlaxMistralModelTester:
@require_flax @require_flax
class FlaxMistralModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase): class FlaxMistralModelTest(FlaxModelTesterMixin, FlaxGenerationTesterMixin, unittest.TestCase):
all_model_classes = (FlaxMistralModel, FlaxMistralForCausalLM) if is_flax_available() else () all_model_classes = (FlaxMistralModel, FlaxMistralForCausalLM) if is_flax_available() else ()
all_generative_model_classes = (FlaxMistralForCausalLM,) if is_flax_available() else ()
def setUp(self): def setUp(self):
self.model_tester = FlaxMistralModelTester(self) self.model_tester = FlaxMistralModelTester(self)

View File

@ -301,7 +301,6 @@ class MistralModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMi
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (MistralForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": MistralModel, "feature-extraction": MistralModel,

View File

@ -300,7 +300,6 @@ class MixtralModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMi
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (MixtralForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": MixtralModel, "feature-extraction": MixtralModel,

View File

@ -124,7 +124,6 @@ class MllamaForCausalLMModelTest(ModelTesterMixin, GenerationTesterMixin, unitte
""" """
all_model_classes = (MllamaForCausalLM,) if is_torch_available() else () all_model_classes = (MllamaForCausalLM,) if is_torch_available() else ()
all_generative_model_classes = (MllamaForCausalLM,) if is_torch_available() else ()
test_pruning = False test_pruning = False
test_head_masking = False test_head_masking = False
@ -264,7 +263,6 @@ class MllamaForConditionalGenerationModelTest(ModelTesterMixin, GenerationTester
""" """
all_model_classes = (MllamaForConditionalGeneration,) if is_torch_available() else () 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 () pipeline_model_mapping = {"image-text-to-text": MllamaForConditionalGeneration} if is_torch_available() else ()
test_pruning = False test_pruning = False
test_head_masking = False test_head_masking = False

View File

@ -229,7 +229,6 @@ class ModernBertModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTeste
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": ModernBertModel, "feature-extraction": ModernBertModel,

View File

@ -170,6 +170,8 @@ class MoonshineModelTester:
@require_torch @require_torch
class MoonshineModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class MoonshineModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (MoonshineModel, MoonshineForConditionalGeneration) if is_torch_available() else () 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 = ( pipeline_model_mapping = (
{ {
"automatic-speech-recognition": MoonshineForConditionalGeneration, "automatic-speech-recognition": MoonshineForConditionalGeneration,

View File

@ -152,9 +152,6 @@ class MoshiDecoderTester:
@require_torch @require_torch
class MoshiDecoderTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class MoshiDecoderTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (MoshiModel, MoshiForCausalLM) if is_torch_available() else () 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_pruning = False
test_resize_embeddings = True test_resize_embeddings = True
test_head_masking = False test_head_masking = False
@ -528,7 +525,6 @@ class MoshiTester:
@require_torch @require_torch
class MoshiTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): class MoshiTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase):
all_model_classes = (MoshiForConditionalGeneration,) if is_torch_available() else () 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_pruning = False # training is not supported yet for Moshi
test_headmasking = False test_headmasking = False
test_resize_embeddings = False test_resize_embeddings = False

View File

@ -354,7 +354,6 @@ class MptModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin,
else () else ()
) )
all_generative_model_classes = (MptForCausalLM,) if is_torch_available() else ()
fx_compatible = False fx_compatible = False
test_missing_keys = False test_missing_keys = False
test_pruning = False test_pruning = False

View File

@ -298,7 +298,6 @@ class MraModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
test_torchscript = False test_torchscript = False
has_attentions = False has_attentions = False
all_generative_model_classes = ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": MraModel, "feature-extraction": MraModel,

View File

@ -553,7 +553,6 @@ class MT5ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin,
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (MT5ForConditionalGeneration,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": MT5Model, "feature-extraction": MT5Model,

View File

@ -176,6 +176,8 @@ class MusicgenDecoderTester:
@require_torch @require_torch
class MusicgenDecoderTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class MusicgenDecoderTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (MusicgenModel, MusicgenForCausalLM) if is_torch_available() else () 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 = ( greedy_sample_model_classes = (
(MusicgenForCausalLM,) if is_torch_available() else () (MusicgenForCausalLM,) if is_torch_available() else ()
) # we don't want to run all the generation tests, only a specific subset ) # we don't want to run all the generation tests, only a specific subset
@ -801,6 +803,8 @@ class MusicgenTester:
@require_torch @require_torch
class MusicgenTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class MusicgenTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (MusicgenForConditionalGeneration,) if is_torch_available() else () 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 () greedy_sample_model_classes = (MusicgenForConditionalGeneration,) if is_torch_available() else ()
pipeline_model_mapping = {"text-to-audio": 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 test_pruning = False # training is not supported yet for MusicGen

View File

@ -182,6 +182,8 @@ class MusicgenMelodyDecoderTester:
@require_torch @require_torch
class MusicgenMelodyDecoderTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): class MusicgenMelodyDecoderTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase):
all_model_classes = (MusicgenMelodyModel, MusicgenMelodyForCausalLM) if is_torch_available() else () 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 = ( greedy_sample_model_classes = (
(MusicgenMelodyForCausalLM,) if is_torch_available() else () (MusicgenMelodyForCausalLM,) if is_torch_available() else ()
) # the model uses a custom generation method so we only run a specific subset of the generation tests ) # the model uses a custom generation method so we only run a specific subset of the generation tests
@ -820,6 +822,8 @@ class MusicgenMelodyTester:
# Copied from tests.models.musicgen.test_modeling_musicgen.MusicgenTest with Musicgen->MusicgenMelody, musicgen->musicgen_melody, EncoderDecoder->DecoderOnly, input_values->input_features # 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): class MusicgenMelodyTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (MusicgenMelodyForConditionalGeneration,) if is_torch_available() else () 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 () greedy_sample_model_classes = (MusicgenMelodyForConditionalGeneration,) if is_torch_available() else ()
pipeline_model_mapping = {"text-to-audio": 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 test_pruning = False # training is not supported yet for MusicGen

View File

@ -418,7 +418,6 @@ class MvpModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin,
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (MvpForConditionalGeneration,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": MvpModel, "feature-extraction": MvpModel,
@ -803,7 +802,6 @@ class MvpStandaloneDecoderModelTester:
@require_torch @require_torch
class MvpStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): class MvpStandaloneDecoderModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase):
all_model_classes = (MvpDecoder, MvpForCausalLM) if is_torch_available() else () all_model_classes = (MvpDecoder, MvpForCausalLM) if is_torch_available() else ()
all_generative_model_classes = (MvpForCausalLM,) if is_torch_available() else ()
fx_comptatible = True fx_comptatible = True
test_pruning = False test_pruning = False
is_encoder_decoder = False is_encoder_decoder = False

View File

@ -75,7 +75,6 @@ class NemotronModelTest(GemmaModelTest):
if is_torch_available() if is_torch_available()
else () else ()
) )
all_generative_model_classes = (NemotronForCausalLM,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": NemotronModel, "feature-extraction": NemotronModel,

View File

@ -247,7 +247,6 @@ class NllbMoeModelTester:
@require_torch @require_torch
class NllbMoeModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): class NllbMoeModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (NllbMoeModel, NllbMoeForConditionalGeneration) if is_torch_available() else () all_model_classes = (NllbMoeModel, NllbMoeForConditionalGeneration) if is_torch_available() else ()
all_generative_model_classes = (NllbMoeForConditionalGeneration,) if is_torch_available() else ()
pipeline_model_mapping = ( pipeline_model_mapping = (
{ {
"feature-extraction": NllbMoeModel, "feature-extraction": NllbMoeModel,

Some files were not shown because too many files have changed in this diff Show More