From d72299d47ba64e38f6876f3d5fc69ea70d13d718 Mon Sep 17 00:00:00 2001 From: Jacob Zhong Date: Thu, 6 Nov 2025 13:08:55 +0800 Subject: [PATCH] Make the cv2 dependency optional (#27780) Signed-off-by: Jacob --- vllm/benchmarks/datasets.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vllm/benchmarks/datasets.py b/vllm/benchmarks/datasets.py index b1aa8530eb02..1704130d9131 100644 --- a/vllm/benchmarks/datasets.py +++ b/vllm/benchmarks/datasets.py @@ -30,7 +30,6 @@ from io import BytesIO from tempfile import NamedTemporaryFile from typing import Any, cast -import cv2 import numpy as np from PIL import Image from transformers import PreTrainedTokenizerBase @@ -850,6 +849,8 @@ class RandomMultiModalDataset(RandomDataset): Creates a video with random pixel values, encodes it to MP4 format, and returns the content as bytes. """ + import cv2 + random_pixels = self._rng.integers( 0, 256,