Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickvonplaten committed Sep 28, 2024
1 parent ce9ce79 commit 6a3b162
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/mistral_common/tokens/tokenizers/multimodal.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import base64
import logging
from dataclasses import dataclass
from io import BytesIO
from typing import Tuple, Union
Expand All @@ -14,13 +15,24 @@
SpecialImageIDs,
)

logger = logging.getLogger(__name__)


_cv2_installed: bool
try:
import cv2

_cv2_installed = True
except ImportError:
_cv2_installed = False
except Exception:
# cv2 has lots of import problems: https://github.com/opencv/opencv-python/issues/884
# for better UX, let's simple skip import errors for now
logger.warn(
"You seem to have a broken installation of opencv. "
"Please follow : https://github.com/opencv/opencv-python/issues/884 to correct your environment."
" Skipped cv2 import."
)


def is_cv2_installed() -> bool:
Expand Down

0 comments on commit 6a3b162

Please sign in to comment.