diff --git a/pyproject.toml b/pyproject.toml index 1be08ac..46da2e0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "mistral_common" -version = "1.4.3" +version = "1.4.4" description = "" authors = ["bam4d "] readme = "README.md" diff --git a/src/mistral_common/__init__.py b/src/mistral_common/__init__.py index aa56ed4..c0f285b 100644 --- a/src/mistral_common/__init__.py +++ b/src/mistral_common/__init__.py @@ -1 +1 @@ -__version__ = "1.4.3" +__version__ = "1.4.4" diff --git a/src/mistral_common/tokens/tokenizers/multimodal.py b/src/mistral_common/tokens/tokenizers/multimodal.py index 153aadd..0498213 100644 --- a/src/mistral_common/tokens/tokenizers/multimodal.py +++ b/src/mistral_common/tokens/tokenizers/multimodal.py @@ -1,4 +1,5 @@ import base64 +import logging from dataclasses import dataclass from io import BytesIO from typing import Tuple, Union @@ -14,6 +15,9 @@ SpecialImageIDs, ) +logger = logging.getLogger(__name__) + + _cv2_installed: bool try: import cv2 @@ -21,6 +25,14 @@ _cv2_installed = True except ImportError: _cv2_installed = False +except Exception as e: + # cv2 has lots of import problems: https://github.com/opencv/opencv-python/issues/884 + # for better UX, let's simply skip all errors that might arise from import for now + logger.warning( + f"Warning: Your installation of OpenCV appears to be broken: {e}." + "Please follow the instructions at https://github.com/opencv/opencv-python/issues/884 " + "to correct your environment. The import of cv2 has been skipped." + ) def is_cv2_installed() -> bool: