Remove static pretrained maps from the library's internals (#29112)
* [test_all] Remove static pretrained maps from the library's internals * Deprecate archive maps instead of removing them * Revert init changes * [test_all] Deprecate instead of removing * [test_all] PVT v2 support * [test_all] Tests should all pass * [test_all] Style * Address review comments * Update src/transformers/models/deprecated/_archive_maps.py Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com> * Update src/transformers/models/deprecated/_archive_maps.py Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com> * [test_all] trigger tests * [test_all] LLAVA * [test_all] Bad rebase --------- Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
This commit is contained in:
@@ -49,7 +49,6 @@ if is_torch_available():
|
||||
from torch import nn
|
||||
|
||||
from transformers import Blip2ForConditionalGeneration, Blip2Model, Blip2VisionModel
|
||||
from transformers.models.blip_2.modeling_blip_2 import BLIP_2_PRETRAINED_MODEL_ARCHIVE_LIST
|
||||
|
||||
|
||||
if is_vision_available():
|
||||
@@ -217,9 +216,9 @@ class Blip2VisionModelTest(ModelTesterMixin, unittest.TestCase):
|
||||
|
||||
@slow
|
||||
def test_model_from_pretrained(self):
|
||||
for model_name in BLIP_2_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
|
||||
model = Blip2VisionModel.from_pretrained(model_name)
|
||||
self.assertIsNotNone(model)
|
||||
model_name = "Salesforce/blip2-opt-2.7b"
|
||||
model = Blip2VisionModel.from_pretrained(model_name)
|
||||
self.assertIsNotNone(model)
|
||||
|
||||
|
||||
class Blip2QFormerModelTester:
|
||||
@@ -504,9 +503,9 @@ class Blip2ForConditionalGenerationDecoderOnlyTest(ModelTesterMixin, GenerationT
|
||||
|
||||
@slow
|
||||
def test_model_from_pretrained(self):
|
||||
for model_name in BLIP_2_PRETRAINED_MODEL_ARCHIVE_LIST:
|
||||
model = Blip2ForConditionalGeneration.from_pretrained(model_name)
|
||||
self.assertIsNotNone(model)
|
||||
model_name = "Salesforce/blip2-opt-2.7b"
|
||||
model = Blip2ForConditionalGeneration.from_pretrained(model_name)
|
||||
self.assertIsNotNone(model)
|
||||
|
||||
|
||||
# this class is based on `T5ModelTester` found in tests/models/t5/test_modeling_t5.py
|
||||
@@ -766,9 +765,9 @@ class Blip2ModelTest(ModelTesterMixin, PipelineTesterMixin, GenerationTesterMixi
|
||||
|
||||
@slow
|
||||
def test_model_from_pretrained(self):
|
||||
for model_name in BLIP_2_PRETRAINED_MODEL_ARCHIVE_LIST:
|
||||
model = Blip2ForConditionalGeneration.from_pretrained(model_name)
|
||||
self.assertIsNotNone(model)
|
||||
model_name = "Salesforce/blip2-opt-2.7b"
|
||||
model = Blip2ForConditionalGeneration.from_pretrained(model_name)
|
||||
self.assertIsNotNone(model)
|
||||
|
||||
def test_get_text_features(self):
|
||||
config, _ = self.model_tester.prepare_config_and_inputs_for_common()
|
||||
|
||||
Reference in New Issue
Block a user