Commit
β’
d727650
1
Parent(s):
52235c2
Update README.md
Browse files
README.md
CHANGED
@@ -7,8 +7,6 @@ pipeline_tag: image-text-to-text
|
|
7 |
|
8 |
# LLaVA-NeXT-Video Model Card
|
9 |
|
10 |
-
Below is the model card of LLaVa-NeXT-Video model 7b, which is copied from the original Llava model card that you can find [here](https://huggingface.co/liuhaotian/llava-v1.5-13b).
|
11 |
-
|
12 |
Check out also the Google Colab demo to run Llava on a free-tier Google Colab instance: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1CZggLHrjxMReG-FNOmqSOdi4z7NPq6SO?usp=sharing)
|
13 |
|
14 |
Disclaimer: The team releasing LLaVa-NeXT-Video did not write a model card for this model so this model card has been written by the Hugging Face team.
|
@@ -16,21 +14,17 @@ Disclaimer: The team releasing LLaVa-NeXT-Video did not write a model card for t
|
|
16 |
## π Model details
|
17 |
|
18 |
**Model type:**
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
Base LLM: lmsys/vicuna-7b-v1.5
|
23 |
|
24 |
<img src="http://drive.google.com/uc?export=view&id=1fVg-r5MU3NoHlTpD7_lYPEBWH9R8na_4">
|
25 |
|
26 |
|
27 |
**Model date:**
|
28 |
-
<br>
|
29 |
LLaVA-Next-Video-7B was trained in April 2024.
|
30 |
|
31 |
-
**Paper or resources for more information:**
|
32 |
-
<br>
|
33 |
-
https://github.com/LLaVA-VL/LLaVA-NeXT
|
34 |
|
35 |
|
36 |
## π Training dataset
|
@@ -92,7 +86,22 @@ def read_video_pyav(container, indices):
|
|
92 |
frames.append(frame)
|
93 |
return np.stack([x.to_ndarray(format="rgb24") for x in frames])
|
94 |
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
video_path = hf_hub_download(repo_id="raushan-testing-hf/videos-test", filename="sample_demo_1.mp4", repo_type="dataset")
|
97 |
container = av.open(video_path)
|
98 |
|
@@ -129,11 +138,28 @@ print(processor.decode(output[0][2:], skip_special_tokens=True))
|
|
129 |
To generate from images and videos in one generate use the below code after loading the model as shown above:
|
130 |
|
131 |
```python
|
132 |
-
|
133 |
-
|
134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
]
|
136 |
-
|
|
|
|
|
|
|
137 |
|
138 |
# Generate
|
139 |
generate_ids = model.generate(**inputs, max_new_tokens=100)
|
@@ -174,15 +200,6 @@ model = LlavaNextVideoForConditionalGeneration.from_pretrained(
|
|
174 |
Llama 2 is licensed under the LLAMA 2 Community License,
|
175 |
Copyright (c) Meta Platforms, Inc. All Rights Reserved.
|
176 |
|
177 |
-
## π― Intended use
|
178 |
-
**Primary intended uses:**
|
179 |
-
<br>
|
180 |
-
The primary use of LLaVA is research on large multimodal models and chatbots.
|
181 |
-
|
182 |
-
**Primary intended users:**
|
183 |
-
<br>
|
184 |
-
The primary intended users of the model are researchers and hobbyists in computer vision, natural language processing, machine learning, and artificial intelligence.
|
185 |
-
|
186 |
|
187 |
## βοΈ Citation
|
188 |
If you find our paper and code useful in your research:
|
|
|
7 |
|
8 |
# LLaVA-NeXT-Video Model Card
|
9 |
|
|
|
|
|
10 |
Check out also the Google Colab demo to run Llava on a free-tier Google Colab instance: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1CZggLHrjxMReG-FNOmqSOdi4z7NPq6SO?usp=sharing)
|
11 |
|
12 |
Disclaimer: The team releasing LLaVa-NeXT-Video did not write a model card for this model so this model card has been written by the Hugging Face team.
|
|
|
14 |
## π Model details
|
15 |
|
16 |
**Model type:**
|
17 |
+
LLaVA-Next-Video is an open-source chatbot trained by fine-tuning LLM on multimodal instruction-following data. The model is buit on top of LLaVa-NeXT by tuning on a mix of video and image data to achieves better video understanding capabilities. The videos were sampled uniformly to be 32 frames per clip.
|
18 |
+
The model is a current SOTA among open-source models on [VideoMME bench](https://arxiv.org/abs/2405.21075).
|
19 |
+
Base LLM: [lmsys/vicuna-7b-v1.5](https://huggingface.co/lmsys/vicuna-13b-v1.5)
|
|
|
20 |
|
21 |
<img src="http://drive.google.com/uc?export=view&id=1fVg-r5MU3NoHlTpD7_lYPEBWH9R8na_4">
|
22 |
|
23 |
|
24 |
**Model date:**
|
|
|
25 |
LLaVA-Next-Video-7B was trained in April 2024.
|
26 |
|
27 |
+
**Paper or resources for more information:** https://github.com/LLaVA-VL/LLaVA-NeXT
|
|
|
|
|
28 |
|
29 |
|
30 |
## π Training dataset
|
|
|
86 |
frames.append(frame)
|
87 |
return np.stack([x.to_ndarray(format="rgb24") for x in frames])
|
88 |
|
89 |
+
|
90 |
+
# define a chat histiry and use `apply_chat_template` to get correctly formatted prompt
|
91 |
+
# Each value in "content" has to be a list of dicts with types ("text", "image", "video")
|
92 |
+
conversation = [
|
93 |
+
{
|
94 |
+
|
95 |
+
"role": "user",
|
96 |
+
"content": [
|
97 |
+
{"type": "text", "text": "Why is this video funny?"},
|
98 |
+
{"type": "video"},
|
99 |
+
],
|
100 |
+
},
|
101 |
+
]
|
102 |
+
|
103 |
+
prompt = processor.apply_chat_template(conversation, add_generation_prompt=True)
|
104 |
+
|
105 |
video_path = hf_hub_download(repo_id="raushan-testing-hf/videos-test", filename="sample_demo_1.mp4", repo_type="dataset")
|
106 |
container = av.open(video_path)
|
107 |
|
|
|
138 |
To generate from images and videos in one generate use the below code after loading the model as shown above:
|
139 |
|
140 |
```python
|
141 |
+
conversation_1 = [
|
142 |
+
{
|
143 |
+
"role": "user",
|
144 |
+
"content": [
|
145 |
+
{"type": "text", "text": "What's the content of the image"},
|
146 |
+
{"type": "image"},
|
147 |
+
],
|
148 |
+
}
|
149 |
+
]
|
150 |
+
conversation_2 = [
|
151 |
+
{
|
152 |
+
"role": "user",
|
153 |
+
"content": [
|
154 |
+
{"type": "text", "text": "Why is this video funny?"},
|
155 |
+
{"type": "video"},
|
156 |
+
],
|
157 |
+
},
|
158 |
]
|
159 |
+
prompt_1 = processor.apply_chat_template(conversation, add_generation_prompt=True)
|
160 |
+
prompt_2 = processor.apply_chat_template(conversation, add_generation_prompt=True)
|
161 |
+
|
162 |
+
s = processor(text=[prompt_1, prompt_2], images=image, videos=clip, padding=True, return_tensors="pt").to(model.device)
|
163 |
|
164 |
# Generate
|
165 |
generate_ids = model.generate(**inputs, max_new_tokens=100)
|
|
|
200 |
Llama 2 is licensed under the LLAMA 2 Community License,
|
201 |
Copyright (c) Meta Platforms, Inc. All Rights Reserved.
|
202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
|
204 |
## βοΈ Citation
|
205 |
If you find our paper and code useful in your research:
|