From d52800dbf595fda3db5a8af1711d6e0067019cc5 Mon Sep 17 00:00:00 2001 From: Netanel Haber <58652339+netanel-haber@users.noreply.github.com> Date: Tue, 11 Nov 2025 18:36:37 +0200 Subject: [PATCH] Support `file://` scheme in `load_video` (#13076) Signed-off-by: Netanel Haber <58652339+netanel-haber@users.noreply.github.com> --- python/sglang/srt/utils/common.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/utils/common.py b/python/sglang/srt/utils/common.py index b91dd77f0..3283d5834 100644 --- a/python/sglang/srt/utils/common.py +++ b/python/sglang/srt/utils/common.py @@ -69,6 +69,7 @@ from typing import ( TypeVar, Union, ) +from urllib.parse import urlparse import numpy as np import orjson @@ -945,7 +946,8 @@ def load_video(video_file: Union[str, bytes], use_gpu: bool = True): tmp_file.write(video_bytes) tmp_file.close() vr = VideoReader(tmp_file.name, ctx=ctx) - elif os.path.isfile(video_file): + # `urlparse` supports file:// paths, and so does VideoReader + elif os.path.isfile(urlparse(video_file).path): vr = VideoReader(video_file, ctx=ctx) else: video_bytes = pybase64.b64decode(video_file, validate=True)