hmellor HF Staff commited on
Commit
960dcdf
·
verified ·
1 Parent(s): fd7f352

Make model compatible with Transformers v5

Browse files

https://github.com/huggingface/transformers/pull/42750 changed the spec of `convert_tensors` so this PR updates your custom code.

Please make the same change to any other models you have which may do this.

Files changed (1) hide show
  1. image_processing_minicpmv.py +5 -5
image_processing_minicpmv.py CHANGED
@@ -37,11 +37,11 @@ class MiniCPMVBatchFeature(BatchFeature):
37
  r"""
38
  Extend from BatchFeature for supporting various image size
39
  """
40
- def __init__(self, data: Optional[Dict[str, Any]] = None, tensor_type: Union[None, str, TensorType] = None):
41
- super().__init__(data)
42
- self.convert_to_tensors(tensor_type=tensor_type)
43
-
44
- def convert_to_tensors(self, tensor_type: Optional[Union[str, TensorType]] = None):
45
  if tensor_type is None:
46
  return self
47
 
 
37
  r"""
38
  Extend from BatchFeature for supporting various image size
39
  """
40
+ def convert_to_tensors(
41
+ self,
42
+ tensor_type: Optional[Union[str, TensorType]] = None,
43
+ skip_tensor_conversion: Union[list[str], set[str], None] = None,
44
+ ):
45
  if tensor_type is None:
46
  return self
47