Skip to content

Commit c761205

Browse files
committed
Fix PerceptionLM image preprocessing for non-tiled image input.
1 parent 27997ee commit c761205

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/transformers/models/perception_lm/image_processing_perception_lm_fast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ def _preprocess(
310310
)
311311
processed_images_grouped[shape] = stacked_images
312312
processed_images = reorder_images(processed_images_grouped, grouped_images_index)
313-
313+
processed_images = [p[None] if p.ndim == 3 else p for p in processed_images] # add tiles dimension if needed
314314
processed_images = torch.stack(processed_images, dim=0) if return_tensors else processed_images
315315
return BatchFeature(data={"pixel_values": processed_images}, tensor_type=return_tensors)
316316

0 commit comments

Comments
 (0)