Internvideo2 Chat 8B
模型概述
該模型通過將InternVideo2作為視頻編碼器,並與Mistral-7B等大型語言模型結合,構建了VideoLLM進行微調,提升了視頻語義內涵和人機交互友好性。
模型特點
漸進式學習方案
採用VideoChat的漸進式學習方案,訓練視頻BLIP模塊與開源LLM進行交互,視頻編碼器會持續更新。
高性能視頻理解
在MVBench和VideoMME等基準測試中表現出色,能夠準確理解視頻內容並進行語義分析。
多模態交互
結合視頻和文本輸入,支持複雜的多模態交互任務,如視頻內容描述和問答。
模型能力
視頻內容理解
視頻問答
視頻內容描述
多模態交互
使用案例
視頻分析
視頻內容描述
對視頻內容進行詳細描述,如動作細節、場景信息等。
視頻展示了一位女士在可俯瞰山景的屋頂練習瑜伽。她首先以手膝支撐姿勢開始,隨後過渡到下犬式,最終以站立姿勢結束。
視頻問答
回答關於視頻內容的特定問題,如人物服裝、動作細節等。
視頻中的女士穿著黑色背心和灰色瑜伽褲。
人機交互
自然語言交互
支持通過自然語言與模型進行交互,獲取視頻內容的詳細信息。
🚀 InternVideo2-Chat-8B
InternVideo2-Chat-8B是一個視頻文本交互模型,通過結合視頻編碼器和大語言模型,提升了視頻語義理解和人機交互的友好性,能處理多種視頻相關的問答任務。
🚀 快速開始
為了進一步豐富 InternVideo2 中嵌入的語義,並提高其在人機通信中的易用性,我們將InternVideo2與大語言模型(LLM)和視頻BLIP集成到一個VideoLLM中進行微調。我們採用了 VideoChat 中的漸進式學習方案,使用InternVideo2作為視頻編碼器,並訓練了一個視頻BLIP以與開源LLM進行通信。在訓練過程中,視頻編碼器會被更新。詳細的訓練方法請參考 VideoChat。
該模型的基礎大語言模型是Mistral-7B。在使用之前,請確保你已經獲得了Mistral-7B的訪問權限,如果尚未獲得,請前往Mistral-7B獲取訪問權限,並將你的 HF_token
添加到環境變量中。
✨ 主要特性
📈 性能表現
模型 | MVBench | 無字幕VideoMME |
---|---|---|
InternVideo2-Chat-8B | 60.3 | 41.9 |
InternVideo2-Chat-8B-HD | 65.4 | 46.1 |
InternVideo2-Chat-8B-HD-F16 | 67.5 | 49.4 |
InternVideo2-Chat-8B-InternLM | 61.9 | 49.1 |
📦 安裝指南
- 申請該項目的權限和基礎大語言模型的訪問權限。
- 將HF用戶訪問令牌填充到環境變量中。
export HF_TOKEN=hf_....
如果你不知道如何獲取以 "hf_" 開頭的令牌,請參考:如何獲取HF用戶訪問令牌。
3. 確保安裝 transformers >= 4.39.0
和 peft==0.5.0
。
pip install transformers==4.39.1
pip install peft==0.5.0
pip install timm easydict einops
從 pip_requirements 安裝必要的Python包。
💻 使用示例
基礎用法
import os
token = os.environ['HF_TOKEN']
import torch
tokenizer = AutoTokenizer.from_pretrained('OpenGVLab/InternVideo2-Chat-8B', trust_remote_code=True, use_fast=False)
from transformers import AutoTokenizer, AutoModel
model = AutoModel.from_pretrained(
'OpenGVLab/InternVideo2-Chat-8B',
torch_dtype=torch.bfloat16,
trust_remote_code=True).cuda()
from decord import VideoReader, cpu
from PIL import Image
import numpy as np
import numpy as np
import decord
from decord import VideoReader, cpu
import torch.nn.functional as F
import torchvision.transforms as T
from torchvision.transforms import PILToTensor
from torchvision import transforms
from torchvision.transforms.functional import InterpolationMode
decord.bridge.set_bridge("torch")
def get_index(num_frames, num_segments):
seg_size = float(num_frames - 1) / num_segments
start = int(seg_size / 2)
offsets = np.array([
start + int(np.round(seg_size * idx)) for idx in range(num_segments)
])
return offsets
def load_video(video_path, num_segments=8, return_msg=False, resolution=224, hd_num=4, padding=False):
vr = VideoReader(video_path, ctx=cpu(0), num_threads=1)
num_frames = len(vr)
frame_indices = get_index(num_frames, num_segments)
mean = (0.485, 0.456, 0.406)
std = (0.229, 0.224, 0.225)
transform = transforms.Compose([
transforms.Lambda(lambda x: x.float().div(255.0)),
transforms.Resize(224, interpolation=transforms.InterpolationMode.BICUBIC),
transforms.CenterCrop(224),
transforms.Normalize(mean, std)
])
frames = vr.get_batch(frame_indices)
frames = frames.permute(0, 3, 1, 2)
frames = transform(frames)
T_, C, H, W = frames.shape
if return_msg:
fps = float(vr.get_avg_fps())
sec = ", ".join([str(round(f / fps, 1)) for f in frame_indices])
# " " should be added in the start and end
msg = f"The video contains {len(frame_indices)} frames sampled at {sec} seconds."
return frames, msg
else:
return frames
video_path = "yoga.mp4"
# sample uniformly 8 frames from the video
video_tensor = load_video(video_path, num_segments=8, return_msg=False)
video_tensor = video_tensor.to(model.device)
chat_history= []
response, chat_history = model.chat(tokenizer, '', 'describe the action step by step.', media_type='video', media_tensor=video_tensor, chat_history= chat_history, return_history=True,generation_config={'do_sample':False})
print(response)
# The video shows a woman performing yoga on a rooftop with a beautiful view of the mountains in the background. She starts by standing on her hands and knees, then moves into a downward dog position, and finally ends with a standing position. Throughout the video, she maintains a steady and fluid movement, focusing on her breath and alignment. The video is a great example of how yoga can be practiced in different environments and how it can be a great way to connect with nature and find inner peace.
response, chat_history = model.chat(tokenizer, '', 'What is she wearing?', media_type='video', media_tensor=video_tensor, chat_history= chat_history, return_history=True,generation_config={'do_sample':False})
# The woman in the video is wearing a black tank top and grey yoga pants.
print(response)
✏️ 引用說明
如果這項工作對你的研究有幫助,請考慮引用InternVideo和VideoChat。
@article{wang2024internvideo2,
title={Internvideo2: Scaling video foundation models for multimodal video understanding},
author={Wang, Yi and Li, Kunchang and Li, Xinhao and Yu, Jiashuo and He, Yinan and Wang, Chenting and Chen, Guo and Pei, Baoqi and Zheng, Rongkun and Xu, Jilan and Wang, Zun and others},
journal={arXiv preprint arXiv:2403.15377},
year={2024}
}
@article{li2023videochat,
title={Videochat: Chat-centric video understanding},
author={Li, KunChang and He, Yinan and Wang, Yi and Li, Yizhuo and Wang, Wenhai and Luo, Ping and Wang, Yali and Wang, Limin and Qiao, Yu},
journal={arXiv preprint arXiv:2305.06355},
year={2023}
}
📄 許可證
本項目採用MIT許可證。
⚠️ 重要提示
你同意不使用該模型進行對人類受試者造成傷害的實驗。
屬性 | 詳情 |
---|---|
模型類型 | 視頻文本交互模型 |
訓練數據 | 未提及 |
許可證 | MIT |
管道標籤 | 視頻文本到文本 |
額外的訪問權限提示 | 你同意不使用該模型進行對人類受試者造成傷害的實驗。 |
額外的訪問權限字段 | 姓名、公司/組織、國家、電子郵件 |
語言 | 英文 |
標籤 | 視頻 |
Llava Video 7B Qwen2
Apache-2.0
LLaVA-視頻模型是基於Qwen2語言模型的7B參數多模態模型,專注於視頻理解任務,支持64幀視頻輸入。
視頻生成文本
Transformers 英語

