"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "e577bd0f13e1820650810f6864253d70dc76ce08"
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
...@@ -162,7 +162,7 @@ class Owlv2VisionModelTest(ModelTesterMixin, unittest.TestCase): ...@@ -162,7 +162,7 @@ class Owlv2VisionModelTest(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:
...@@ -465,7 +465,7 @@ class Owlv2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -465,7 +465,7 @@ class Owlv2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
pass pass
@unittest.skip(reason="Owlv2Model does not have input/output embeddings") @unittest.skip(reason="Owlv2Model does not have input/output embeddings")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
# override as the `logit_scale` parameter initilization is different for OWLV2 # override as the `logit_scale` parameter initilization is different for OWLV2
...@@ -671,7 +671,7 @@ class Owlv2ForObjectDetectionTest(ModelTesterMixin, unittest.TestCase): ...@@ -671,7 +671,7 @@ class Owlv2ForObjectDetectionTest(ModelTesterMixin, unittest.TestCase):
pass pass
@unittest.skip(reason="Owlv2Model does not have input/output embeddings") @unittest.skip(reason="Owlv2Model does not have input/output embeddings")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
@unittest.skip(reason="Test_initialization is tested in individual model tests") @unittest.skip(reason="Test_initialization is tested in individual model tests")
......
...@@ -160,7 +160,7 @@ class OwlViTVisionModelTest(ModelTesterMixin, unittest.TestCase): ...@@ -160,7 +160,7 @@ class OwlViTVisionModelTest(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:
...@@ -460,7 +460,7 @@ class OwlViTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -460,7 +460,7 @@ class OwlViTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
pass pass
@unittest.skip(reason="OwlViTModel does not have input/output embeddings") @unittest.skip(reason="OwlViTModel does not have input/output embeddings")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
# override as the `logit_scale` parameter initilization is different for OWLVIT # override as the `logit_scale` parameter initilization is different for OWLVIT
...@@ -664,7 +664,7 @@ class OwlViTForObjectDetectionTest(ModelTesterMixin, unittest.TestCase): ...@@ -664,7 +664,7 @@ class OwlViTForObjectDetectionTest(ModelTesterMixin, unittest.TestCase):
pass pass
@unittest.skip(reason="OwlViTModel does not have input/output embeddings") @unittest.skip(reason="OwlViTModel does not have input/output embeddings")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
@unittest.skip(reason="Test_initialization is tested in individual model tests") @unittest.skip(reason="Test_initialization is tested in individual model tests")
......
...@@ -229,7 +229,6 @@ class PatchTSMixerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test ...@@ -229,7 +229,6 @@ class PatchTSMixerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test
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
test_resize_embeddings = True test_resize_embeddings = True
test_resize_position_embeddings = False test_resize_position_embeddings = False
...@@ -448,6 +447,10 @@ class PatchTSMixerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test ...@@ -448,6 +447,10 @@ class PatchTSMixerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test
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(repo_id="ibm/patchtsmixer-etth1-test-data", file="pretrain_batch.pt"): def prepare_batch(repo_id="ibm/patchtsmixer-etth1-test-data", file="pretrain_batch.pt"):
# TODO: Make repo public # TODO: Make repo public
......
...@@ -165,7 +165,6 @@ class PatchTSTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase ...@@ -165,7 +165,6 @@ class PatchTSTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase
test_missing_keys = True test_missing_keys = True
test_torchscript = False test_torchscript = False
test_inputs_embeds = False test_inputs_embeds = False
test_model_common_attributes = False
test_resize_embeddings = True test_resize_embeddings = True
test_resize_position_embeddings = False test_resize_position_embeddings = False
...@@ -297,6 +296,10 @@ class PatchTSTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase ...@@ -297,6 +296,10 @@ class PatchTSTModelTest(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(repo_id="hf-internal-testing/etth1-hourly-batch", file="train-batch.pt"): def prepare_batch(repo_id="hf-internal-testing/etth1-hourly-batch", file="train-batch.pt"):
file = hf_hub_download(repo_id=repo_id, filename=file, repo_type="dataset") file = hf_hub_download(repo_id=repo_id, filename=file, repo_type="dataset")
......
...@@ -377,7 +377,7 @@ class PerceiverModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCas ...@@ -377,7 +377,7 @@ class PerceiverModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCas
) )
self.model_tester.create_and_check_for_image_classification_conv(*config_and_inputs) self.model_tester.create_and_check_for_image_classification_conv(*config_and_inputs)
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
for model_class in self.all_model_classes: for model_class in self.all_model_classes:
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_model_class(model_class) config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_model_class(model_class)
model = model_class(config) model = model_class(config)
......
...@@ -162,7 +162,7 @@ class Pix2StructVisionModelTest(ModelTesterMixin, unittest.TestCase): ...@@ -162,7 +162,7 @@ class Pix2StructVisionModelTest(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:
...@@ -458,7 +458,7 @@ class Pix2StructModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCa ...@@ -458,7 +458,7 @@ class Pix2StructModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCa
pass pass
@unittest.skip(reason="Pix2StructModel does not have input/output embeddings") @unittest.skip(reason="Pix2StructModel does not have input/output embeddings")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
def test_forward_signature(self): def test_forward_signature(self):
......
...@@ -149,7 +149,7 @@ class PoolFormerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCa ...@@ -149,7 +149,7 @@ class PoolFormerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCa
pass pass
@unittest.skip("PoolFormer does not have get_input_embeddings method and get_output_embeddings methods") @unittest.skip("PoolFormer 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_hidden_states_output(self): def test_hidden_states_output(self):
......
...@@ -183,7 +183,7 @@ class PvtModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -183,7 +183,7 @@ class PvtModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
pass pass
@unittest.skip("Pvt does not have get_input_embeddings method and get_output_embeddings methods") @unittest.skip("Pvt 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_initialization(self): def test_initialization(self):
......
...@@ -219,7 +219,7 @@ class PvtV2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -219,7 +219,7 @@ class PvtV2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
pass pass
@unittest.skip("Pvt-V2 does not have get_input_embeddings method and get_output_embeddings methods") @unittest.skip("Pvt-V2 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
@unittest.skip(reason="This architecture does not work with using reentrant.") @unittest.skip(reason="This architecture does not work with using reentrant.")
......
...@@ -155,7 +155,7 @@ class RegNetModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -155,7 +155,7 @@ class RegNetModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
pass pass
@unittest.skip(reason="RegNet does not support input and output embeddings") @unittest.skip(reason="RegNet does not support input and output embeddings")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
def test_model(self): def test_model(self):
......
...@@ -200,7 +200,7 @@ class ResNetModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -200,7 +200,7 @@ class ResNetModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
pass pass
@unittest.skip(reason="ResNet does not support input and output embeddings") @unittest.skip(reason="ResNet does not support input and output embeddings")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
def test_model(self): def test_model(self):
......
...@@ -326,7 +326,7 @@ class SamModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -326,7 +326,7 @@ class SamModelTest(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:
......
...@@ -205,7 +205,7 @@ class SegformerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCas ...@@ -205,7 +205,7 @@ class SegformerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCas
pass pass
@unittest.skip("SegFormer does not have get_input_embeddings method and get_output_embeddings methods") @unittest.skip("SegFormer 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):
......
...@@ -187,7 +187,7 @@ class SegGptModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -187,7 +187,7 @@ class SegGptModelTest(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:
......
...@@ -352,7 +352,7 @@ class SEWModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -352,7 +352,7 @@ class SEWModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
# SEW has no inputs_embeds # SEW 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
@unittest.skip("No support for low_cpu_mem_usage=True.") @unittest.skip("No support for low_cpu_mem_usage=True.")
......
...@@ -374,7 +374,7 @@ class SEWDModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -374,7 +374,7 @@ class SEWDModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
# SEW has no inputs_embeds # SEW 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):
......
...@@ -166,7 +166,7 @@ class SiglipVisionModelTest(ModelTesterMixin, unittest.TestCase): ...@@ -166,7 +166,7 @@ class SiglipVisionModelTest(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:
...@@ -469,8 +469,8 @@ class SiglipModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -469,8 +469,8 @@ class SiglipModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
pass pass
@unittest.skip(reason="SiglipModel does not have input/output embeddings") @unittest.skip(reason="SiglipModel does not have input/output embeddings")
# Copied from tests.models.clip.test_modeling_clip.CLIPModelTest.test_model_common_attributes # Copied from tests.models.clip.test_modeling_clip.CLIPModelTest.test_model_get_set_embeddings
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
@unittest.skip(reason="SiglipModel does not support training") @unittest.skip(reason="SiglipModel does not support training")
...@@ -627,7 +627,7 @@ class SiglipForImageClassificationModelTest(ModelTesterMixin, PipelineTesterMixi ...@@ -627,7 +627,7 @@ class SiglipForImageClassificationModelTest(ModelTesterMixin, PipelineTesterMixi
pass pass
@unittest.skip(reason="SiglipForImageClassification does not support inputs_embeds") @unittest.skip(reason="SiglipForImageClassification does not support inputs_embeds")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
@unittest.skip(reason="SiglipForImageClassification does not support gradient checkpointing yet") @unittest.skip(reason="SiglipForImageClassification does not support gradient checkpointing yet")
......
...@@ -217,7 +217,7 @@ class SpeechT5ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase ...@@ -217,7 +217,7 @@ class SpeechT5ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase
pass pass
# this model has no input embeddings # this model has no input embeddings
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):
...@@ -1654,7 +1654,7 @@ class SpeechT5ForSpeechToSpeechTest(ModelTesterMixin, unittest.TestCase): ...@@ -1654,7 +1654,7 @@ class SpeechT5ForSpeechToSpeechTest(ModelTesterMixin, unittest.TestCase):
pass pass
# this model has no input embeddings # this model has no input embeddings
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
# skipped because there is always dropout in SpeechT5SpeechDecoderPrenet # skipped because there is always dropout in SpeechT5SpeechDecoderPrenet
...@@ -1848,7 +1848,7 @@ class SpeechT5HifiGanTest(ModelTesterMixin, unittest.TestCase): ...@@ -1848,7 +1848,7 @@ class SpeechT5HifiGanTest(ModelTesterMixin, unittest.TestCase):
pass pass
# this model has no input embeddings # this model has no input embeddings
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
# skip as this model doesn't support all arguments tested # skip as this model doesn't support all arguments tested
......
...@@ -143,7 +143,7 @@ class SuperPointModelTest(ModelTesterMixin, unittest.TestCase): ...@@ -143,7 +143,7 @@ class SuperPointModelTest(ModelTesterMixin, unittest.TestCase):
pass pass
@unittest.skip(reason="SuperPointForKeypointDetection does not support input and output embeddings") @unittest.skip(reason="SuperPointForKeypointDetection 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="SuperPointForKeypointDetection does not use feedforward chunking") @unittest.skip(reason="SuperPointForKeypointDetection does not use feedforward chunking")
......
...@@ -166,7 +166,7 @@ class SwiftFormerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC ...@@ -166,7 +166,7 @@ class SwiftFormerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestC
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:
......
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