Image-Text-to-Text
Transformers
Safetensors
multilingual
eagle_2_5_vl
feature-extraction
eagle
VLM
conversational
custom_code
Instructions to use nvidia/Eagle2-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nvidia/Eagle2-1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="nvidia/Eagle2-1B", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("nvidia/Eagle2-1B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nvidia/Eagle2-1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nvidia/Eagle2-1B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nvidia/Eagle2-1B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/nvidia/Eagle2-1B
- SGLang
How to use nvidia/Eagle2-1B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "nvidia/Eagle2-1B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nvidia/Eagle2-1B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "nvidia/Eagle2-1B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nvidia/Eagle2-1B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use nvidia/Eagle2-1B with Docker Model Runner:
docker model run hf.co/nvidia/Eagle2-1B
update
Browse files
README.md
CHANGED
|
@@ -42,7 +42,6 @@ We provide the following models:
|
|
| 42 |
| Eagle2-1B | [Qwen2.5-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct) | Siglip | 16K| [🤗 link](https://huggingface.co/NVIDIA/Eagle2-1B)|
|
| 43 |
| Eagle2-2B | [Qwen2.5-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct) | Siglip | 16K| [🤗 link](https://huggingface.co/NVIDIA/Eagle2-2B)|
|
| 44 |
| Eagle2-9B | [Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) | Siglip+ConvNext | 16K| [🤗 link](https://huggingface.co/NVIDIA/Eagle2-9B)|
|
| 45 |
-
| Eagle2-32B | [Qwen2.5-32B-Instruct](https://huggingface.co/Qwen/Qwen2.5-32B-Instruct) | Siglip+ConvNext | 16K| [🤗 link](https://huggingface.co/NVIDIA/Eagle2-32B)|
|
| 46 |
|
| 47 |
## Benchmark Results
|
| 48 |
| Benchmark | LLaVa-One-Vision-0.5B | InternVL2-1B | InternVL2.5-1B |Qwen2-VL-2B| Eagle2-1B|
|
|
|
|
| 42 |
| Eagle2-1B | [Qwen2.5-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct) | Siglip | 16K| [🤗 link](https://huggingface.co/NVIDIA/Eagle2-1B)|
|
| 43 |
| Eagle2-2B | [Qwen2.5-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct) | Siglip | 16K| [🤗 link](https://huggingface.co/NVIDIA/Eagle2-2B)|
|
| 44 |
| Eagle2-9B | [Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) | Siglip+ConvNext | 16K| [🤗 link](https://huggingface.co/NVIDIA/Eagle2-9B)|
|
|
|
|
| 45 |
|
| 46 |
## Benchmark Results
|
| 47 |
| Benchmark | LLaVa-One-Vision-0.5B | InternVL2-1B | InternVL2.5-1B |Qwen2-VL-2B| Eagle2-1B|
|
configuration_eagle_chat.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# --------------------------------------------------------
|
| 2 |
# Eagle2
|
| 3 |
# Copyright (c) 2025 NVIDIA
|
| 4 |
-
# Licensed under The
|
| 5 |
# --------------------------------------------------------
|
| 6 |
|
| 7 |
import copy
|
|
|
|
| 1 |
# --------------------------------------------------------
|
| 2 |
# Eagle2
|
| 3 |
# Copyright (c) 2025 NVIDIA
|
| 4 |
+
# Licensed under The Apache License [see LICENSE for details]
|
| 5 |
# --------------------------------------------------------
|
| 6 |
|
| 7 |
import copy
|
configuration_multi_backbone_channel_concatentation_model.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# --------------------------------------------------------
|
| 2 |
# Eagle2
|
| 3 |
# Copyright (c) 2025 NVIDIA
|
| 4 |
-
# Licensed under The
|
| 5 |
# --------------------------------------------------------
|
| 6 |
|
| 7 |
import os
|
|
|
|
| 1 |
# --------------------------------------------------------
|
| 2 |
# Eagle2
|
| 3 |
# Copyright (c) 2025 NVIDIA
|
| 4 |
+
# Licensed under The Apache License [see LICENSE for details]
|
| 5 |
# --------------------------------------------------------
|
| 6 |
|
| 7 |
import os
|
modeling_eagle_chat.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# --------------------------------------------------------
|
| 2 |
# Eagle2
|
| 3 |
# Copyright (c) 2025 NVIDIA
|
| 4 |
-
# Licensed under The
|
| 5 |
# --------------------------------------------------------
|
| 6 |
|
| 7 |
import warnings
|
|
|
|
| 1 |
# --------------------------------------------------------
|
| 2 |
# Eagle2
|
| 3 |
# Copyright (c) 2025 NVIDIA
|
| 4 |
+
# Licensed under The Apache License [see LICENSE for details]
|
| 5 |
# --------------------------------------------------------
|
| 6 |
|
| 7 |
import warnings
|
modeling_siglip.py
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# coding=utf-8
|
| 2 |
# Copyright 2024 Google AI and The HuggingFace Team. All rights reserved.
|
| 3 |
#
|
|
@@ -374,6 +382,10 @@ class SiglipAttention(nn.Module):
|
|
| 374 |
"""Input shape: Batch x Time x Channel"""
|
| 375 |
if self.use_flash_attn:
|
| 376 |
return self._flash_attn(hidden_states)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 377 |
batch_size, q_len, _ = hidden_states.size()
|
| 378 |
|
| 379 |
query_states = self.q_proj(hidden_states)
|
|
|
|
| 1 |
+
# --------------------------------------------------------
|
| 2 |
+
# Eagle2
|
| 3 |
+
# Copyright (c) 2025 NVIDIA
|
| 4 |
+
# Licensed under The MIT License [see LICENSE for details]
|
| 5 |
+
# Support flash-attention in SigLIP
|
| 6 |
+
# --------------------------------------------------------
|
| 7 |
+
|
| 8 |
+
|
| 9 |
# coding=utf-8
|
| 10 |
# Copyright 2024 Google AI and The HuggingFace Team. All rights reserved.
|
| 11 |
#
|
|
|
|
| 382 |
"""Input shape: Batch x Time x Channel"""
|
| 383 |
if self.use_flash_attn:
|
| 384 |
return self._flash_attn(hidden_states)
|
| 385 |
+
else:
|
| 386 |
+
return self._vanilla_attn(hidden_states, attention_mask, output_attentions)
|
| 387 |
+
|
| 388 |
+
def _vanilla_attn(self, hidden_states, attention_mask=None, output_attentions=False):
|
| 389 |
batch_size, q_len, _ = hidden_states.size()
|
| 390 |
|
| 391 |
query_states = self.q_proj(hidden_states)
|
multi_backbone_channel_concatenation_encoder.py
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import torch, os
|
| 2 |
import torch.nn as nn
|
| 3 |
from torch.utils.checkpoint import checkpoint
|
| 4 |
|
| 5 |
from .siglip_vision_tower import SiglipVisionTower
|
| 6 |
|
| 7 |
-
# from .hr_clip_encoder import HRCLIPVisionTower
|
| 8 |
-
# from .eva_vit import EVAVITVisionTower
|
| 9 |
-
# from .SAM.modeling_sam import SAMVisionTower
|
| 10 |
-
# from .pix2struct_large import Pix2StructLargeVisionTower
|
| 11 |
import torch.nn.functional as F
|
| 12 |
from torch.nn.init import trunc_normal_
|
| 13 |
from copy import deepcopy
|
|
|
|
| 1 |
+
# --------------------------------------------------------
|
| 2 |
+
# Eagle2
|
| 3 |
+
# Copyright (c) 2025 NVIDIA
|
| 4 |
+
# Licensed under The Apache License [see LICENSE for details]
|
| 5 |
+
# --------------------------------------------------------
|
| 6 |
+
|
| 7 |
import torch, os
|
| 8 |
import torch.nn as nn
|
| 9 |
from torch.utils.checkpoint import checkpoint
|
| 10 |
|
| 11 |
from .siglip_vision_tower import SiglipVisionTower
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
import torch.nn.functional as F
|
| 14 |
from torch.nn.init import trunc_normal_
|
| 15 |
from copy import deepcopy
|
multi_backbone_channel_concatentation_model.py
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import torch.nn as nn
|
| 2 |
|
| 3 |
from transformers.modeling_outputs import BaseModelOutputWithPooling
|
|
|
|
| 1 |
+
# --------------------------------------------------------
|
| 2 |
+
# Eagle2
|
| 3 |
+
# Copyright (c) 2025 NVIDIA
|
| 4 |
+
# Licensed under The Apache License [see LICENSE for details]
|
| 5 |
+
# --------------------------------------------------------
|
| 6 |
+
|
| 7 |
+
|
| 8 |
import torch.nn as nn
|
| 9 |
|
| 10 |
from transformers.modeling_outputs import BaseModelOutputWithPooling
|