[VLM] Update compatibility with transformers 4.49

This commit is contained in:
Cyrus Leung
2025-02-05 19:09:45 -08:00
committed by GitHub
parent bf3b79efb8
commit 75404d041b
9 changed files with 48 additions and 57 deletions
+9
View File
@@ -342,6 +342,15 @@ class MiniCPMVProcessingInfo(BaseProcessingInfo):
**kwargs: object,
):
hf_processor = self.ctx.get_hf_processor()
# NumPy arrays are considered as Iterable but not Sequence in
# https://github.com/huggingface/transformers/blob/main/src/transformers/image_transforms.py#L428
image_processor = hf_processor.image_processor # type: ignore
for attr in ("mean", "std"):
val = getattr(image_processor, attr)
if isinstance(val, np.ndarray):
setattr(image_processor, attr, val.tolist())
return hf_processor
def get_image_processor(self):