feat: Added judgment logic to support training with plain text data.

#42
Files changed (1) hide show
  1. modeling_minicpmv.py +2 -0
modeling_minicpmv.py CHANGED
@@ -77,6 +77,8 @@ class MiniCPMV(MiniCPMVPreTrainedModel):
77
  all_pixel_values = []
78
  img_cnt = []
79
  for pixel_values in pixel_values_list:
 
 
80
  img_cnt.append(len(pixel_values))
81
  all_pixel_values.extend([i.flatten(end_dim=1).permute(1, 0) for i in pixel_values])
82
 
 
77
  all_pixel_values = []
78
  img_cnt = []
79
  for pixel_values in pixel_values_list:
80
+ if len(pixel_values) == 0:
81
+ continue
82
  img_cnt.append(len(pixel_values))
83
  all_pixel_values.extend([i.flatten(end_dim=1).permute(1, 0) for i in pixel_values])
84