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_torch_available():
|
||||
|
||||
|
||||
if is_vision_available():
|
||||
from transformers import VideoMAEFeatureExtractor
|
||||
from transformers import VideoMAEImageProcessor
|
||||
|
||||
|
||||
class VideoMAEModelTester:
|
||||
@@ -359,10 +359,10 @@ def prepare_video():
|
||||
@require_vision
|
||||
class VideoMAEModelIntegrationTest(unittest.TestCase):
|
||||
@cached_property
|
||||
def default_feature_extractor(self):
|
||||
def default_image_processor(self):
|
||||
# logits were tested with a different mean and std, so we use the same here
|
||||
return (
|
||||
VideoMAEFeatureExtractor(image_mean=[0.5, 0.5, 0.5], image_std=[0.5, 0.5, 0.5])
|
||||
VideoMAEImageProcessor(image_mean=[0.5, 0.5, 0.5], image_std=[0.5, 0.5, 0.5])
|
||||
if is_vision_available()
|
||||
else None
|
||||
)
|
||||
@@ -373,9 +373,9 @@ class VideoMAEModelIntegrationTest(unittest.TestCase):
|
||||
torch_device
|
||||
)
|
||||
|
||||
feature_extractor = self.default_feature_extractor
|
||||
image_processor = self.default_image_processor
|
||||
video = prepare_video()
|
||||
inputs = feature_extractor(video, return_tensors="pt").to(torch_device)
|
||||
inputs = image_processor(video, return_tensors="pt").to(torch_device)
|
||||
|
||||
# forward pass
|
||||
with torch.no_grad():
|
||||
@@ -393,9 +393,9 @@ class VideoMAEModelIntegrationTest(unittest.TestCase):
|
||||
def test_inference_for_pretraining(self):
|
||||
model = VideoMAEForPreTraining.from_pretrained("MCG-NJU/videomae-base-short").to(torch_device)
|
||||
|
||||
feature_extractor = self.default_feature_extractor
|
||||
image_processor = self.default_image_processor
|
||||
video = prepare_video()
|
||||
inputs = feature_extractor(video, return_tensors="pt").to(torch_device)
|
||||
inputs = image_processor(video, return_tensors="pt").to(torch_device)
|
||||
|
||||
# add boolean mask, indicating which patches to mask
|
||||
local_path = hf_hub_download(repo_id="hf-internal-testing/bool-masked-pos", filename="bool_masked_pos.pt")
|
||||
|
||||
Reference in New Issue
Block a user