mirror of
https://github.com/qdrant/fastembed.git
synced 2026-10-03 03:17:48 -05:00
Fix mypy errors
This commit is contained in:
@@ -184,7 +184,10 @@ class OnnxMultimodalModel(OnnxModel[T]):
|
||||
if isinstance(processed[0], list):
|
||||
encoded, attention_mask, metadata = self._process_nested_patches(processed)
|
||||
else:
|
||||
encoded, attention_mask, metadata = self._process_flat_images(processed, len(images))
|
||||
encoded, attention_mask, metadata = self._process_flat_images(
|
||||
processed, # type: ignore[arg-type]
|
||||
len(images),
|
||||
)
|
||||
|
||||
onnx_input = {"pixel_values": encoded, "attention_mask": attention_mask}
|
||||
onnx_input = self._preprocess_onnx_image_input(onnx_input, **kwargs)
|
||||
@@ -192,7 +195,7 @@ class OnnxMultimodalModel(OnnxModel[T]):
|
||||
|
||||
return OnnxOutputContext(
|
||||
model_output=model_output[0],
|
||||
attention_mask=attention_mask,
|
||||
attention_mask=attention_mask, # type: ignore[arg-type]
|
||||
metadata=metadata,
|
||||
)
|
||||
|
||||
@@ -231,7 +234,7 @@ class OnnxMultimodalModel(OnnxModel[T]):
|
||||
attention_mask[i, j] = 1
|
||||
|
||||
metadata = {"patch_counts": patch_counts}
|
||||
return encoded, attention_mask, metadata
|
||||
return encoded, attention_mask, metadata # type: ignore[return-value]
|
||||
|
||||
def _process_flat_images(
|
||||
self, processed: list[NumpyArray], num_images: int
|
||||
@@ -269,7 +272,7 @@ class OnnxMultimodalModel(OnnxModel[T]):
|
||||
attention_mask = np.ones((num_images, 1), dtype=np.int64)
|
||||
metadata = {"patch_counts": [1] * num_images}
|
||||
|
||||
return encoded, attention_mask, metadata
|
||||
return encoded, attention_mask, metadata # type: ignore[return-value]
|
||||
|
||||
def _needs_patch_dimension(self) -> bool:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user