andrewqian123 commited on
Commit
0137385
1 Parent(s): 61657ef

Update image_processing_minicpmv.py

Browse files
Files changed (1) hide show
  1. image_processing_minicpmv.py +7 -1
image_processing_minicpmv.py CHANGED
@@ -358,7 +358,13 @@ class MiniCPMVImageProcessor(BaseImageProcessor):
358
  patches = patches.permute(0, 1, 3, 2).reshape(image.size(0), patch_size, -1)
359
  return patches.numpy()
360
 
361
- def preprocess(
 
 
 
 
 
 
362
  self,
363
  images: ImageInput,
364
  do_pad: Optional[bool] = True, # TODO: add pad for MiniCPM-Llama3-V-2_5
 
358
  patches = patches.permute(0, 1, 3, 2).reshape(image.size(0), patch_size, -1)
359
  return patches.numpy()
360
 
361
+ def preprocess(self, images, do_pad, return_tensors):
362
+ batch = []
363
+ for image in images:
364
+ result = preprocess2(images, do_pad, return_tensors)
365
+ batch.append(result)
366
+ return batch
367
+ def preprocess2(
368
  self,
369
  images: ImageInput,
370
  do_pad: Optional[bool] = True, # TODO: add pad for MiniCPM-Llama3-V-2_5