基于 Qwen/Qwen3.5-4B 的视频系统一模型,采用直接候选评分方法实现时序定位与视频多选问答。
Paper · Homepage · Code · Usage guide


已在 Python 3.12、PyTorch 2.8 / CUDA 12.8 及 H200 上验证。请先安装匹配的 PyTorch 版本。
pip install transformers==5.14.1 accelerate safetensors numpy pillow av==18.1.0 \
flash-linear-attention==0.4.2 fla-core==0.4.2
pip install flash-attn causal-conv1d --no-build-isolation对吃意大利面(10秒)进行定位和问答,帧率为 2 FPS。
import json
import torch
from huggingface_hub import hf_hub_download
from transformers import AutoModel, AutoProcessor
video = hf_hub_download(
repo_id="ZhuYuhan/VideoJev-Demo", filename="eating_spaghetti.mp4",
repo_type="dataset", revision="7e2b9685bca592c3b929268f6fcf82c4ad74b267",
)
repo = "ZhuYuhan/VideoJev-4B"
processor = AutoProcessor.from_pretrained(repo, trust_remote_code=True)
model = AutoModel.from_pretrained(
repo, trust_remote_code=True, dtype=torch.bfloat16,
device_map={"": "cuda:0"}, attn_implementation="flash_attention_2",
)
model.prepare_for_inference()
questions = [
{"id": "grounding-1", "task": "grounding",
"query": "The woman in green eats pasta."},
{"id": "qa-1", "task": "choice",
"query": "What is the woman in green eating?",
"options": ["A. Pasta.", "B. Rice.", "C. Soup."]},
]
results = model.predict_video(
processor, video, questions,
fps=2.0, max_frames=2048, context=8192,
)
print(json.dumps(results, indent=2))上述视频和代码的实际输出:
[
{
"id": "grounding-1",
"task": "grounding",
"probabilities": [
0.005761092994362116,
0.010865824297070503,
0.026081746444106102,
0.9046059250831604,
0.9879851937294006,
0.9887627959251404,
0.9896195530891418,
0.9849089980125427,
0.833530068397522,
0.33037981390953064
],
"interval": [
3.0,
10.0
]
},
{
"id": "qa-1",
"task": "choice",
"probabilities": [
0.9999161958694458,
5.755242091254331e-05,
2.617507561808452e-05
],
"answer_index": 0,
"answer": "A. Pasta."
}
]interval 以秒为单位;answer_index 从 0 开始。probabilities 包含 grounding 的独立 sigmoid 分数以及 QA 选项上的 softmax 分数。
grounding 默认 threshold=0.25;在调用 predict_video 或 predict_features 时传入 threshold=0.4 即可在单次调用中覆盖该值。
有关特定任务的配置和输出详情,请参阅使用指南。
@article{zhu2026videojev,
title={VideoJev: System One Model for Video Understanding and Interaction},
author={Zhu, Yuhan and Zeng, Xiangyu and Si, Qingyi and Yang, Chenxu and Li, Yifei and Qin, Luozheng and Zhou, Junhao and Yao, Dingyu and Zhang, Jun and Qin, Chuanyu and others},
journal={arXiv preprint arXiv:2610.18615},
year={2026}
}