🔥Rework pipeline testing by removing PipelineTestCaseMeta 🚀 (#21516)
* Add PipelineTesterMixin * remove class PipelineTestCaseMeta * move validate_test_components * Add for ViT * Add to SPECIAL_MODULE_TO_TEST_MAP * style and quality * Add feature-extraction * update * raise instead of skip * add tiny_model_summary.json * more explicit * skip tasks not in mapping * add availability check * Add Copyright * A way to diable irrelevant tests * update with main * remove disable_irrelevant_tests * skip tests * better skip message * better skip message * Add all pipeline task tests * revert * Import PipelineTesterMixin * subclass test classes with PipelineTesterMixin * Add pipieline_model_mapping * Fix import after adding pipieline_model_mapping * Fix style and quality after adding pipieline_model_mapping * Fix one more import after adding pipieline_model_mapping * Fix style and quality after adding pipieline_model_mapping * Fix test issues * Fix import requirements * Fix mapping for MobileViTModelTest * Update * Better skip message * pipieline_model_mapping could not be None * Remove some PipelineTesterMixin * Fix typo * revert tests_fetcher.py * update * rename * revert * Remove PipelineTestCaseMeta from ZeroShotAudioClassificationPipelineTests * style and quality * test fetcher for all pipeline/model tests --------- Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
@@ -22,6 +22,7 @@ from transformers.testing_utils import require_torch, slow, torch_device
|
||||
|
||||
from ...test_configuration_common import ConfigTester
|
||||
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask
|
||||
from ...test_pipeline_mixin import PipelineTesterMixin
|
||||
|
||||
|
||||
if is_torch_available():
|
||||
@@ -360,7 +361,7 @@ class RoFormerModelTester:
|
||||
|
||||
|
||||
@require_torch
|
||||
class RoFormerModelTest(ModelTesterMixin, unittest.TestCase):
|
||||
class RoFormerModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
|
||||
all_model_classes = (
|
||||
(
|
||||
RoFormerModel,
|
||||
@@ -375,6 +376,19 @@ class RoFormerModelTest(ModelTesterMixin, unittest.TestCase):
|
||||
else ()
|
||||
)
|
||||
all_generative_model_classes = (RoFormerForCausalLM,) if is_torch_available() else ()
|
||||
pipeline_model_mapping = (
|
||||
{
|
||||
"feature-extraction": RoFormerModel,
|
||||
"fill-mask": RoFormerForMaskedLM,
|
||||
"question-answering": RoFormerForQuestionAnswering,
|
||||
"text-classification": RoFormerForSequenceClassification,
|
||||
"text-generation": RoFormerForCausalLM,
|
||||
"token-classification": RoFormerForTokenClassification,
|
||||
"zero-shot": RoFormerForSequenceClassification,
|
||||
}
|
||||
if is_torch_available()
|
||||
else {}
|
||||
)
|
||||
|
||||
def setUp(self):
|
||||
self.model_tester = RoFormerModelTester(self)
|
||||
|
||||
@@ -21,6 +21,7 @@ from transformers.testing_utils import require_tf, slow
|
||||
|
||||
from ...test_configuration_common import ConfigTester
|
||||
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
|
||||
from ...test_pipeline_mixin import PipelineTesterMixin
|
||||
|
||||
|
||||
if is_tf_available():
|
||||
@@ -239,7 +240,7 @@ class TFRoFormerModelTester:
|
||||
|
||||
|
||||
@require_tf
|
||||
class TFRoFormerModelTest(TFModelTesterMixin, unittest.TestCase):
|
||||
class TFRoFormerModelTest(TFModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
|
||||
all_model_classes = (
|
||||
(
|
||||
TFRoFormerModel,
|
||||
@@ -253,6 +254,19 @@ class TFRoFormerModelTest(TFModelTesterMixin, unittest.TestCase):
|
||||
if is_tf_available()
|
||||
else ()
|
||||
)
|
||||
pipeline_model_mapping = (
|
||||
{
|
||||
"feature-extraction": TFRoFormerModel,
|
||||
"fill-mask": TFRoFormerForMaskedLM,
|
||||
"question-answering": TFRoFormerForQuestionAnswering,
|
||||
"text-classification": TFRoFormerForSequenceClassification,
|
||||
"text-generation": TFRoFormerForCausalLM,
|
||||
"token-classification": TFRoFormerForTokenClassification,
|
||||
"zero-shot": TFRoFormerForSequenceClassification,
|
||||
}
|
||||
if is_tf_available()
|
||||
else {}
|
||||
)
|
||||
|
||||
test_head_masking = False
|
||||
test_onnx = False
|
||||
|
||||
Reference in New Issue
Block a user