Update README.md
Browse files
README.md
CHANGED
@@ -1,199 +1,112 @@
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
-
tags:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
---
|
5 |
|
6 |
-
# Model Card for Model ID
|
7 |
|
8 |
-
|
|
|
|
|
9 |
|
10 |
|
|
|
11 |
|
12 |
-
|
13 |
|
14 |
-
### Model Description
|
15 |
|
16 |
-
|
|
|
17 |
|
18 |
-
|
19 |
|
20 |
-
-
|
21 |
-
- **Funded by [optional]:** [More Information Needed]
|
22 |
-
- **Shared by [optional]:** [More Information Needed]
|
23 |
-
- **Model type:** [More Information Needed]
|
24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
25 |
-
- **License:** [More Information Needed]
|
26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
27 |
|
28 |
-
|
29 |
|
30 |
-
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
- **
|
|
|
|
|
35 |
|
36 |
-
|
37 |
|
38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
39 |
|
40 |
-
### Direct Use
|
41 |
|
42 |
-
|
|
|
|
|
|
|
43 |
|
44 |
-
|
45 |
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
-
### Out-of-Scope Use
|
53 |
|
54 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
55 |
|
56 |
-
|
57 |
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
## How to Get Started with the Model
|
71 |
-
|
72 |
-
Use the code below to get started with the model.
|
73 |
-
|
74 |
-
[More Information Needed]
|
75 |
-
|
76 |
-
## Training Details
|
77 |
-
|
78 |
-
### Training Data
|
79 |
-
|
80 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
81 |
-
|
82 |
-
[More Information Needed]
|
83 |
-
|
84 |
-
### Training Procedure
|
85 |
-
|
86 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
87 |
-
|
88 |
-
#### Preprocessing [optional]
|
89 |
-
|
90 |
-
[More Information Needed]
|
91 |
-
|
92 |
-
|
93 |
-
#### Training Hyperparameters
|
94 |
-
|
95 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
96 |
-
|
97 |
-
#### Speeds, Sizes, Times [optional]
|
98 |
-
|
99 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
100 |
-
|
101 |
-
[More Information Needed]
|
102 |
-
|
103 |
-
## Evaluation
|
104 |
-
|
105 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
106 |
-
|
107 |
-
### Testing Data, Factors & Metrics
|
108 |
-
|
109 |
-
#### Testing Data
|
110 |
-
|
111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
112 |
-
|
113 |
-
[More Information Needed]
|
114 |
-
|
115 |
-
#### Factors
|
116 |
-
|
117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
118 |
-
|
119 |
-
[More Information Needed]
|
120 |
-
|
121 |
-
#### Metrics
|
122 |
-
|
123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
124 |
-
|
125 |
-
[More Information Needed]
|
126 |
-
|
127 |
-
### Results
|
128 |
-
|
129 |
-
[More Information Needed]
|
130 |
-
|
131 |
-
#### Summary
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
## Model Examination [optional]
|
136 |
-
|
137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
138 |
-
|
139 |
-
[More Information Needed]
|
140 |
-
|
141 |
-
## Environmental Impact
|
142 |
-
|
143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
144 |
-
|
145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
146 |
-
|
147 |
-
- **Hardware Type:** [More Information Needed]
|
148 |
-
- **Hours used:** [More Information Needed]
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
-
|
153 |
-
## Technical Specifications [optional]
|
154 |
-
|
155 |
-
### Model Architecture and Objective
|
156 |
-
|
157 |
-
[More Information Needed]
|
158 |
-
|
159 |
-
### Compute Infrastructure
|
160 |
-
|
161 |
-
[More Information Needed]
|
162 |
-
|
163 |
-
#### Hardware
|
164 |
-
|
165 |
-
[More Information Needed]
|
166 |
-
|
167 |
-
#### Software
|
168 |
-
|
169 |
-
[More Information Needed]
|
170 |
-
|
171 |
-
## Citation [optional]
|
172 |
-
|
173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
174 |
-
|
175 |
-
**BibTeX:**
|
176 |
-
|
177 |
-
[More Information Needed]
|
178 |
-
|
179 |
-
**APA:**
|
180 |
-
|
181 |
-
[More Information Needed]
|
182 |
-
|
183 |
-
## Glossary [optional]
|
184 |
-
|
185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
186 |
-
|
187 |
-
[More Information Needed]
|
188 |
-
|
189 |
-
## More Information [optional]
|
190 |
-
|
191 |
-
[More Information Needed]
|
192 |
-
|
193 |
-
## Model Card Authors [optional]
|
194 |
-
|
195 |
-
[More Information Needed]
|
196 |
-
|
197 |
-
## Model Card Contact
|
198 |
-
|
199 |
-
[More Information Needed]
|
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
+
tags:
|
4 |
+
- visual-encoder
|
5 |
+
- multi-modal-large-language-model
|
6 |
+
license: apache-2.0
|
7 |
+
language:
|
8 |
+
- en
|
9 |
+
base_model:
|
10 |
+
- google/siglip-so400m-patch14-384
|
11 |
+
pipeline_tag: image-feature-extraction
|
12 |
---
|
13 |
|
|
|
14 |
|
15 |
+
<p align="center">
|
16 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/626938b16f8f86ad21deb989/543Eaf__U-a9Z72LPGWgC.png" width="150" style="margin-bottom: 0.2;"/>
|
17 |
+
<p>
|
18 |
|
19 |
|
20 |
+
<h3 align="center"><a href="https://arxiv.org/abs/2501.13106">VideoLLaMA 3: Frontier Multimodal Foundation Models for Video Understanding</a></h3>
|
21 |
|
22 |
+
<h5 align="center"> If you like our project, please give us a star ⭐ on <a href="https://github.com/DAMO-NLP-SG/VideoLLaMA3">Github</a> for the latest update. </h5>
|
23 |
|
|
|
24 |
|
25 |
+
## 🌟 Introduction
|
26 |
+
This model serves as the visual encoder in VideoLLaMA3.
|
27 |
|
28 |
+
VideoLLaMA3 leverages the Any-resolution Vision Tokenization (AVT) approach to dynamically process images and videos of varying resolutions. This is accomplished by adapting the pre-trained vision encoder (based on ViT architecture) to use 2D-RoPE (Rotary Position Embeddings), replacing the absolute position embeddings traditionally used in ViT.
|
29 |
|
30 |
+
With AVT, VideoLLaMA3 is able to represent images and videos with greater detail across different resolutions, enriching the vision tokens with more information. To ensure seamless integration with AVT, we fine-tune both the vision encoder and the projector during the Vision Encoder Adaptation stage (Stage #1 in the VideoLLaMA3 training pipeline) using scene images, document data, and scene images with text.
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
+
Before training, the model parameters and architecture are initialized from [SigLip](https://huggingface.co/google/siglip-so400m-patch14-384).
|
33 |
|
34 |
+
## 🚀 Model Porfermance
|
35 |
|
36 |
+
| Model | GQA | AI2D | ChartQA | DocVQA<sub>val</sub> | MME |
|
37 |
+
|---------------------------------|------------|------------|-------------|--------------------------|------------|
|
38 |
+
| clip-vit-large-patch14-336 | 61.50 | 56.28 | 18.32 | 24.86 | **1668.41**|
|
39 |
+
| dfn5B-clip-vit-h-14-378 | 62.70 | 56.87 | 16.40 | 23.09 | 1665.35 |
|
40 |
+
| siglip-so400m-patch14-384 | **62.92** | **57.12** | **22.44** | **31.32** | 1667.92 |
|
41 |
|
42 |
+
* A more detailed analysis can be found in our [paper](https://arxiv.org/abs/2501.13106).
|
43 |
|
|
|
44 |
|
|
|
45 |
|
46 |
+
## 🤖 Quick Start
|
47 |
+
```python
|
48 |
+
import torch
|
49 |
+
from transformers import AutoModelForCausalLM, AutoProcessor, AutoModel, AutoImageProcessor
|
50 |
|
51 |
+
model_name = "DAMO-NLP-SG/VL3-SigLIP-NaViT"
|
52 |
|
53 |
+
model = AutoModelForCausalLM.from_pretrained(
|
54 |
+
model_name,
|
55 |
+
trust_remote_code=True,
|
56 |
+
device_map="auto",
|
57 |
+
torch_dtype=torch.bfloat16,
|
58 |
+
attn_implementation="flash_attention_2",
|
59 |
+
)
|
60 |
+
processor = AutoProcessor.from_pretrained(model_name, trust_remote_code=True)
|
61 |
|
62 |
+
# Video conversation
|
63 |
+
conversation = [
|
64 |
+
{"role": "system", "content": "You are a helpful assistant."},
|
65 |
+
{
|
66 |
+
"role": "user",
|
67 |
+
"content": [
|
68 |
+
{"type": "video", "data": {"video_path": "https://github.com/DAMO-NLP-SG/VideoLLaMA3/raw/refs/heads/main/assets/cat_and_chicken.mp4", "fps": 1, "max_frames": 128}},
|
69 |
+
{"type": "text", "data": "What is the cat doing?"},
|
70 |
+
]
|
71 |
+
},
|
72 |
+
]
|
73 |
|
74 |
+
inputs = processor(conversation=conversation, return_tensors="pt")
|
75 |
+
inputs = {k: v.cuda() if isinstance(v, torch.Tensor) else v for k, v in inputs.items()}
|
76 |
+
if "pixel_values" in inputs:
|
77 |
+
inputs["pixel_values"] = inputs["pixel_values"].to(torch.bfloat16)
|
78 |
+
output_ids = model.generate(**inputs, max_new_tokens=128)
|
79 |
+
response = processor.batch_decode(output_ids, skip_special_tokens=True)[0].strip()
|
80 |
+
print(response)
|
81 |
+
```
|
82 |
|
|
|
83 |
|
|
|
84 |
|
85 |
+
## Citation
|
86 |
|
87 |
+
If you find VideoLLaMA useful for your research and applications, please cite using this BibTeX:
|
88 |
+
```bibtex
|
89 |
+
@article{damonlpsg2025videollama3,
|
90 |
+
title={VideoLLaMA 3: Frontier Multimodal Foundation Models for Image and Video Understanding},
|
91 |
+
author={Boqiang Zhang, Kehan Li, Zesen Cheng, Zhiqiang Hu, Yuqian Yuan, Guanzheng Chen, Sicong Leng, Yuming Jiang, Hang Zhang, Xin Li, Peng Jin, Wenqi Zhang, Fan Wang, Lidong Bing, Deli Zhao},
|
92 |
+
journal={arXiv preprint arXiv:2501.xxxxx},
|
93 |
+
year={2025},
|
94 |
+
url = {https://arxiv.org/abs/2501.xxxxx}
|
95 |
+
}
|
96 |
|
97 |
+
@article{damonlpsg2024videollama2,
|
98 |
+
title={VideoLLaMA 2: Advancing Spatial-Temporal Modeling and Audio Understanding in Video-LLMs},
|
99 |
+
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},
|
100 |
+
journal={arXiv preprint arXiv:2406.07476},
|
101 |
+
year={2024},
|
102 |
+
url = {https://arxiv.org/abs/2406.07476}
|
103 |
+
}
|
104 |
|
105 |
+
@article{damonlpsg2023videollama,
|
106 |
+
title = {Video-LLaMA: An Instruction-tuned Audio-Visual Language Model for Video Understanding},
|
107 |
+
author = {Zhang, Hang and Li, Xin and Bing, Lidong},
|
108 |
+
journal = {arXiv preprint arXiv:2306.02858},
|
109 |
+
year = {2023},
|
110 |
+
url = {https://arxiv.org/abs/2306.02858}
|
111 |
+
}
|
112 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|