Avoid using uncessary get_values(MODEL_MAPPING) (#29362)
* more fixes * more fixes --------- Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
@@ -20,7 +20,6 @@ from datasets import load_dataset
|
||||
from packaging import version
|
||||
|
||||
from transformers import ViltConfig, is_torch_available, is_vision_available
|
||||
from transformers.models.auto import get_values
|
||||
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
|
||||
from transformers.utils import cached_property
|
||||
|
||||
@@ -33,7 +32,6 @@ if is_torch_available():
|
||||
import torch
|
||||
|
||||
from transformers import (
|
||||
MODEL_MAPPING,
|
||||
ViltForImageAndTextRetrieval,
|
||||
ViltForImagesAndTextClassification,
|
||||
ViltForMaskedLM,
|
||||
@@ -41,6 +39,7 @@ if is_torch_available():
|
||||
ViltForTokenClassification,
|
||||
ViltModel,
|
||||
)
|
||||
from transformers.models.auto.modeling_auto import MODEL_MAPPING_NAMES
|
||||
from transformers.models.vilt.modeling_vilt import VILT_PRETRAINED_MODEL_ARCHIVE_LIST
|
||||
|
||||
if is_vision_available():
|
||||
@@ -284,7 +283,7 @@ class ViltModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
|
||||
config.modality_type_vocab_size = 3
|
||||
|
||||
# ViltForImageAndTextRetrieval doesn't support training for now
|
||||
if model_class in [*get_values(MODEL_MAPPING), ViltForImageAndTextRetrieval]:
|
||||
if model_class.__name__ in [*MODEL_MAPPING_NAMES.values(), "ViltForImageAndTextRetrieval"]:
|
||||
continue
|
||||
|
||||
model = model_class(config)
|
||||
@@ -307,7 +306,7 @@ class ViltModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
|
||||
|
||||
# ViltForImageAndTextRetrieval doesn't support training for now
|
||||
if (
|
||||
model_class in [*get_values(MODEL_MAPPING), ViltForImageAndTextRetrieval]
|
||||
model_class.__name__ in [*MODEL_MAPPING_NAMES.values(), "ViltForImageAndTextRetrieval"]
|
||||
or not model_class.supports_gradient_checkpointing
|
||||
):
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user