HwwwH commited on
Commit
c22a36a
1 Parent(s): 0f19d4b

fix bug image_processing

Browse files
Files changed (1) hide show
  1. image_processing_minicpmv.py +3 -0
image_processing_minicpmv.py CHANGED
@@ -52,6 +52,7 @@ class MiniCPMVBatchFeature(BatchFeature):
52
  if not is_tensor(value):
53
  tensor = as_tensor(value)
54
  return tensor
 
55
  except: # noqa E722
56
  if key == "overflowing_values":
57
  raise ValueError("Unable to create tensor returning overflowing values of different lengths. ")
@@ -71,6 +72,8 @@ class MiniCPMVBatchFeature(BatchFeature):
71
 
72
  def cast_tensor(v):
73
  # check if v is a floating point
 
 
74
  if torch.is_floating_point(v):
75
  # cast and send to device
76
  return v.to(*args, **kwargs)
 
52
  if not is_tensor(value):
53
  tensor = as_tensor(value)
54
  return tensor
55
+ return value
56
  except: # noqa E722
57
  if key == "overflowing_values":
58
  raise ValueError("Unable to create tensor returning overflowing values of different lengths. ")
 
72
 
73
  def cast_tensor(v):
74
  # check if v is a floating point
75
+ if v is None:
76
+ return None
77
  if torch.is_floating_point(v):
78
  # cast and send to device
79
  return v.to(*args, **kwargs)