"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "2f320661f364557c821c285729dab3881e977363"
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
...@@ -185,7 +185,7 @@ class CvtModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -185,7 +185,7 @@ class CvtModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
pass pass
@unittest.skip(reason="Cvt does not support input and output embeddings") @unittest.skip(reason="Cvt 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):
......
...@@ -442,7 +442,7 @@ class Data2VecAudioModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes ...@@ -442,7 +442,7 @@ class Data2VecAudioModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes
# Data2VecAudio has no inputs_embeds # Data2VecAudio 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
@is_pt_flax_cross_test @is_pt_flax_cross_test
......
...@@ -207,7 +207,7 @@ class Data2VecVisionModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te ...@@ -207,7 +207,7 @@ class Data2VecVisionModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Te
def test_multi_gpu_data_parallel_forward(self): def test_multi_gpu_data_parallel_forward(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:
......
...@@ -143,7 +143,6 @@ class DecisionTransformerModelTest(ModelTesterMixin, GenerationTesterMixin, Pipe ...@@ -143,7 +143,6 @@ class DecisionTransformerModelTest(ModelTesterMixin, GenerationTesterMixin, Pipe
test_attention_outputs = False test_attention_outputs = False
test_hidden_states_output = False test_hidden_states_output = False
test_inputs_embeds = False test_inputs_embeds = False
test_model_common_attributes = False
test_gradient_checkpointing = False test_gradient_checkpointing = False
test_torchscript = False test_torchscript = False
...@@ -184,6 +183,10 @@ class DecisionTransformerModelTest(ModelTesterMixin, GenerationTesterMixin, Pipe ...@@ -184,6 +183,10 @@ class DecisionTransformerModelTest(ModelTesterMixin, GenerationTesterMixin, Pipe
self.assertListEqual(arg_names[: len(expected_arg_names)], expected_arg_names) self.assertListEqual(arg_names[: len(expected_arg_names)], expected_arg_names)
@unittest.skip(reason="Model does not have input embeddings")
def test_model_get_set_embeddings(self):
pass
@require_torch @require_torch
class DecisionTransformerModelIntegrationTest(unittest.TestCase): class DecisionTransformerModelIntegrationTest(unittest.TestCase):
......
...@@ -257,7 +257,7 @@ class DeformableDetrModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineT ...@@ -257,7 +257,7 @@ class DeformableDetrModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineT
pass pass
@unittest.skip(reason="Deformable DETR does not have a get_input_embeddings method") @unittest.skip(reason="Deformable DETR 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="Deformable DETR is not a generative model") @unittest.skip(reason="Deformable DETR is not a generative model")
......
...@@ -241,7 +241,7 @@ class DeiTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -241,7 +241,7 @@ class DeiTModelTest(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:
......
...@@ -178,7 +178,7 @@ class DepthAnythingModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes ...@@ -178,7 +178,7 @@ class DepthAnythingModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes
pass pass
@unittest.skip(reason="Depth Anything with AutoBackbone does not have a base model and hence no input_embeddings") @unittest.skip(reason="Depth Anything with AutoBackbone does not have a base model and hence no input_embeddings")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
@unittest.skip(reason="Depth Anything with AutoBackbone does not have a base model") @unittest.skip(reason="Depth Anything with AutoBackbone does not have a base model")
......
...@@ -251,7 +251,7 @@ class DetrModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin ...@@ -251,7 +251,7 @@ class DetrModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin
pass pass
@unittest.skip(reason="DETR does not have a get_input_embeddings method") @unittest.skip(reason="DETR 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="DETR is not a generative model") @unittest.skip(reason="DETR is not a generative model")
......
...@@ -253,7 +253,7 @@ class DinatModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -253,7 +253,7 @@ class DinatModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
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:
......
...@@ -258,7 +258,7 @@ class Dinov2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -258,7 +258,7 @@ class Dinov2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
def test_training_gradient_checkpointing_use_reentrant_false(self): def test_training_gradient_checkpointing_use_reentrant_false(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:
......
...@@ -175,7 +175,7 @@ class DonutSwinModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCas ...@@ -175,7 +175,7 @@ class DonutSwinModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCas
# DonutSwin does not use inputs_embeds # DonutSwin does not use inputs_embeds
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:
......
...@@ -183,7 +183,7 @@ class DPTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -183,7 +183,7 @@ class DPTModelTest(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:
......
...@@ -217,7 +217,7 @@ class DPTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -217,7 +217,7 @@ class DPTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
) )
@unittest.skip(reason="DPT with AutoBackbone does not have a base model and hence no input_embeddings") @unittest.skip(reason="DPT with AutoBackbone does not have a base model and hence no input_embeddings")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
@unittest.skip(reason="DPT with AutoBackbone does not have a base model") @unittest.skip(reason="DPT with AutoBackbone does not have a base model")
......
...@@ -198,7 +198,7 @@ class DPTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -198,7 +198,7 @@ class DPTModelTest(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:
......
...@@ -162,7 +162,7 @@ class EfficientNetModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test ...@@ -162,7 +162,7 @@ class EfficientNetModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Test
pass pass
@unittest.skip(reason="EfficientNet does not support input and output embeddings") @unittest.skip(reason="EfficientNet 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="EfficientNet does not use feedforward chunking") @unittest.skip(reason="EfficientNet does not use feedforward chunking")
......
...@@ -183,7 +183,7 @@ class EncodecModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase) ...@@ -183,7 +183,7 @@ class EncodecModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase)
pass pass
@unittest.skip("The EncodecModel is not transformers based, thus it does not have `inputs_embeds` logics") @unittest.skip("The EncodecModel is not transformers based, thus it does not have `inputs_embeds` logics")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
@unittest.skip("The EncodecModel is not transformers based, thus it does not have the usual `attention` logic") @unittest.skip("The EncodecModel is not transformers based, thus it does not have the usual `attention` logic")
......
...@@ -344,7 +344,7 @@ class FastSpeech2ConformerModelTest(ModelTesterMixin, unittest.TestCase): ...@@ -344,7 +344,7 @@ class FastSpeech2ConformerModelTest(ModelTesterMixin, unittest.TestCase):
pass pass
@unittest.skip(reason="FastSpeech2Conformer has no input embeddings") @unittest.skip(reason="FastSpeech2Conformer has no input embeddings")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
@unittest.skip( @unittest.skip(
...@@ -766,7 +766,7 @@ class FastSpeech2ConformerWithHifiGanTest(ModelTesterMixin, unittest.TestCase): ...@@ -766,7 +766,7 @@ class FastSpeech2ConformerWithHifiGanTest(ModelTesterMixin, unittest.TestCase):
pass pass
@unittest.skip(reason="FastSpeech2Conformer has no input embeddings") @unittest.skip(reason="FastSpeech2Conformer has no input embeddings")
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
pass pass
@unittest.skip( @unittest.skip(
......
...@@ -180,7 +180,7 @@ class FlavaImageModelTest(ModelTesterMixin, unittest.TestCase): ...@@ -180,7 +180,7 @@ class FlavaImageModelTest(ModelTesterMixin, unittest.TestCase):
# FLAVA does not use inputs_embeds # FLAVA does not use inputs_embeds
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:
...@@ -619,7 +619,7 @@ class FlavaMultimodalModelTest(ModelTesterMixin, unittest.TestCase): ...@@ -619,7 +619,7 @@ class FlavaMultimodalModelTest(ModelTesterMixin, unittest.TestCase):
expected_arg_names = ["hidden_states"] expected_arg_names = ["hidden_states"]
self.assertListEqual(arg_names[:1], expected_arg_names) self.assertListEqual(arg_names[:1], expected_arg_names)
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
# No embedding in multimodal model # No embedding in multimodal model
pass pass
...@@ -742,7 +742,7 @@ class FlavaImageCodebookTest(ModelTesterMixin, unittest.TestCase): ...@@ -742,7 +742,7 @@ class FlavaImageCodebookTest(ModelTesterMixin, unittest.TestCase):
def test_attention_outputs(self): def test_attention_outputs(self):
pass pass
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
# No embedding in multimodal model # No embedding in multimodal model
pass pass
...@@ -944,7 +944,7 @@ class FlavaModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): ...@@ -944,7 +944,7 @@ class FlavaModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
pass pass
# FlavaModel does not have input/output embeddings # FlavaModel 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 FLAVA # override as the `logit_scale` parameter initilization is different for FLAVA
......
...@@ -288,7 +288,7 @@ class FocalNetModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase ...@@ -288,7 +288,7 @@ class FocalNetModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase
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[:-1]: for model_class in self.all_model_classes[:-1]:
......
...@@ -193,8 +193,8 @@ class FSMTModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin ...@@ -193,8 +193,8 @@ class FSMTModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin
def test_config(self): def test_config(self):
self.config_tester.run_common_tests() self.config_tester.run_common_tests()
# XXX: override test_model_common_attributes / different Embedding type # XXX: override test_model_get_set_embeddings / different Embedding type
def test_model_common_attributes(self): def test_model_get_set_embeddings(self):
config, inputs_dict = self.model_tester.prepare_config_and_inputs() config, inputs_dict = self.model_tester.prepare_config_and_inputs()
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