L
lmms-lab
34.28k
91
Llava NeXT Video 7B DPO Hf
LLaVA-NeXT-Video是一個開源多模態聊天機器人,通過視頻和圖像數據混合訓練優化,具備優秀的視頻理解能力。
視頻生成文本
Transformers 英語

L
llava-hf
12.61k
9
Internvideo2 5 Chat 8B
Apache-2.0
InternVideo2.5是一款基於長且豐富上下文(LRC)建模增強的視頻多模態大語言模型,構建於InternVL2.5之上,通過提升感知細粒度細節和捕捉長時序結構的能力,顯著改進了現有MLLM模型。
視頻生成文本
Transformers 英語

I
OpenGVLab
8,265
60
Cogvlm2 Llama3 Caption
其他
CogVLM2-Caption是一個視頻描述生成模型,用於為CogVideoX模型生成訓練數據。
視頻生成文本
Transformers 英語

C
THUDM
7,493
95
Spacetimegpt
時空GPT是一個能夠進行空間和時間推理的視頻描述生成模型,能夠分析視頻幀並生成描述視頻事件的句子。
視頻生成文本
Transformers 英語

S
Neleac
2,877
33
Video R1 7B
Apache-2.0
Video-R1-7B是基於Qwen2.5-VL-7B-Instruct優化的多模態大語言模型,專注於視頻推理任務,能夠理解視頻內容並回答相關問題。
視頻生成文本
Transformers 英語

V
Video-R1
2,129
9
Internvl 2 5 HiCo R16
Apache-2.0
InternVideo2.5 是一個基於 InternVL2.5 構建的視頻多模態大語言模型(MLLM),通過長且豐富的上下文(LRC)建模進行了增強,能夠感知細粒度細節並捕捉長時態結構。
視頻生成文本
Transformers 英語

I
OpenGVLab
1,914
3
Videollm Online 8b V1plus
MIT
VideoLLM-online是一個基於Llama-3-8B-Instruct的多模態大語言模型,專注於在線視頻理解和視頻-文本生成任務。
視頻生成文本
Safetensors 英語
V
chenjoya
1,688
23
Videochat R1 7B
Apache-2.0
VideoChat-R1_7B 是一個基於 Qwen2.5-VL-7B-Instruct 的多模態視頻理解模型,能夠處理視頻和文本輸入,生成文本輸出。
視頻生成文本
Transformers 英語

V
OpenGVLab
1,686
7
Qwen2.5 Vl 7b Cam Motion Preview
其他
基於Qwen2.5-VL-7B-Instruct微調的攝像機運動分析模型,專注於視頻中的攝像機運動分類和視頻-文本檢索任務
視頻生成文本
Transformers

Q
chancharikm
1,456
10
精選推薦AI模型
Llama 3 Typhoon V1.5x 8b Instruct
專為泰語設計的80億參數指令模型,性能媲美GPT-3.5-turbo,優化了應用場景、檢索增強生成、受限生成和推理任務
大型語言模型
Transformers 支持多種語言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一個基於SODA數據集訓練的超小型對話模型,專為邊緣設備推理設計,體積僅為Cosmo-3B模型的2%左右。
對話系統
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基於RoBERTa架構的中文抽取式問答模型,適用於從給定文本中提取答案的任務。
問答系統 中文
R
uer
2,694
98