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:
@@ -39,7 +39,7 @@ if is_torch_available():
|
||||
if is_vision_available():
|
||||
from PIL import Image
|
||||
|
||||
from transformers import AutoFeatureExtractor
|
||||
from transformers import AutoImageProcessor
|
||||
|
||||
|
||||
class SwinModelTester:
|
||||
@@ -482,9 +482,9 @@ class SwinModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
|
||||
@require_torch
|
||||
class SwinModelIntegrationTest(unittest.TestCase):
|
||||
@cached_property
|
||||
def default_feature_extractor(self):
|
||||
def default_image_processor(self):
|
||||
return (
|
||||
AutoFeatureExtractor.from_pretrained("microsoft/swin-tiny-patch4-window7-224")
|
||||
AutoImageProcessor.from_pretrained("microsoft/swin-tiny-patch4-window7-224")
|
||||
if is_vision_available()
|
||||
else None
|
||||
)
|
||||
@@ -492,10 +492,10 @@ class SwinModelIntegrationTest(unittest.TestCase):
|
||||
@slow
|
||||
def test_inference_image_classification_head(self):
|
||||
model = SwinForImageClassification.from_pretrained("microsoft/swin-tiny-patch4-window7-224").to(torch_device)
|
||||
feature_extractor = self.default_feature_extractor
|
||||
image_processor = self.default_image_processor
|
||||
|
||||
image = Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png")
|
||||
inputs = feature_extractor(images=image, return_tensors="pt").to(torch_device)
|
||||
inputs = image_processor(images=image, return_tensors="pt").to(torch_device)
|
||||
|
||||
# forward pass
|
||||
with torch.no_grad():
|
||||
|
||||
@@ -45,7 +45,7 @@ if is_tf_available():
|
||||
if is_vision_available():
|
||||
from PIL import Image
|
||||
|
||||
from transformers import AutoFeatureExtractor
|
||||
from transformers import AutoImageProcessor
|
||||
|
||||
|
||||
class TFSwinModelTester:
|
||||
@@ -382,9 +382,9 @@ class TFSwinModelTest(TFModelTesterMixin, PipelineTesterMixin, unittest.TestCase
|
||||
@require_tf
|
||||
class TFSwinModelIntegrationTest(unittest.TestCase):
|
||||
@cached_property
|
||||
def default_feature_extractor(self):
|
||||
def default_image_processor(self):
|
||||
return (
|
||||
AutoFeatureExtractor.from_pretrained("microsoft/swin-tiny-patch4-window7-224")
|
||||
AutoImageProcessor.from_pretrained("microsoft/swin-tiny-patch4-window7-224")
|
||||
if is_vision_available()
|
||||
else None
|
||||
)
|
||||
@@ -392,10 +392,10 @@ class TFSwinModelIntegrationTest(unittest.TestCase):
|
||||
@slow
|
||||
def test_inference_image_classification_head(self):
|
||||
model = TFSwinForImageClassification.from_pretrained("microsoft/swin-tiny-patch4-window7-224")
|
||||
feature_extractor = self.default_feature_extractor
|
||||
image_processor = self.default_image_processor
|
||||
|
||||
image = Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png")
|
||||
inputs = feature_extractor(images=image, return_tensors="tf")
|
||||
inputs = image_processor(images=image, return_tensors="tf")
|
||||
|
||||
# forward pass
|
||||
outputs = model(inputs)
|
||||
|
||||
Reference in New Issue
Block a user