0
stars
143
commits
Python
primary language
Apr 26, 2026
updated
Video-LLaMA: An Instruction-tuned Audio-Visual Language Model for Video Understanding
Hang Zhang, Xin Li, Lidong Bing
![]()
![]()
![]()
VCD: Mitigating Object Hallucinations in Large Vision-Language Models through Visual Contrastive Decoding
Sicong Leng, Hang Zhang, Guanzheng Chen, Xin Li, Shijian Lu, Chunyan Miao, Lidong Bing
![]()
![]()
![]()
The Curse of Multi-Modalities: Evaluating Hallucinations of Large Multimodal Models across Language, Visual, and Audio
Sicong Leng, Yun Xing, Zesen Cheng, Yang Zhou, Hang Zhang, Xin Li, Deli Zhao, Shijian Lu, Chunyan Miao, Lidong Bing
![]()
![]()
![]()
Basic Dependencies:
[Online Mode] Install required packages (better for development):
git clone https://github.com/DAMO-NLP-SG/VideoLLaMA2
cd VideoLLaMA2
git checkout audio_visual
pip install -r requirements.txt
pip install flash-attn==2.5.8 --no-build-isolation
pip install opencv-python==4.5.5.64
apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
[Offline Mode] Install VideoLLaMA2 as a Python package (better for direct use):
git clone https://github.com/DAMO-NLP-SG/VideoLLaMA2
cd VideoLLaMA2
git checkout audio_visual
pip install --upgrade pip # enable PEP 660 support
pip install -e .
pip install flash-attn==2.5.8 --no-build-isolation
pip install opencv-python==4.5.5.64
apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
| Model Name | Type | Audio Encoder | Language Decoder |
|---|---|---|---|
| VideoLLaMA2.1-7B-AV | Chat | Fine-tuned BEATs_iter3+(AS2M)(cpt2) | VideoLLaMA2.1-7B-16F |
It is highly recommended to try our online demo first.
To run a video-based LLM (Large Language Model) web demonstration on your device, you will first need to ensure that you have the necessary model checkpoints prepared, followed by adhering to the steps outlined to successfully launch the demo.
python videollama2/serve/gradio_web_server_adhoc_av.py
To facilitate further development on top of our codebase, we provide a quick-start guide on how to train a customized VideoLLaMA2 with VideoLLaVA dataset and evaluate the trained model on the mainstream video-llm benchmarks.
# VideoLLaMA2.1-audio pretraining
bash scripts/custom/pretrain_audio.sh
# VideoLLaMA2.1-audio finetuning
bash scripts/custom/finetune_audio.sh
# VideoLLaMA2.1-audio_visual finetuning
bash scripts/custom/va_joint.sh
Evaluation Data Structure: Follow the main branch(https://github.com/DAMO-NLP-SG/VideoLLaMA2/tree/main) of this VideoLLaMA2 codebase.
Command:
# ClothoAQA.sh evaluation
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 bash scripts/eval/eval_audio_clothoAQA.sh
# TUT2017 evaluation
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 bash scripts/eval/eval_audio_TUT2017.sh
# VocalSound evaluation
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 bash scripts/eval/eval_audio_vocalsound.sh
# AVQA_music evaluation
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 bash scripts/eval/eval_audio_video_AVQA.sh
# AVSD evaluation (need to set azure openai key/endpoint/deployname)
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 bash scripts/eval/eval_audio_video_AVSD.sh
# AVSSD evaluation (need to set azure openai key/endpoint/deployname)
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 bash scripts/eval/eval_audio_video_AVSSD.sh
If you want to train a video-llm on your data, you need to follow the procedures below to prepare the audio/video/image sft data:
VideoLLaMA2
├── datasets
│ ├── custom_sft
│ | ├── audio
│ | ├── video
│ | ├── image
| | └── custom.json
[
{
"id": 0,
"audio": "audio/xxx.wav",
"conversations": [
{
"from": "human",
"value": "<audio>\nPlease describe the sound event within the audio."
},
{
"from": "gpt",
"value": "Loud television static dips in and out of focus."
},
...
],
}
{
"id": 1,
"video": "images/xxx.jpg",
"conversations": [
{
"from": "human",
"value": "<image>\nWhat are the colors of the bus in the image?"
},
{
"from": "gpt",
"value": "The bus in the image is white and red."
},
...
],
}
{
"id": 2,
"video": "videos/xxx.mp4",
"conversations": [
{
"from": "human",
"value": "<video>\nWhat are the main activities that take place in the video?"
},
{
"from": "gpt",
"value": "The main activities that take place in the video are the preparation of camera equipment by a man, a group of men riding a helicopter, and a man sailing a boat through the water."
},
...
],
},
...
]
scripts/custom/finetune_audio.sh:...
--data_path datasets/custom_sft/custom.json
--data_folder datasets/custom_sft/
--pretrain_mm_mlp_adapter CONNECTOR_DOWNLOAD_PATH (e.g., DAMO-NLP-SG/VideoLLaMA2.1-7B-16F)
...
scripts/custom/va_joint.sh:...
--data_path datasets/custom_sft/custom.json
--data_folder datasets/custom_sft/
--pretrain_mm_mlp_adapter CONNECTOR_DOWNLOAD_PATH (e.g., DAMO-NLP-SG/VideoLLaMA2.1-7B-16F)
...
Audio/Video-Audio Inference:
import sys
sys.path.append('./')
from videollama2 import model_init, mm_infer
from videollama2.utils import disable_torch_init
import argparse
def inference(args):
model_path = args.model_path
model, processor, tokenizer = model_init(model_path)
if args.modal_type == "a":
model.model.vision_tower = None
elif args.modal_type == "v":
model.model.audio_tower = None
elif args.modal_type == "av":
pass
else:
raise NotImplementedError
# Audio-visual Inference
audio_video_path = "assets/00000368.mp4"
preprocess = processor['audio' if args.modal_type == "a" else "video"]
if args.modal_type == "a":
audio_video_tensor = preprocess(audio_video_path)
else:
audio_video_tensor = preprocess(audio_video_path, va=True if args.modal_type == "av" else False)
question = f"Who plays the instrument louder?"
# Audio Inference
audio_video_path = "assets/bird-twitter-car.wav"
preprocess = processor['audio' if args.modal_type == "a" else "video"]
if args.modal_type == "a":
audio_video_tensor = preprocess(audio_video_path)
else:
audio_video_tensor = preprocess(audio_video_path, va=True if args.modal_type == "av" else False)
question = f"Please describe the audio:"
# Video Inference
audio_video_path = "assets/output_v_1jgsRbGzCls.mp4"
preprocess = processor['audio' if args.modal_type == "a" else "video"]
if args.modal_type == "a":
audio_video_tensor = preprocess(audio_video_path)
else:
audio_video_tensor = preprocess(audio_video_path, va=True if args.modal_type == "av" else False)
question = f"What activity are the people practicing in the video?"
output = mm_infer(
audio_video_tensor,
question,
model=model,
tokenizer=tokenizer,
modal='audio' if args.modal_type == "a" else "video",
do_sample=False,
)
print(output)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--model-path', help='', required=True)
parser.add_argument('--modal-type', choices=["a", "v", "av"], help='', required=True)
args = parser.parse_args()
inference(args)
If you find VideoLLaMA useful for your research and applications, please cite using this BibTeX:
@article{damonlpsg2024videollama2,
title={VideoLLaMA 2: Advancing Spatial-Temporal Modeling and Audio Understanding in Video-LLMs},
author={Cheng, Zesen and Leng, Sicong and Zhang, Hang and Xin, Yifei and Li, Xin and Chen, Guanzheng and Zhu, Yongxin and Zhang, Wenqi and Luo, Ziyang and Zhao, Deli and Bing, Lidong},
journal={arXiv preprint arXiv:2406.07476},
year={2024},
url = {https://arxiv.org/abs/2406.07476}
}
@article{damonlpsg2023videollama,
title = {Video-LLaMA: An Instruction-tuned Audio-Visual Language Model for Video Understanding},
author = {Zhang, Hang and Li, Xin and Bing, Lidong},
journal = {arXiv preprint arXiv:2306.02858},
year = {2023},
url = {https://arxiv.org/abs/2306.02858}
}
The codebase of VideoLLaMA 2 is adapted from LLaVA 1.5 and FastChat. We are also grateful for the following projects our VideoLLaMA 2 arise from:
This project is released under the Apache 2.0 license as found in the LICENSE file. The service is a research preview intended for non-commercial use ONLY, subject to the model Licenses of LLaMA and Mistral, Terms of Use of the data generated by OpenAI, and Privacy Practices of ShareGPT. Please get in touch with us if you find any potential violations.
Python
90.2%
Shell
9.8%
0
stars
143
commits
Python
primary language
Apr 26, 2026
updated
Video-LLaMA: An Instruction-tuned Audio-Visual Language Model for Video Understanding
Hang Zhang, Xin Li, Lidong Bing
![]()
![]()
![]()
VCD: Mitigating Object Hallucinations in Large Vision-Language Models through Visual Contrastive Decoding
Sicong Leng, Hang Zhang, Guanzheng Chen, Xin Li, Shijian Lu, Chunyan Miao, Lidong Bing
![]()
![]()
![]()
The Curse of Multi-Modalities: Evaluating Hallucinations of Large Multimodal Models across Language, Visual, and Audio
Sicong Leng, Yun Xing, Zesen Cheng, Yang Zhou, Hang Zhang, Xin Li, Deli Zhao, Shijian Lu, Chunyan Miao, Lidong Bing
![]()
![]()
![]()
Basic Dependencies:
[Online Mode] Install required packages (better for development):
git clone https://github.com/DAMO-NLP-SG/VideoLLaMA2
cd VideoLLaMA2
git checkout audio_visual
pip install -r requirements.txt
pip install flash-attn==2.5.8 --no-build-isolation
pip install opencv-python==4.5.5.64
apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
[Offline Mode] Install VideoLLaMA2 as a Python package (better for direct use):
git clone https://github.com/DAMO-NLP-SG/VideoLLaMA2
cd VideoLLaMA2
git checkout audio_visual
pip install --upgrade pip # enable PEP 660 support
pip install -e .
pip install flash-attn==2.5.8 --no-build-isolation
pip install opencv-python==4.5.5.64
apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
| Model Name | Type | Audio Encoder | Language Decoder |
|---|---|---|---|
| VideoLLaMA2.1-7B-AV | Chat | Fine-tuned BEATs_iter3+(AS2M)(cpt2) | VideoLLaMA2.1-7B-16F |
It is highly recommended to try our online demo first.
To run a video-based LLM (Large Language Model) web demonstration on your device, you will first need to ensure that you have the necessary model checkpoints prepared, followed by adhering to the steps outlined to successfully launch the demo.
python videollama2/serve/gradio_web_server_adhoc_av.py
To facilitate further development on top of our codebase, we provide a quick-start guide on how to train a customized VideoLLaMA2 with VideoLLaVA dataset and evaluate the trained model on the mainstream video-llm benchmarks.
# VideoLLaMA2.1-audio pretraining
bash scripts/custom/pretrain_audio.sh
# VideoLLaMA2.1-audio finetuning
bash scripts/custom/finetune_audio.sh
# VideoLLaMA2.1-audio_visual finetuning
bash scripts/custom/va_joint.sh
Evaluation Data Structure: Follow the main branch(https://github.com/DAMO-NLP-SG/VideoLLaMA2/tree/main) of this VideoLLaMA2 codebase.
Command:
# ClothoAQA.sh evaluation
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 bash scripts/eval/eval_audio_clothoAQA.sh
# TUT2017 evaluation
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 bash scripts/eval/eval_audio_TUT2017.sh
# VocalSound evaluation
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 bash scripts/eval/eval_audio_vocalsound.sh
# AVQA_music evaluation
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 bash scripts/eval/eval_audio_video_AVQA.sh
# AVSD evaluation (need to set azure openai key/endpoint/deployname)
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 bash scripts/eval/eval_audio_video_AVSD.sh
# AVSSD evaluation (need to set azure openai key/endpoint/deployname)
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 bash scripts/eval/eval_audio_video_AVSSD.sh
If you want to train a video-llm on your data, you need to follow the procedures below to prepare the audio/video/image sft data:
VideoLLaMA2
├── datasets
│ ├── custom_sft
│ | ├── audio
│ | ├── video
│ | ├── image
| | └── custom.json
[
{
"id": 0,
"audio": "audio/xxx.wav",
"conversations": [
{
"from": "human",
"value": "<audio>\nPlease describe the sound event within the audio."
},
{
"from": "gpt",
"value": "Loud television static dips in and out of focus."
},
...
],
}
{
"id": 1,
"video": "images/xxx.jpg",
"conversations": [
{
"from": "human",
"value": "<image>\nWhat are the colors of the bus in the image?"
},
{
"from": "gpt",
"value": "The bus in the image is white and red."
},
...
],
}
{
"id": 2,
"video": "videos/xxx.mp4",
"conversations": [
{
"from": "human",
"value": "<video>\nWhat are the main activities that take place in the video?"
},
{
"from": "gpt",
"value": "The main activities that take place in the video are the preparation of camera equipment by a man, a group of men riding a helicopter, and a man sailing a boat through the water."
},
...
],
},
...
]
scripts/custom/finetune_audio.sh:...
--data_path datasets/custom_sft/custom.json
--data_folder datasets/custom_sft/
--pretrain_mm_mlp_adapter CONNECTOR_DOWNLOAD_PATH (e.g., DAMO-NLP-SG/VideoLLaMA2.1-7B-16F)
...
scripts/custom/va_joint.sh:...
--data_path datasets/custom_sft/custom.json
--data_folder datasets/custom_sft/
--pretrain_mm_mlp_adapter CONNECTOR_DOWNLOAD_PATH (e.g., DAMO-NLP-SG/VideoLLaMA2.1-7B-16F)
...
Audio/Video-Audio Inference:
import sys
sys.path.append('./')
from videollama2 import model_init, mm_infer
from videollama2.utils import disable_torch_init
import argparse
def inference(args):
model_path = args.model_path
model, processor, tokenizer = model_init(model_path)
if args.modal_type == "a":
model.model.vision_tower = None
elif args.modal_type == "v":
model.model.audio_tower = None
elif args.modal_type == "av":
pass
else:
raise NotImplementedError
# Audio-visual Inference
audio_video_path = "assets/00000368.mp4"
preprocess = processor['audio' if args.modal_type == "a" else "video"]
if args.modal_type == "a":
audio_video_tensor = preprocess(audio_video_path)
else:
audio_video_tensor = preprocess(audio_video_path, va=True if args.modal_type == "av" else False)
question = f"Who plays the instrument louder?"
# Audio Inference
audio_video_path = "assets/bird-twitter-car.wav"
preprocess = processor['audio' if args.modal_type == "a" else "video"]
if args.modal_type == "a":
audio_video_tensor = preprocess(audio_video_path)
else:
audio_video_tensor = preprocess(audio_video_path, va=True if args.modal_type == "av" else False)
question = f"Please describe the audio:"
# Video Inference
audio_video_path = "assets/output_v_1jgsRbGzCls.mp4"
preprocess = processor['audio' if args.modal_type == "a" else "video"]
if args.modal_type == "a":
audio_video_tensor = preprocess(audio_video_path)
else:
audio_video_tensor = preprocess(audio_video_path, va=True if args.modal_type == "av" else False)
question = f"What activity are the people practicing in the video?"
output = mm_infer(
audio_video_tensor,
question,
model=model,
tokenizer=tokenizer,
modal='audio' if args.modal_type == "a" else "video",
do_sample=False,
)
print(output)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--model-path', help='', required=True)
parser.add_argument('--modal-type', choices=["a", "v", "av"], help='', required=True)
args = parser.parse_args()
inference(args)
If you find VideoLLaMA useful for your research and applications, please cite using this BibTeX:
@article{damonlpsg2024videollama2,
title={VideoLLaMA 2: Advancing Spatial-Temporal Modeling and Audio Understanding in Video-LLMs},
author={Cheng, Zesen and Leng, Sicong and Zhang, Hang and Xin, Yifei and Li, Xin and Chen, Guanzheng and Zhu, Yongxin and Zhang, Wenqi and Luo, Ziyang and Zhao, Deli and Bing, Lidong},
journal={arXiv preprint arXiv:2406.07476},
year={2024},
url = {https://arxiv.org/abs/2406.07476}
}
@article{damonlpsg2023videollama,
title = {Video-LLaMA: An Instruction-tuned Audio-Visual Language Model for Video Understanding},
author = {Zhang, Hang and Li, Xin and Bing, Lidong},
journal = {arXiv preprint arXiv:2306.02858},
year = {2023},
url = {https://arxiv.org/abs/2306.02858}
}
The codebase of VideoLLaMA 2 is adapted from LLaVA 1.5 and FastChat. We are also grateful for the following projects our VideoLLaMA 2 arise from:
This project is released under the Apache 2.0 license as found in the LICENSE file. The service is a research preview intended for non-commercial use ONLY, subject to the model Licenses of LLaMA and Mistral, Terms of Use of the data generated by OpenAI, and Privacy Practices of ShareGPT. Please get in touch with us if you find any potential violations.
Python
90.2%
Shell
9.8%