Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
efdef57b
Unverified
Commit
efdef57b
authored
Oct 15, 2025
by
Angela Yi
Committed by
GitHub
Oct 15, 2025
Browse files
[bugfix] Lazy import cv2 (#26869)
Signed-off-by:
angelayi
<
yiangela7@gmail.com
>
parent
b8a45721
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
vllm/assets/video.py
vllm/assets/video.py
+4
-1
No files found.
vllm/assets/video.py
View file @
efdef57b
...
@@ -5,7 +5,6 @@ from dataclasses import dataclass
...
@@ -5,7 +5,6 @@ from dataclasses import dataclass
from
functools
import
lru_cache
from
functools
import
lru_cache
from
typing
import
Any
,
ClassVar
,
Literal
from
typing
import
Any
,
ClassVar
,
Literal
import
cv2
import
numpy
as
np
import
numpy
as
np
import
numpy.typing
as
npt
import
numpy.typing
as
npt
from
huggingface_hub
import
hf_hub_download
from
huggingface_hub
import
hf_hub_download
...
@@ -43,6 +42,8 @@ def download_video_asset(filename: str) -> str:
...
@@ -43,6 +42,8 @@ def download_video_asset(filename: str) -> str:
def
video_to_ndarrays
(
path
:
str
,
num_frames
:
int
=
-
1
)
->
npt
.
NDArray
:
def
video_to_ndarrays
(
path
:
str
,
num_frames
:
int
=
-
1
)
->
npt
.
NDArray
:
import
cv2
cap
=
cv2
.
VideoCapture
(
path
)
cap
=
cv2
.
VideoCapture
(
path
)
if
not
cap
.
isOpened
():
if
not
cap
.
isOpened
():
raise
ValueError
(
f
"Could not open video file
{
path
}
"
)
raise
ValueError
(
f
"Could not open video file
{
path
}
"
)
...
@@ -78,6 +79,8 @@ def video_to_pil_images_list(path: str, num_frames: int = -1) -> list[Image.Imag
...
@@ -78,6 +79,8 @@ def video_to_pil_images_list(path: str, num_frames: int = -1) -> list[Image.Imag
def
video_get_metadata
(
path
:
str
,
num_frames
:
int
=
-
1
)
->
dict
[
str
,
Any
]:
def
video_get_metadata
(
path
:
str
,
num_frames
:
int
=
-
1
)
->
dict
[
str
,
Any
]:
import
cv2
cap
=
cv2
.
VideoCapture
(
path
)
cap
=
cv2
.
VideoCapture
(
path
)
if
not
cap
.
isOpened
():
if
not
cap
.
isOpened
():
raise
ValueError
(
f
"Could not open video file
{
path
}
"
)
raise
ValueError
(
f
"Could not open video file
{
path
}
"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment