Unverified Commit 25245ec2 authored by amyeroberts's avatar amyeroberts Committed by GitHub
Browse files

Rename test_model_common_attributes -> test_model_get_set_embeddings (#31321)

* Rename to test_model_common_attributes
The method name is misleading - it is testing being able to get and set embeddings, not common attributes to all models

* Explicitly skip
parent c1be42f6
...@@ -142,7 +142,7 @@ class GitVisionModelTest(ModelTesterMixin, unittest.TestCase): ...@@ -142,7 +142,7 @@ class GitVisionModelTest(ModelTesterMixin, unittest.TestCase):
def test_inputs_embeds(self): def test_inputs_embeds(self):
pass pass
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
config, _ = self.model_tester.prepare_config_and_inputs_for_common() config, _ = self.model_tester.prepare_config_and_inputs_for_common()
for model_class in self.all_model_classes: for model_class in self.all_model_classes:
......
...@@ -173,7 +173,7 @@ class GLPNModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -173,7 +173,7 @@ class GLPNModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
pass pass
@unittest.skip("GLPN does not have get_input_embeddings method and get_output_embeddings methods") @unittest.skip("GLPN does not have get_input_embeddings method and get_output_embeddings methods")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
def test_attention_outputs(self): def test_attention_outputs(self):
......
...@@ -269,7 +269,7 @@ class GroundingDinoModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes ...@@ -269,7 +269,7 @@ class GroundingDinoModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes
pass pass
@unittest.skip(reason="Grounding DINO does not have a get_input_embeddings method") @unittest.skip(reason="Grounding DINO does not have a get_input_embeddings method")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
@unittest.skip(reason="Grounding DINO does not use token embeddings") @unittest.skip(reason="Grounding DINO does not use token embeddings")
......
...@@ -174,7 +174,7 @@ class GroupViTVisionModelTest(ModelTesterMixin, unittest.TestCase): ...@@ -174,7 +174,7 @@ class GroupViTVisionModelTest(ModelTesterMixin, unittest.TestCase):
tf.random.set_seed(seed) tf.random.set_seed(seed)
return super().test_pt_tf_model_equivalence() return super().test_pt_tf_model_equivalence()
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
config, _ = self.model_tester.prepare_config_and_inputs_for_common() config, _ = self.model_tester.prepare_config_and_inputs_for_common()
for model_class in self.all_model_classes: for model_class in self.all_model_classes:
...@@ -573,7 +573,7 @@ class GroupViTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase ...@@ -573,7 +573,7 @@ class GroupViTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase
pass pass
@unittest.skip(reason="GroupViTModel does not have input/output embeddings") @unittest.skip(reason="GroupViTModel does not have input/output embeddings")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
# overwritten from parent as this equivalent test needs a specific `seed` and hard to get a good one! # overwritten from parent as this equivalent test needs a specific `seed` and hard to get a good one!
......
...@@ -366,7 +366,7 @@ class HubertModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -366,7 +366,7 @@ class HubertModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
# Hubert has no inputs_embeds # Hubert has no inputs_embeds
# and thus the `get_input_embeddings` fn # and thus the `get_input_embeddings` fn
# is not implemented # is not implemented
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
def test_retain_grad_hidden_states_attentions(self): def test_retain_grad_hidden_states_attentions(self):
...@@ -631,7 +631,7 @@ class HubertRobustModelTest(ModelTesterMixin, unittest.TestCase): ...@@ -631,7 +631,7 @@ class HubertRobustModelTest(ModelTesterMixin, unittest.TestCase):
# Hubert has no inputs_embeds # Hubert has no inputs_embeds
# and thus the `get_input_embeddings` fn # and thus the `get_input_embeddings` fn
# is not implemented # is not implemented
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
def test_retain_grad_hidden_states_attentions(self): def test_retain_grad_hidden_states_attentions(self):
......
...@@ -334,7 +334,7 @@ class IBertModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -334,7 +334,7 @@ class IBertModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
self.assertTrue(torch.all(torch.eq(position_ids, expected_positions))) self.assertTrue(torch.all(torch.eq(position_ids, expected_positions)))
# Override # Override
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common()
for model_class in self.all_model_classes: for model_class in self.all_model_classes:
......
...@@ -198,7 +198,6 @@ class InformerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase ...@@ -198,7 +198,6 @@ class InformerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase
test_missing_keys = False test_missing_keys = False
test_torchscript = False test_torchscript = False
test_inputs_embeds = False test_inputs_embeds = False
test_model_common_attributes = False
def setUp(self): def setUp(self):
self.model_tester = InformerModelTester(self) self.model_tester = InformerModelTester(self)
...@@ -468,6 +467,10 @@ class InformerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase ...@@ -468,6 +467,10 @@ class InformerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase
def test_retain_grad_hidden_states_attentions(self): def test_retain_grad_hidden_states_attentions(self):
super().test_retain_grad_hidden_states_attentions() super().test_retain_grad_hidden_states_attentions()
@unittest.skip(reason="Model does not have input embeddings")
def test_model_get_set_embeddings(self):
pass
def prepare_batch(filename="train-batch.pt"): def prepare_batch(filename="train-batch.pt"):
file = hf_hub_download(repo_id="hf-internal-testing/tourism-monthly-batch", filename=filename, repo_type="dataset") file = hf_hub_download(repo_id="hf-internal-testing/tourism-monthly-batch", filename=filename, repo_type="dataset")
......
...@@ -165,7 +165,7 @@ class InstructBlipVisionModelTest(ModelTesterMixin, unittest.TestCase): ...@@ -165,7 +165,7 @@ class InstructBlipVisionModelTest(ModelTesterMixin, unittest.TestCase):
def test_inputs_embeds(self): def test_inputs_embeds(self):
pass pass
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
config, _ = self.model_tester.prepare_config_and_inputs_for_common() config, _ = self.model_tester.prepare_config_and_inputs_for_common()
for model_class in self.all_model_classes: for model_class in self.all_model_classes:
...@@ -485,7 +485,7 @@ class InstructBlipForConditionalGenerationDecoderOnlyTest(ModelTesterMixin, Gene ...@@ -485,7 +485,7 @@ class InstructBlipForConditionalGenerationDecoderOnlyTest(ModelTesterMixin, Gene
pass pass
@unittest.skip(reason="InstructBlipModel does not have input/output embeddings") @unittest.skip(reason="InstructBlipModel does not have input/output embeddings")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
@unittest.skip(reason="There's no base InstructBlipModel") @unittest.skip(reason="There's no base InstructBlipModel")
......
...@@ -209,7 +209,7 @@ class LevitModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -209,7 +209,7 @@ class LevitModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
pass pass
@unittest.skip(reason="Levit does not support input and output embeddings") @unittest.skip(reason="Levit does not support input and output embeddings")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
@unittest.skip(reason="Levit does not output attentions") @unittest.skip(reason="Levit does not output attentions")
......
...@@ -225,7 +225,7 @@ class Mask2FormerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC ...@@ -225,7 +225,7 @@ class Mask2FormerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC
pass pass
@unittest.skip(reason="Mask2Former does not have a get_input_embeddings method") @unittest.skip(reason="Mask2Former does not have a get_input_embeddings method")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
@unittest.skip(reason="Mask2Former is not a generative model") @unittest.skip(reason="Mask2Former is not a generative model")
......
...@@ -251,7 +251,7 @@ class MaskFormerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCa ...@@ -251,7 +251,7 @@ class MaskFormerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCa
pass pass
@unittest.skip(reason="MaskFormer does not have a get_input_embeddings method") @unittest.skip(reason="MaskFormer does not have a get_input_embeddings method")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
@unittest.skip(reason="MaskFormer is not a generative model") @unittest.skip(reason="MaskFormer is not a generative model")
......
...@@ -224,7 +224,7 @@ class MaskFormerSwinModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te ...@@ -224,7 +224,7 @@ class MaskFormerSwinModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te
def test_feed_forward_chunking(self): def test_feed_forward_chunking(self):
pass pass
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
config, _ = self.model_tester.prepare_config_and_inputs_for_common() config, _ = self.model_tester.prepare_config_and_inputs_for_common()
for model_class in self.all_model_classes: for model_class in self.all_model_classes:
......
...@@ -145,7 +145,7 @@ class MgpstrModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -145,7 +145,7 @@ class MgpstrModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
def test_inputs_embeds(self): def test_inputs_embeds(self):
pass pass
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
config, _ = self.model_tester.prepare_config_and_inputs_for_common() config, _ = self.model_tester.prepare_config_and_inputs_for_common()
for model_class in self.all_model_classes: for model_class in self.all_model_classes:
......
...@@ -167,7 +167,7 @@ class MobileNetV1ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC ...@@ -167,7 +167,7 @@ class MobileNetV1ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC
pass pass
@unittest.skip(reason="MobileNetV1 does not support input and output embeddings") @unittest.skip(reason="MobileNetV1 does not support input and output embeddings")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
@unittest.skip(reason="MobileNetV1 does not output attentions") @unittest.skip(reason="MobileNetV1 does not output attentions")
......
...@@ -218,7 +218,7 @@ class MobileNetV2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC ...@@ -218,7 +218,7 @@ class MobileNetV2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC
pass pass
@unittest.skip(reason="MobileNetV2 does not support input and output embeddings") @unittest.skip(reason="MobileNetV2 does not support input and output embeddings")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
@unittest.skip(reason="MobileNetV2 does not output attentions") @unittest.skip(reason="MobileNetV2 does not output attentions")
......
...@@ -211,7 +211,7 @@ class MobileViTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCas ...@@ -211,7 +211,7 @@ class MobileViTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCas
pass pass
@unittest.skip(reason="MobileViT does not support input and output embeddings") @unittest.skip(reason="MobileViT does not support input and output embeddings")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
@unittest.skip(reason="MobileViT does not output attentions") @unittest.skip(reason="MobileViT does not output attentions")
......
...@@ -213,7 +213,7 @@ class MobileViTV2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC ...@@ -213,7 +213,7 @@ class MobileViTV2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC
pass pass
@unittest.skip(reason="MobileViTV2 does not support input and output embeddings") @unittest.skip(reason="MobileViTV2 does not support input and output embeddings")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
@unittest.skip(reason="MobileViTV2 does not output attentions") @unittest.skip(reason="MobileViTV2 does not output attentions")
......
...@@ -256,7 +256,7 @@ class MusicgenDecoderTest(ModelTesterMixin, GenerationTesterMixin, PipelineTeste ...@@ -256,7 +256,7 @@ class MusicgenDecoderTest(ModelTesterMixin, GenerationTesterMixin, PipelineTeste
model(**inputs)[0] model(**inputs)[0]
# override since we have embeddings / LM heads over multiple codebooks # override since we have embeddings / LM heads over multiple codebooks
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common()
for model_class in self.all_model_classes: for model_class in self.all_model_classes:
...@@ -1401,7 +1401,7 @@ class MusicgenTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, ...@@ -1401,7 +1401,7 @@ class MusicgenTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin,
) )
# override since we have embeddings / LM heads over multiple codebooks # override since we have embeddings / LM heads over multiple codebooks
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common()
for model_class in self.all_model_classes: for model_class in self.all_model_classes:
......
...@@ -259,7 +259,7 @@ class MusicgenMelodyDecoderTest(ModelTesterMixin, GenerationTesterMixin, unittes ...@@ -259,7 +259,7 @@ class MusicgenMelodyDecoderTest(ModelTesterMixin, GenerationTesterMixin, unittes
model(**inputs)[0] model(**inputs)[0]
# override since we have embeddings / LM heads over multiple codebooks # override since we have embeddings / LM heads over multiple codebooks
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common()
for model_class in self.all_model_classes: for model_class in self.all_model_classes:
...@@ -1385,7 +1385,7 @@ class MusicgenMelodyTest(ModelTesterMixin, GenerationTesterMixin, PipelineTester ...@@ -1385,7 +1385,7 @@ class MusicgenMelodyTest(ModelTesterMixin, GenerationTesterMixin, PipelineTester
) )
# override since we have embeddings / LM heads over multiple codebooks # override since we have embeddings / LM heads over multiple codebooks
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common()
for model_class in self.all_model_classes: for model_class in self.all_model_classes:
......
...@@ -293,7 +293,7 @@ class OneFormerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCas ...@@ -293,7 +293,7 @@ class OneFormerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCas
pass pass
@unittest.skip(reason="OneFormer does not have a get_input_embeddings method") @unittest.skip(reason="OneFormer does not have a get_input_embeddings method")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
@unittest.skip(reason="OneFormer is not a generative model") @unittest.skip(reason="OneFormer is not a generative model")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment