finalf0 HwwwH commited on
Commit
d1c49e2
1 Parent(s): 6a01741

Fix batch inference when image is None (#6)

Browse files

- Fix bug of batch inference when image is None (4c99f84f0a198cd43f7e91ccae33fe41db1fd7ff)
- ban image for batch inference (6da897213f95c636d233c227c1a95638653bb039)
- fix bug (24c4eaab3fcbd66c8db859c3fd86e8ca03418bfc)


Co-authored-by: Zhihui He <[email protected]>

Files changed (1) hide show
  1. modeling_minicpmv.py +4 -2
modeling_minicpmv.py CHANGED
@@ -292,8 +292,10 @@ class MiniCPMV(MiniCPMVPreTrainedModel):
292
 
293
  if batched is False:
294
  images_list, msgs_list = [images_list], [msgs_list]
295
- if images_list is not None:
296
- assert len(images_list) == len(msgs_list), "The batch dim of images_list and msgs_list should be the same."
 
 
297
 
298
  if processor is None:
299
  if self.processor is None:
 
292
 
293
  if batched is False:
294
  images_list, msgs_list = [images_list], [msgs_list]
295
+ else:
296
+ assert images_list is None, "Please integrate image to msgs when using batch inference."
297
+ images_list = [None] * len(msgs_list)
298
+ assert len(images_list) == len(msgs_list), "The batch dim of images_list and msgs_list should be the same."
299
 
300
  if processor is None:
301
  if self.processor is None: