Make the cv2 dependency optional (#27780)

Signed-off-by: Jacob <cmpute@qq.com>
This commit is contained in:
Jacob Zhong
2025-11-06 05:08:55 +00:00
committed by GitHub
parent 80679f108f
commit d72299d47b
+2 -1
View File
@@ -30,7 +30,6 @@ from io import BytesIO
from tempfile import NamedTemporaryFile from tempfile import NamedTemporaryFile
from typing import Any, cast from typing import Any, cast
import cv2
import numpy as np import numpy as np
from PIL import Image from PIL import Image
from transformers import PreTrainedTokenizerBase from transformers import PreTrainedTokenizerBase
@@ -850,6 +849,8 @@ class RandomMultiModalDataset(RandomDataset):
Creates a video with random pixel values, encodes it to MP4 format, Creates a video with random pixel values, encodes it to MP4 format,
and returns the content as bytes. and returns the content as bytes.
""" """
import cv2
random_pixels = self._rng.integers( random_pixels = self._rng.integers(
0, 0,
256, 256,