ViLAMP(VIdeo-LAnguage Model with Mixed Precision)是蚂蚁集团和中国人民大学联合推出的视觉语言模型,专门用在高效处理长视频内容。基于混合精度策略,对视频中的关键帧保持高精度分析,显著降低计算成本提高处理效率。ViLAMP在多个视频理解基准测试中表现出色,在长视频理解任务中,展现出显著优势。ViLAMP能在单张A100 GPU上处理长达1万帧(约3小时)的视频,同时保持稳定的理解准确率,为长视频分析提供新的解决方案。
ViLAMP的主要功能
- 长视频理解:支持处理长达数小时的视频。
- 关键信息提取:精准提取视频中的关键信息,同时压缩冗余信息。
- 高效计算:在单张A100 GPU上处理长达1万帧(约3小时)的视频,显著降低内存和计算成本,提高处理效率。
- 多任务处理:支持多种视频理解任务,如视频内容问答、动作识别、场景理解等。
ViLAMP的技术原理
- 差分关键帧选择:基于贪心算法选择与用户查询高度相关且具有时间多样性的关键帧。确保选中的关键帧既能捕捉重要信息,避免冗余。
- 差分特征合并:对非关键帧进行压缩,将每个非关键帧的多个patch合并为单个token。基于差分加权池化,赋予与用户查询相关且具有独特性的patch更高的权重,同时降低与关键帧重复的patch的权重。保留关键信息的同时,显著减少计算量。
ViLAMP的项目地址
- GitHub仓库:https://github.com/steven-ccq/ViLAMP
- arXiv技术论文:https://arxiv.org/pdf/2504.02438
git clone https://github.com/steven-ccq/ViLAMP.git
cd ViLAMP
# python 3.8
pip install -r requirements.txt
请安装🤗ViLAMP-llava-qwen并将其放入models/
我们提供了五个基准的评估脚本:Video-MME
、、、和MLVU
。更多详情,请参阅。LongVideoBench
ActivityNetQA
EgoSchema
scripts/eval/
在运行这些脚本之前,请下载评估数据集并将其放在dataset/
目录中。以下是输入参数的说明:
--dataset_path Path to the test dataset
--video_dir Path to the folder containing the videos required for testing
--output_dir Path to the folder where the results will be saved
--version Path to the model
--split Split the dataset in the format i_N, where N is the total number of splits and i is the current split index (starting from 1). Default is 1_1.
--max_frame_num Maximum number of frames to sample per video. Default is 600.
以下是评估 Video-MME 的示例
python exp_vMME.py \
--dataset_path dataset/Video-MME/videomme/test-00000-of-00001.parquet \
--video_dir dataset/Video-MME/data \
--output_dir dataset/Video-MME/output \
--version models/ViLAMP-llava-qwen \
--split 1_1 \
--max_frame_num 600
我们提供针对单节点和多节点环境设计的训练脚本。更多详细说明,请查看scripts/train/
目录。
为了简化数据集的组织,我们利用该training_data.yaml
文件来整合训练数据。在开始训练之前,请确保您的数据集已注册到此文件中。我们提供了一个简单的示例example-10.json
来演示预期的数据集格式。
请注意,如果您的训练数据集需要特定的处理方法,则需要修改llava/train/train.py
文件的第 1225 行,并在该行之前插入自定义视频处理功能,以满足您的数据集的需求。
@article{cheng2025vilamp,
title={Scaling Video-Language Models to 10K Frames via Hierarchical Differential Distillation},
author={Cheng, Chuanqi and Guan, Jian and Wu, Wei and Yan, Rui},
journal={arXiv preprint arXiv:2504.02438},
year={2025}
}