Visual Question Answering
Transformers
English
videollama2_qwen2
text-generation
multimodal large language model
large video-language model
Inference Endpoints
Siheng99 commited on
Commit
3195661
·
1 Parent(s): 4e2c694

Upload projector model files.

Browse files
Files changed (4) hide show
  1. README.md +113 -0
  2. config.json +41 -0
  3. mm_projector.bin +3 -0
  4. trainer_state.json +0 -0
README.md CHANGED
@@ -1,3 +1,116 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ datasets:
4
+ - OpenGVLab/VideoChat2-IT
5
+ - Lin-Chen/ShareGPT4V
6
+ - liuhaotian/LLaVA-Instruct-150K
7
+ language:
8
+ - en
9
+ metrics:
10
+ - accuracy
11
+ library_name: transformers
12
+ pipeline_tag: visual-question-answering
13
+ tags:
14
+ - multimodal large language model
15
+ - large video-language model
16
  ---
17
+
18
+ <p align="center">
19
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/63913b120cf6b11c487ca31d/ROs4bHIp4zJ7g7vzgUycu.png" width="150" style="margin-bottom: 0.2;"/>
20
+ <p>
21
+
22
+
23
+ <h3 align="center"><a href="https://arxiv.org/abs/2406.07476">VideoLLaMA 2: Advancing Spatial-Temporal Modeling and Audio Understanding in Video-LLMs</a></h3>
24
+ <h5 align="center"> If you like our project, please give us a star ⭐ on <a href="https://github.com/DAMO-NLP-SG/VideoLLaMA2">Github</a> for the latest update. </h2>
25
+
26
+ <p align="center"><video src="https://cdn-uploads.huggingface.co/production/uploads/63913b120cf6b11c487ca31d/Wj7GuqQ0CB9JRoPo6_GoH.webm" width="800"></p>
27
+
28
+ ## 📰 News
29
+ * **[2024.08.14]** Release checkpoints of [VideoLLaMA2-72B-Base](https://huggingface.co/DAMO-NLP-SG/VideoLLaMA2-72B-Base) and [VideoLLaMA2-72B](https://huggingface.co/DAMO-NLP-SG/VideoLLaMA2-72B)
30
+ * **[2024.07.30]** Release checkpoints of [VideoLLaMA2-8x7B-Base](https://huggingface.co/DAMO-NLP-SG/VideoLLaMA2-8x7B-Base) and [VideoLLaMA2-8x7B](https://huggingface.co/DAMO-NLP-SG/VideoLLaMA2-8x7B).
31
+ * **[2024.06.25]** 🔥🔥 As of Jun 25, our [VideoLLaMA2-7B-16F](https://huggingface.co/DAMO-NLP-SG/VideoLLaMA2-7B-16F) is the **Top-1** ~7B-sized VideoLLM on the [MLVU Leaderboard](https://github.com/JUNJIE99/MLVU?tab=readme-ov-file#trophy-mini-leaderboard).
32
+ * **[2024.06.18]** 🔥🔥 As of Jun 18, our [VideoLLaMA2-7B-16F](https://huggingface.co/DAMO-NLP-SG/VideoLLaMA2-7B-16F) is the **Top-1** ~7B-sized VideoLLM on the [VideoMME Leaderboard](https://video-mme.github.io/home_page.html#leaderboard).
33
+ * **[2024.06.17]** 👋👋 Update technical report with the latest results and the missing references. If you have works closely related to VideoLLaMA 2 but not mentioned in the paper, feel free to let us know.
34
+ * **[2024.06.14]** 🔥🔥 [Online Demo](https://huggingface.co/spaces/lixin4ever/VideoLLaMA2) is available.
35
+ * **[2024.06.03]** Release training, evaluation, and serving codes of VideoLLaMA 2.
36
+
37
+
38
+ ## 🌎 Model Zoo
39
+ | Model Name | Type | Visual Encoder | Language Decoder | # Training Frames |
40
+ |:-------------------|:--------------:|:----------------|:------------------|:----------------------:|
41
+ | [VideoLLaMA2-7B-Base](https://huggingface.co/DAMO-NLP-SG/VideoLLaMA2-7B-Base) | Base | [clip-vit-large-patch14-336](https://huggingface.co/openai/clip-vit-large-patch14-336) | [Mistral-7B-Instruct-v0.2](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2) | 8 |
42
+ | [VideoLLaMA2-7B](https://huggingface.co/DAMO-NLP-SG/VideoLLaMA2-7B) | Chat | [clip-vit-large-patch14-336](https://huggingface.co/openai/clip-vit-large-patch14-336) | [Mistral-7B-Instruct-v0.2](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2) | 8 |
43
+ | [VideoLLaMA2-7B-16F-Base](https://huggingface.co/DAMO-NLP-SG/VideoLLaMA2-7B-16F-Base) | Base | [clip-vit-large-patch14-336](https://huggingface.co/openai/clip-vit-large-patch14-336) | [Mistral-7B-Instruct-v0.2](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2) | 16 |
44
+ | [VideoLLaMA2-7B-16F](https://huggingface.co/DAMO-NLP-SG/VideoLLaMA2-7B-16F) | Chat | [clip-vit-large-patch14-336](https://huggingface.co/openai/clip-vit-large-patch14-336) | [Mistral-7B-Instruct-v0.2](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2) | 16 |
45
+ | [VideoLLaMA2-8x7B-Base](https://huggingface.co/DAMO-NLP-SG/VideoLLaMA2-8x7B-Base) | Base | [clip-vit-large-patch14-336](https://huggingface.co/openai/clip-vit-large-patch14-336) | [Mixtral-8x7B-Instruct-v0.1](https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1) | 8 |
46
+ | [VideoLLaMA2-8x7B](https://huggingface.co/DAMO-NLP-SG/VideoLLaMA2-8x7B) | Chat | [clip-vit-large-patch14-336](https://huggingface.co/openai/clip-vit-large-patch14-336) | [Mixtral-8x7B-Instruct-v0.1](https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1) | 8 |
47
+ | [VideoLLaMA2-72B-Base](https://huggingface.co/DAMO-NLP-SG/VideoLLaMA2-72B-Base) | Base | [clip-vit-large-patch14-336](https://huggingface.co/openai/clip-vit-large-patch14-336) | [Qwen2-72B-Instruct](https://huggingface.co/Qwen/Qwen2-72B-Instruct) | 8 |
48
+ | [VideoLLaMA2-72B](https://huggingface.co/DAMO-NLP-SG/VideoLLaMA2-72B) | Chat | [clip-vit-large-patch14-336](https://huggingface.co/openai/clip-vit-large-patch14-336) | [Qwen2-72B-Instruct](https://huggingface.co/Qwen/Qwen2-72B-Instruct) | 8 |
49
+ | [VideoLLaMA2.1-7B-16F-Base](https://huggingface.co/DAMO-NLP-SG/VideoLLaMA2.1-7B-16F-Base) (**This Checkpoint**) | Base | [siglip-so400m-patch14-384](https://huggingface.co/google/siglip-so400m-patch14-384) | [Qwen2-7B-Instruct](https://huggingface.co/Qwen/Qwen2-7B-Instruct) | 16 |
50
+ | [VideoLLaMA2.1-7B-16F](https://huggingface.co/DAMO-NLP-SG/VideoLLaMA2.1-7B-16F) | Chat | [siglip-so400m-patch14-384](https://huggingface.co/google/siglip-so400m-patch14-384) | [Qwen2-7B-Instruct](https://huggingface.co/Qwen/Qwen2-7B-Instruct) | 16 |
51
+
52
+
53
+ ## 🚀 Main Results
54
+
55
+ ### Multi-Choice Video QA & Video Captioning
56
+ <p><img src="https://github.com/user-attachments/assets/fbe3e3c2-b0f1-4e29-8b92-bc3611192909" width="800" "/></p>
57
+
58
+
59
+ ### Open-Ended Video QA
60
+ <p><img src="https://github.com/user-attachments/assets/cee2efe1-309e-4301-a217-e2a848799953" width="800" "/></p>
61
+
62
+
63
+
64
+
65
+ ## 🤖 Inference with VideoLLaMA2
66
+ ```python
67
+ import sys
68
+ sys.path.append('./')
69
+ from videollama2 import model_init, mm_infer
70
+ from videollama2.utils import disable_torch_init
71
+
72
+
73
+ def inference():
74
+ disable_torch_init()
75
+
76
+ # Video Inference
77
+ modal = 'video'
78
+ modal_path = 'assets/cat_and_chicken.mp4'
79
+ instruct = 'What animals are in the video, what are they doing, and how does the video feel?'
80
+
81
+ # Image Inference
82
+ modal = 'image'
83
+ modal_path = 'assets/sora.png'
84
+ instruct = 'What is the woman wearing, what is she doing, and how does the image feel?'
85
+
86
+ model_path = 'DAMO-NLP-SG/VideoLLaMA2-7B-16F'
87
+ model, processor, tokenizer = model_init(model_path)
88
+ output = mm_infer(processor[modal](modal_path), instruct, model=model, tokenizer=tokenizer, do_sample=False, modal=modal)
89
+
90
+ print(output)
91
+
92
+ if __name__ == "__main__":
93
+ inference()
94
+ ```
95
+
96
+
97
+ ## Citation
98
+
99
+ If you find VideoLLaMA useful for your research and applications, please cite using this BibTeX:
100
+ ```bibtex
101
+ @article{damonlpsg2024videollama2,
102
+ title={VideoLLaMA 2: Advancing Spatial-Temporal Modeling and Audio Understanding in Video-LLMs},
103
+ 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},
104
+ journal={arXiv preprint arXiv:2406.07476},
105
+ year={2024},
106
+ url = {https://arxiv.org/abs/2406.07476}
107
+ }
108
+
109
+ @article{damonlpsg2023videollama,
110
+ title = {Video-LLaMA: An Instruction-tuned Audio-Visual Language Model for Video Understanding},
111
+ author = {Zhang, Hang and Li, Xin and Bing, Lidong},
112
+ journal = {arXiv preprint arXiv:2306.02858},
113
+ year = {2023},
114
+ url = {https://arxiv.org/abs/2306.02858}
115
+ }
116
+ ```
config.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "Qwen/Qwen2-7B-Instruct",
3
+ "architectures": [
4
+ "Qwen2ForCausalLM"
5
+ ],
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 151643,
8
+ "eos_token_id": 151645,
9
+ "freeze_mm_mlp_adapter": false,
10
+ "hidden_act": "silu",
11
+ "hidden_size": 3584,
12
+ "image_aspect_ratio": "square",
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 18944,
15
+ "max_position_embeddings": 32768,
16
+ "max_window_layers": 28,
17
+ "mm_hidden_size": 1152,
18
+ "mm_projector_lr": null,
19
+ "mm_projector_type": "stc_connector_v35",
20
+ "mm_vision_select_feature": "patch",
21
+ "mm_vision_select_layer": -2,
22
+ "mm_vision_tower": "google/siglip-so400m-patch14-384",
23
+ "model_type": "videollama2_qwen2",
24
+ "num_attention_heads": 28,
25
+ "num_frames": 16,
26
+ "num_hidden_layers": 28,
27
+ "num_key_value_heads": 4,
28
+ "rms_norm_eps": 1e-06,
29
+ "rope_theta": 1000000.0,
30
+ "sliding_window": 131072,
31
+ "tie_word_embeddings": false,
32
+ "tokenizer_model_max_length": 2048,
33
+ "tokenizer_padding_side": "right",
34
+ "torch_dtype": "bfloat16",
35
+ "transformers_version": "4.42.3",
36
+ "tune_mm_mlp_adapter": true,
37
+ "use_cache": true,
38
+ "use_mm_proj": true,
39
+ "use_sliding_window": false,
40
+ "vocab_size": 152064
41
+ }
mm_projector.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b284ac55fd84dc60d57281265629b7496bbb030712533a3fdbc0a94d7017c128
3
+ size 753815193
trainer_state.json ADDED
The diff for this file is too large to render. See raw diff