Update tiny model information and pipeline tests (#26285)

* Update tiny model summary file

* add to pipeline tests

* revert

* fix import

* fix import

* fix

* fix

* update

* update

* update

* fix

* remove BarkModelTest

* fix

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
Yih-Dar
2023-09-25 18:08:12 +02:00
committed by GitHub
parent 546e7679e7
commit d9e4bc2895
9 changed files with 174 additions and 30 deletions

View File

@@ -493,13 +493,6 @@ class BarkModelTester:
self.is_training = is_training
def prepare_config_and_inputs(self):
# TODO: @Yoach: Preapre `inputs_dict`
inputs_dict = {}
config = self.get_config()
return config, inputs_dict
def get_config(self):
return BarkConfig.from_sub_model_configs(
self.semantic_model_tester.get_config(),
@@ -522,22 +515,6 @@ class BarkModelTester:
return config
def prepare_config_and_inputs_for_common(self):
# TODO: @Yoach
pass
# return config, inputs_dict
# Need this class in oder to create tiny model for `bark`
# TODO (@Yoach) Implement actual test methods
@unittest.skip("So far all tests will fail.")
class BarkModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase):
all_model_classes = (BarkModel,) if is_torch_available() else ()
def setUp(self):
self.model_tester = BarkModelTester(self)
self.config_tester = ConfigTester(self, config_class=BarkConfig, n_embd=37)
@require_torch
class BarkSemanticModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase):

View File

@@ -666,7 +666,11 @@ class Blip2ModelTester:
class Blip2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (Blip2ForConditionalGeneration, Blip2Model) if is_torch_available() else ()
pipeline_model_mapping = (
{"feature-extraction": Blip2Model, "image-to-text": Blip2ForConditionalGeneration}
{
"feature-extraction": Blip2Model,
"image-to-text": Blip2ForConditionalGeneration,
"visual-question-answering": Blip2ForConditionalGeneration,
}
if is_torch_available()
else {}
)

View File

@@ -22,6 +22,7 @@ from transformers.utils import is_torch_available
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin
if is_torch_available():
@@ -272,7 +273,7 @@ class BrosModelTester:
@require_torch
class BrosModelTest(ModelTesterMixin, unittest.TestCase):
class BrosModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
test_pruning = False
test_torchscript = False
test_mismatched_shapes = False
@@ -288,6 +289,18 @@ class BrosModelTest(ModelTesterMixin, unittest.TestCase):
else ()
)
all_generative_model_classes = () if is_torch_available() else ()
pipeline_model_mapping = (
{"feature-extraction": BrosModel, "token-classification": BrosForTokenClassification}
if is_torch_available()
else {}
)
# BROS requires `bbox` in the inputs which doesn't fit into the above 2 pipelines' input formats.
# see https://github.com/huggingface/transformers/pull/26294
def is_pipeline_test_to_skip(
self, pipeline_test_casse_name, config_class, model_architecture, tokenizer_name, processor_name
):
return True
def setUp(self):
self.model_tester = BrosModelTester(self)

View File

@@ -260,7 +260,7 @@ class IdeficsModelTester:
@require_torch
class IdeficsModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (IdeficsModel, IdeficsForVisionText2Text) if is_torch_available() else ()
pipeline_model_mapping = {}
pipeline_model_mapping = {"feature-extraction": IdeficsModel} if is_torch_available() else {}
test_pruning = False
test_headmasking = False
test_torchscript = False

View File

@@ -37,6 +37,7 @@ from transformers.utils import is_essentia_available, is_librosa_available, is_s
from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin
if is_torch_available():
@@ -509,9 +510,12 @@ class Pop2PianoModelTester:
@require_torch
class Pop2PianoModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase):
class Pop2PianoModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (Pop2PianoForConditionalGeneration,) if is_torch_available() else ()
all_generative_model_classes = ()
pipeline_model_mapping = (
{"automatic-speech-recognition": Pop2PianoForConditionalGeneration} if is_torch_available() else {}
)
all_parallelizable_model_classes = ()
fx_compatible = False
test_pruning = False

View File

@@ -156,7 +156,9 @@ class VitsModelTester:
@require_torch
class VitsModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (VitsModel,) if is_torch_available() else ()
pipeline_model_mapping = {"text-to-audio": VitsModel} if is_torch_available() else {}
pipeline_model_mapping = (
{"feature-extraction": VitsModel, "text-to-audio": VitsModel} if is_torch_available() else {}
)
is_encoder_decoder = False
test_pruning = False
test_headmasking = False