We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f4da06e commit 0bc05f5Copy full SHA for 0bc05f5
1 file changed
tests/models/conftest.py
@@ -1225,11 +1225,9 @@ def process_img(
1225
Returns:
1226
torch.FloatTensor: Processed image
1227
"""
1228
- img_processor = AutoImageProcessor.from_pretrained(pretrained_model)
1229
- batch_dict = img_processor(images=input_img, return_tensor="pt")
1230
- # Data is {pixel_values: numpy_array[0]=data} w/ tensor.shape [C,W,H]
1231
- # Needs to be [1,C,W,H] -> unsqueeze(0)
1232
- return torch.from_numpy(batch_dict["pixel_values"][0]).unsqueeze(0)
+ img_processor = AutoImageProcessor.from_pretrained(pretrained_model, use_fast=True)
+ batch_dict = img_processor(images=input_img, return_tensors="pt")
+ return batch_dict["pixel_values"]
1233
1234
1235
@pytest.fixture(scope="function")
0 commit comments