Skip to content

Commit 0bc05f5

Browse files
committed
fix: Fixed return_tensors input for img_processor
Signed-off-by: Brandon Groth <brandon.m.groth@gmail.com>
1 parent f4da06e commit 0bc05f5

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

tests/models/conftest.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,11 +1225,9 @@ def process_img(
12251225
Returns:
12261226
torch.FloatTensor: Processed image
12271227
"""
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)
1228+
img_processor = AutoImageProcessor.from_pretrained(pretrained_model, use_fast=True)
1229+
batch_dict = img_processor(images=input_img, return_tensors="pt")
1230+
return batch_dict["pixel_values"]
12331231

12341232

12351233
@pytest.fixture(scope="function")

0 commit comments

Comments
 (0)