Eagle2.5 8B
模型概述
Eagle 2.5解決了長視頻理解和高分辨率圖像理解的挑戰,提供了通用框架,在多個基準測試中表現優異。
模型特點
長上下文處理能力
支持處理長達512幀的視頻序列和高分辨率圖像,解決了現有大多數VLM專注於短上下文任務的侷限。
信息優先採樣
通過圖像區域保留(IAP)和自動降級採樣(ADS)優化視覺和文本輸入,確保在不丟失信息的前提下最大化利用上下文長度。
漸進式混合後訓練
在訓練過程中逐漸增加上下文長度,從32K擴展到128K,增強模型處理不同輸入大小的能力。
多樣性驅動的數據配方
結合開源數據和自主策劃的Eagle-Video-110K數據集,提供豐富多樣的訓練樣本。
效率優化
通過GPU內存優化、分佈式上下文並行、視頻解碼加速和推理加速等技術,顯著提升模型的計算效率和推理速度。
模型能力
長視頻理解
高分辨率圖像理解
多模態學習
文本生成
圖像分析
視頻分析
使用案例
視頻理解
長視頻內容分析
分析長達512幀的視頻內容,提取關鍵信息和故事線。
在多個視頻基準測試中達到SOTA水平。
視頻問答
根據視頻內容回答相關問題。
在Video-MME上使用512輸入幀時達到72.4%的準確率。
圖像理解
高分辨率圖像分析
處理高分辨率圖像,提取細粒度細節。
在多個圖像基準測試中表現優異,與Qwen2.5-VL表現相當。
文檔理解
解析多頁文檔內容,提取關鍵信息。
在DocVQA測試中達到94.1%的準確率。
🚀 Eagle 2.5
Eagle 2.5是一系列前沿的視覺語言模型(VLM),專為長上下文多模態學習而設計。它解決了長視頻理解和高分辨率圖像理解的挑戰,為這兩個領域提供了通用框架。
項目鏈接
🚀 快速開始
要使用Eagle 2.5,首先需要安裝必要的庫:
pip install transformers==4.51.0
✨ 主要特性
強大的長上下文處理能力
Eagle 2.5支持處理長達512幀的視頻序列,在長視頻理解和高分辨率圖像理解方面表現出色,解決了現有大多數VLM專注於短上下文任務的侷限。
優異的基準測試成績
- 在10個長視頻基準測試中的6個上達到了SOTA水平。
- 在3/5的視頻任務中超越了GPT - 4o (0806)。
- 在4/6的視頻任務中超越了Gemini 1.5 Pro。
- 在多個關鍵數據集上與Qwen2.5 - VL - 72B表現相當或更優。
- 在Video - MME上使用512輸入幀時達到72.4%的準確率。
- 在圖像理解方面相較於Eagle 2有持續提升,與Qwen2.5 - VL表現相當。
關鍵創新點
- 信息優先採樣:
- 圖像區域保留(IAP):優化圖像分塊,保留大部分原始圖像區域和寬高比,保留細粒度細節。
- 自動降級採樣(ADS):動態平衡視覺和文本輸入,確保在上下文長度限制內完整保留文本的同時最大化視覺內容。
- 漸進式混合後訓練:在訓練過程中逐漸增加上下文長度,增強模型處理不同輸入大小的能力,提高信息密度。
- 多樣性驅動的數據配方:將開源數據(人工標註和合成數據)與精心策劃的Eagle - Video - 110K數據集相結合,該數據集通過多樣性驅動策略收集,並帶有故事級和片段級的問答對標註。
效率與框架優化
- GPU內存優化:
- 集成基於Triton的融合算子,替代PyTorch的MLP、RMSNorm和RoPE實現。
- 通過融合線性層和交叉熵損失(去除中間logit存儲)以及將隱藏狀態卸載到CPU來減少GPU內存使用。
- 分佈式上下文並行:
- 採用基於Ulysses和Ring/Context Parallelism的兩層通信組。
- 實現ZigZag Llama3風格的上下文並行,使用全收集KV減少通信延遲。
- 視頻解碼加速:優化稀疏視頻幀採樣,快速解析視頻元數據,提高長視頻解碼速度並減少內存消耗。
- 推理加速:支持vLLM部署,減少內存使用並加速推理。
📦 安裝指南
安裝所需的庫:
pip install transformers==4.51.0
💻 使用示例
基礎用法
單張圖像
from PIL import Image
import requests
from transformers import AutoProcessor, AutoModel
import torch
model = AutoModel.from_pretrained("nvidia/Eagle-2.5-8B",trust_remote_code=True, torch_dtype=torch.bfloat16)
processor = AutoProcessor.from_pretrained("nvidia/Eagle-2.5-8B", trust_remote_code=True, use_fast=True)
processor.tokenizer.padding_side = "left"
messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": "https://www.ilankelman.org/stopsigns/australia.jpg",
},
{"type": "text", "text": "Describe this image."},
],
}
]
text_list = [processor.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)]
image_inputs, video_inputs = processor.process_vision_info(messages)
inputs = processor(text = text_list, images=image_inputs, videos=video_inputs, return_tensors="pt", padding=True)
inputs = inputs.to("cuda")
model = model.to("cuda")
generated_ids = model.generate(**inputs, max_new_tokens=1024)
output_text = processor.batch_decode(
generated_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print(output_text)
高級用法
流式生成
from PIL import Image
import requests
from transformers import AutoProcessor, AutoModel, AutoTokenizer
import torch
from transformers import TextIteratorStreamer
import threading
model = AutoModel.from_pretrained("nvidia/Eagle-2.5-8B",trust_remote_code=True, attn_implementation='flash_attention_2', torch_dtype=torch.bfloat16)
tokenizer = AutoTokenizer.from_pretrained("nvidia/Eagle-2.5-8B", trust_remote_code=True, use_fast=True)
processor = AutoProcessor.from_pretrained("nvidia/Eagle-2.5-8B", trust_remote_code=True, use_fast=True)
processor.tokenizer.padding_side = "left"
messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": "https://www.ilankelman.org/stopsigns/australia.jpg",
},
{"type": "text", "text": "Describe this image."},
],
}
]
text_list = [processor.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)]
image_inputs, video_inputs = processor.process_vision_info(messages)
inputs = processor(text = text_list, images=image_inputs, videos=video_inputs, return_tensors="pt", padding=True)
inputs = inputs.to("cuda")
model = model.to("cuda")
streamer = TextIteratorStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
generation_kwargs = dict(
**inputs,
streamer=streamer,
max_new_tokens=1024,
do_sample=True,
top_p=0.95,
temperature=0.8
)
thread = threading.Thread(target=model.generate, kwargs=generation_kwargs)
thread.start()
for new_text in streamer:
print(new_text, end="", flush=True)
多張圖像
from PIL import Image
import requests
from transformers import AutoProcessor, AutoModel
import torch
model = AutoModel.from_pretrained("nvidia/Eagle-2.5-8B",trust_remote_code=True, torch_dtype=torch.bfloat16)
processor = AutoProcessor.from_pretrained("nvidia/Eagle-2.5-8B", trust_remote_code=True, use_fast=True)
processor.tokenizer.padding_side = "left"
messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": "https://www.ilankelman.org/stopsigns/australia.jpg",
},
{
"type": "image",
"image": "https://www.nvidia.com/content/dam/en-zz/Solutions/about-nvidia/logo-and-brand/01-nvidia-logo-vert-500x200-2c50-d@2x.png",
},
{"type": "text", "text": "Describe these two images."},
],
}
]
text_list = [processor.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)]
image_inputs, video_inputs = processor.process_vision_info(messages)
inputs = processor(text = text_list, images=image_inputs, videos=video_inputs, return_tensors="pt", padding=True)
inputs = inputs.to("cuda")
model = model.to("cuda")
generated_ids = model.generate(**inputs, max_new_tokens=1024)
output_text = processor.batch_decode(
generated_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print(output_text)
單視頻
from PIL import Image
import requests
from transformers import AutoProcessor, AutoModel
import torch
model = AutoModel.from_pretrained("nvidia/Eagle-2.5-8B",trust_remote_code=True, torch_dtype=torch.bfloat16)
processor = AutoProcessor.from_pretrained("nvidia/Eagle-2.5-8B", trust_remote_code=True, use_fast=True)
processor.tokenizer.padding_side = "left"
messages = [
{
"role": "user",
"content": [
{
"type": "video",
"video": "../Eagle2-8B/space_woaudio.mp4",
},
{"type": "text", "text": "Describe this video."},
],
}
]
text_list = [processor.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)]
image_inputs, video_inputs, video_kwargs = processor.process_vision_info(messages, return_video_kwargs=True)
inputs = processor(text = text_list, images=image_inputs, videos=video_inputs, return_tensors="pt", padding=True, videos_kwargs=video_kwargs)
inputs = inputs.to("cuda")
model = model.to("cuda")
generated_ids = model.generate(**inputs, max_new_tokens=1024)
output_text = processor.batch_decode(
generated_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print(output_text)
多視頻
from PIL import Image
import requests
from transformers import AutoProcessor, AutoModel
import torch
model = AutoModel.from_pretrained("nvidia/Eagle-2.5-8B",trust_remote_code=True, torch_dtype=torch.bfloat16)
processor = AutoProcessor.from_pretrained("nvidia/Eagle-2.5-8B", trust_remote_code=True, use_fast=True)
processor.tokenizer.padding_side = "left"
messages = [
{
"role": "user",
"content": [
{
"type": "video",
"video": "../Eagle2-8B/space_woaudio.mp4",
"nframes": 10,
},
{
"type": "video",
"video": "../Eagle2-8B/video_ocr.mp4",
"nframes": 10,
},
{"type": "text", "text": "Describe these two videos respectively."},
],
}
]
text_list = [processor.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)]
image_inputs, video_inputs, video_kwargs = processor.process_vision_info(messages, return_video_kwargs=True)
inputs = processor(text = text_list, images=image_inputs, videos=video_inputs, return_tensors="pt", padding=True, videos_kwargs=video_kwargs)
inputs = inputs.to("cuda")
model = model.to("cuda")
generated_ids = model.generate(**inputs, max_new_tokens=1024)
output_text = processor.batch_decode(
generated_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print(output_text)
批量推理
from PIL import Image
import requests
from transformers import AutoProcessor, AutoModel
import torch
model = AutoModel.from_pretrained("nvidia/Eagle-2.5-8B",trust_remote_code=True, torch_dtype=torch.bfloat16)
processor = AutoProcessor.from_pretrained("nvidia/Eagle-2.5-8B", trust_remote_code=True, use_fast=True)
processor.tokenizer.padding_side = "left"
messages1 = [
{
"role": "user",
"content": [
{
"type": "image",
"image": "https://www.ilankelman.org/stopsigns/australia.jpg",
},
{"type": "text", "text": "Describe this image."},
],
}
]
messages2 = [
{
"role": "user",
"content": [
{
"type": "image",
"image": "https://www.nvidia.com/content/dam/en-zz/Solutions/about-nvidia/logo-and-brand/01-nvidia-logo-vert-500x200-2c50-d@2x.png",
},
{"type": "text", "text": "Describe this image."},
],
}
]
text_list = [processor.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
) for messages in [messages1, messages2]]
image_inputs, video_inputs = processor.process_vision_info([messages1, messages2])
inputs = processor(text = text_list, images=image_inputs, videos=video_inputs, return_tensors="pt", padding=True)
inputs = inputs.to("cuda")
model = model.to("cuda")
generated_ids = model.generate(**inputs, max_new_tokens=1024)
output_text = processor.batch_decode(
generated_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print(output_text)
📚 詳細文檔
模型詳情
屬性 | 詳情 |
---|---|
模型類型 | 長上下文視覺語言模型 |
架構 | 視覺編碼器:Siglip2 - So400m - Patch16 - 512;語言模型:Qwen2.5 - 7B - Instruct;多模態基礎架構:基於分塊視覺輸入的LLaVA |
支持輸入 | 長視頻序列(最多512幀)、高分辨率圖像(最大4K HD輸入尺寸)、多頁文檔、長文本 |
訓練策略 | 漸進式混合後訓練,上下文長度從32K擴展到128K;信息優先採樣以優化視覺和文本信息保留 |
訓練數據 | 開源視頻和文檔數據集、Eagle - Video - 110K(110K個具有雙級標註的長視頻) |
發佈的模型
模型 | 日期 | 下載鏈接 | 說明 |
---|---|---|---|
Eagle2.5 - 8B | 2025.04.16 | [HF鏈接](https://huggingface.co/nvidia/Eagle2.5 - 8B) | 支持長視頻(512幀)和高分辨率輸入 |
視頻基準測試
基準測試 | GPT - 4o | Gemini - 1.5 Pro | InternVL2.5 - 8B | Qwen2.5 - VL - 8B | Eagle2.5 - 8B |
---|---|---|---|---|---|
MVBenchtest | - | - | 72.0 | 69.6 | 74.8 |
Perception_testval | - | - | - | 70.5 | 82.0 |
EgoSchemafullset | - | 72.2 | - | 65.0 | 72.2 |
MMB - Video | 1.63 | 1.30 | 1.68 | 1.79 | 1.94 |
MLVUval | - | - | 68.9 | 70.2 | 77.6 |
LVBenchval | 66.7 | 64.0 | 60.0 | 56.0 | 66.4 |
Video - MMEw/o subtitle | 71.9 | 75.0 | 64.2 | 65.1 | 72.4 |
Video - MMEw subtitle | 77.2 | 81.3 | 66.9 | 71.6 | 75.7 |
CG - BenchClue | 58.6 | 50.9 | - | 44.5 | 55.8 |
CG - BenchLong | 44.9 | 37.8 | - | 35.5 | 46.6 |
CG - BenchmIoU | 5.73 | 3.85 | - | 2.48 | 13.4 |
HourVideoDev | - | 37.2 | - | - | 44.5 |
HourVideoTest | - | 37.4 | - | - | 41.8 |
Charade - STAmIoU | 35.7 | - | - | 43.6 | 65.9 |
HD - EPIC | - | 37.6 | - | - | 42.9 |
HRVideoBench | - | - | - | - | 68.5 |
EgoPlanval | - | - | - | - | 45.3 |
具身基準測試
基準測試 | GPT - 4o | Gemini - 1.5 Pro | InternVL2.5 - 8B | Qwen2.5 - VL - 8B | Eagle2.5 - 8B |
---|---|---|---|---|---|
OpenEQA | - | - | - | - | 63.5 |
ERQA | 47.0 | 41.8 | - | - | 38.3 |
EgoPlanval | - | - | - | - | 45.3 |
圖像基準測試
基準測試 | GPT - 4o | Gemini - 1.5 Pro | InternVL2.5 - 8B | Qwen2.5 - VL - 8B | Eagle2.5 - 8B |
---|---|---|---|---|---|
DocVQAtest | 92.8 | 93.1 | 93.0 | 95.7 | 94.1 |
ChartQAtest | 85.7 | 87.2 | 84.8 | 87.3 | 87.5 |
InfoVQAtest | 79.2 | 81.0 | 77.6 | 82.6 | 80.4 |
TextVQAval | 77.4 | 78.8 | 79.1 | 84.9 | 83.7 |
OCRBenchtest | 736 | 754 | 822 | 864 | 869 |
MMstartest | 64.7 | 59.1 | 62.8 | 63.9 | 66.2 |
RWQAtest | 75.4 | 67.5 | 70.1 | 68.5 | 76.7 |
AI2Dtest | 84.6 | 79.1 | 84.5 | 83.9 | 84.5 |
MMMUval | 69.1 | 62.2 | 56.0 | 58.6 | 55.8 |
MMBench_V11test | 83.1 | 74.6 | 83.2 | 82.6 | 81.7 |
MMVetGPT - 4 - Turbo | 69.1 | 64.0 | 62.8 | 67.1 | 62.9 |
HallBenchavg | 55.0 | 45.6 | 50.1 | 52.9 | 54.7 |
MathVistatestmini | 63.8 | 63.9 | 64.4 | 68.2 | 67.8 |
平均得分 | 74.9 | 71.7 | 73.1 | 75.6 | 75.6 |
🔧 技術細節
信息優先採樣
- 圖像區域保留(IAP):通過優化圖像分塊方式,儘可能保留原始圖像的區域和寬高比,從而保留圖像中的細粒度細節,有助於模型更準確地理解圖像內容。
- 自動降級採樣(ADS):在處理視覺和文本輸入時,根據上下文長度的限制,動態平衡兩者的比例,確保在不丟失文本信息的前提下,最大化利用視覺內容。
漸進式混合後訓練
在訓練過程中,逐漸增加上下文長度,從32K擴展到128K。這種方式使模型能夠適應不同大小的輸入,提高了模型處理長上下文信息的能力,同時增加了信息密度。
多樣性驅動的數據配方
結合開源的視頻和文檔數據集以及自主策劃的Eagle - Video - 110K數據集。該數據集通過多樣性驅動的策略收集,包含超過110K個帶有故事級和片段級標註的長視頻樣本,為模型訓練提供了豐富多樣的數據。
效率優化
- GPU內存優化:
- 採用基於Triton的融合算子,替代PyTorch的MLP、RMSNorm和RoPE實現,提高計算效率。
- 通過融合線性層和交叉熵損失,去除中間logit存儲,減少了GPU內存的使用。同時,將隱藏狀態卸載到CPU,進一步優化內存佔用。
- 分佈式上下文並行:
- 採用基於Ulysses和Ring/Context Parallelism的兩層通信組,結合ZigZag Llama3風格的上下文並行,使用全收集KV減少通信延遲,提高分佈式訓練的效率。
- 視頻解碼加速:優化稀疏視頻幀採樣算法,快速解析視頻元數據,提高長視頻解碼速度,同時減少內存消耗。
- 推理加速:支持vLLM部署,減少推理過程中的內存使用,加速模型推理。
📄 許可證
本項目採用nsclv1
許可證。
Clip Vit Large Patch14 336
基於Vision Transformer架構的大規模視覺語言預訓練模型,支持圖像與文本的跨模態理解
文本生成圖像
Transformers

C
openai
5.9M
241
Fashion Clip
MIT
FashionCLIP是基於CLIP開發的視覺語言模型,專門針對時尚領域進行微調,能夠生成通用產品表徵。
文本生成圖像
Transformers 英語

F
patrickjohncyh
3.8M
222
Gemma 3 1b It
Gemma 3是Google推出的輕量級先進開放模型系列,基於與Gemini模型相同的研究和技術構建。該模型是多模態模型,能夠處理文本和圖像輸入並生成文本輸出。
文本生成圖像
Transformers

G
google
2.1M
347
Blip Vqa Base
Bsd-3-clause
BLIP是一個統一的視覺語言預訓練框架,擅長視覺問答任務,通過語言-圖像聯合訓練實現多模態理解與生成能力
文本生成圖像
Transformers

B
Salesforce
1.9M
154
CLIP ViT H 14 Laion2b S32b B79k
MIT
基於OpenCLIP框架在LAION-2B英文數據集上訓練的視覺-語言模型,支持零樣本圖像分類和跨模態檢索任務
文本生成圖像
Safetensors
C
laion
1.8M
368
CLIP ViT B 32 Laion2b S34b B79k
MIT
基於OpenCLIP框架在LAION-2B英語子集上訓練的視覺-語言模型,支持零樣本圖像分類和跨模態檢索
文本生成圖像
Safetensors
C
laion
1.1M
112
Pickscore V1
PickScore v1 是一個針對文本生成圖像的評分函數,可用於預測人類偏好、評估模型性能和圖像排序等任務。
文本生成圖像
Transformers

P
yuvalkirstain
1.1M
44
Owlv2 Base Patch16 Ensemble
Apache-2.0
OWLv2是一種零樣本文本條件目標檢測模型,可通過文本查詢在圖像中定位對象。
文本生成圖像
Transformers

O
google
932.80k
99
Llama 3.2 11B Vision Instruct
Llama 3.2 是 Meta 發佈的多語言多模態大型語言模型,支持圖像文本到文本的轉換任務,具備強大的跨模態理解能力。
文本生成圖像
Transformers 支持多種語言

L
meta-llama
784.19k
1,424
Owlvit Base Patch32
Apache-2.0
OWL-ViT是一個零樣本文本條件目標檢測模型,可以通過文本查詢搜索圖像中的對象,無需特定類別的訓練數據。
文本生成圖像
Transformers

O
google
764.95k
129
精選推薦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