Update old existing feature extractor references (#24552)
* Update old existing feature extractor references * Typo * Apply suggestions from code review * Apply suggestions from code review * Apply suggestions from code review * Address comments from review - update 'feature extractor' Co-authored by: Yih-Dar <2521628+ydshieh@users.noreply.github.com>
This commit is contained in:
@@ -46,7 +46,7 @@ if is_tf_available():
|
||||
if is_vision_available():
|
||||
from PIL import Image
|
||||
|
||||
from transformers import ViTFeatureExtractor
|
||||
from transformers import ViTImageProcessor
|
||||
|
||||
|
||||
class TFViTMAEModelTester:
|
||||
@@ -424,8 +424,8 @@ def prepare_img():
|
||||
@require_vision
|
||||
class TFViTMAEModelIntegrationTest(unittest.TestCase):
|
||||
@cached_property
|
||||
def default_feature_extractor(self):
|
||||
return ViTFeatureExtractor.from_pretrained("facebook/vit-mae-base") if is_vision_available() else None
|
||||
def default_image_processor(self):
|
||||
return ViTImageProcessor.from_pretrained("facebook/vit-mae-base") if is_vision_available() else None
|
||||
|
||||
@slow
|
||||
def test_inference_for_pretraining(self):
|
||||
@@ -434,9 +434,9 @@ class TFViTMAEModelIntegrationTest(unittest.TestCase):
|
||||
|
||||
model = TFViTMAEForPreTraining.from_pretrained("facebook/vit-mae-base")
|
||||
|
||||
feature_extractor = self.default_feature_extractor
|
||||
image_processor = self.default_image_processor
|
||||
image = prepare_img()
|
||||
inputs = feature_extractor(images=image, return_tensors="tf")
|
||||
inputs = image_processor(images=image, return_tensors="tf")
|
||||
|
||||
# prepare a noise vector that will be also used for testing the TF model
|
||||
# (this way we can ensure that the PT and TF models operate on the same inputs)
|
||||
|
||||
@@ -42,7 +42,7 @@ if is_torch_available():
|
||||
if is_vision_available():
|
||||
from PIL import Image
|
||||
|
||||
from transformers import ViTFeatureExtractor
|
||||
from transformers import ViTImageProcessor
|
||||
|
||||
|
||||
class ViTMAEModelTester:
|
||||
@@ -296,8 +296,8 @@ def prepare_img():
|
||||
@require_vision
|
||||
class ViTMAEModelIntegrationTest(unittest.TestCase):
|
||||
@cached_property
|
||||
def default_feature_extractor(self):
|
||||
return ViTFeatureExtractor.from_pretrained("facebook/vit-mae-base") if is_vision_available() else None
|
||||
def default_image_processor(self):
|
||||
return ViTImageProcessor.from_pretrained("facebook/vit-mae-base") if is_vision_available() else None
|
||||
|
||||
@slow
|
||||
def test_inference_for_pretraining(self):
|
||||
@@ -306,9 +306,9 @@ class ViTMAEModelIntegrationTest(unittest.TestCase):
|
||||
|
||||
model = ViTMAEForPreTraining.from_pretrained("facebook/vit-mae-base").to(torch_device)
|
||||
|
||||
feature_extractor = self.default_feature_extractor
|
||||
image_processor = self.default_image_processor
|
||||
image = prepare_img()
|
||||
inputs = feature_extractor(images=image, return_tensors="pt").to(torch_device)
|
||||
inputs = image_processor(images=image, return_tensors="pt").to(torch_device)
|
||||
|
||||
# prepare a noise vector that will be also used for testing the TF model
|
||||
# (this way we can ensure that the PT and TF models operate on the same inputs)
|
||||
|
||||
Reference in New Issue
Block a user