globc commited on
Commit
e40918e
β€’
1 Parent(s): 7b1c7d4
Files changed (1) hide show
  1. README.md +9 -410
README.md CHANGED
@@ -1,410 +1,9 @@
1
- # πŸŒ‹ LLaVA: Large Language and Vision Assistant
2
-
3
- *Visual instruction tuning towards large language and vision models with GPT-4 level capabilities.*
4
-
5
- [[Project Page](https://llava-vl.github.io/)] [[Demo](https://llava.hliu.cc/)] [[Data](https://github.com/haotian-liu/LLaVA/blob/main/docs/Data.md)] [[Model Zoo](https://github.com/haotian-liu/LLaVA/blob/main/docs/MODEL_ZOO.md)]
6
-
7
- 🀝Community Contributions: [[llama.cpp](https://github.com/ggerganov/llama.cpp/pull/3436)] [[Colab](https://github.com/camenduru/LLaVA-colab)] [[πŸ€—Space](https://huggingface.co/spaces/badayvedat/LLaVA)] [[Replicate](https://replicate.com/yorickvp/llava-13b)] [[AutoGen](https://github.com/microsoft/autogen/blob/main/notebook/agentchat_lmm_llava.ipynb)] [[BakLLaVA (LLaVA with Mistral-7B)](https://github.com/SkunkworksAI/BakLLaVA)]
8
-
9
- **Improved Baselines with Visual Instruction Tuning** [[Paper](https://arxiv.org/abs/2310.03744)] <br>
10
- [Haotian Liu](https://hliu.cc), [Chunyuan Li](https://chunyuan.li/), [Yuheng Li](https://yuheng-li.github.io/), [Yong Jae Lee](https://pages.cs.wisc.edu/~yongjaelee/)
11
-
12
- **Visual Instruction Tuning** (NeurIPS 2023, **Oral**) [[Paper](https://arxiv.org/abs/2304.08485)]<br>
13
- [Haotian Liu*](https://hliu.cc), [Chunyuan Li*](https://chunyuan.li/), [Qingyang Wu](https://scholar.google.ca/citations?user=HDiw-TsAAAAJ&hl=en/), [Yong Jae Lee](https://pages.cs.wisc.edu/~yongjaelee/) (*Equal Contribution)
14
-
15
- <!--p align="center">
16
- <a href="https://llava.hliu.cc/"><img src="images/llava_logo.png" width="50%"></a> <br>
17
- Generated by <a href="https://gligen.github.io/">GLIGEN</a> via "a cute lava llama with glasses" and box prompt
18
- </p-->
19
-
20
-
21
- ## Release
22
- - [11/10] [LLaVA-Plus](https://llava-vl.github.io/llava-plus/) is released: Learning to Use Tools for Creating Multimodal Agents, with LLaVA-Plus (LLaVA that Plug and Learn to Use Skills). [[Project Page](https://llava-vl.github.io/llava-plus/)] [[Demo](https://llavaplus.ngrok.io/)] [[Code](https://github.com/LLaVA-VL/LLaVA-Plus-Codebase)] [[Paper](https://arxiv.org/abs/2311.05437)]
23
- - [11/6] Support **Intel** dGPU and CPU platforms. [More details here.](https://github.com/haotian-liu/LLaVA/tree/intel/docs/intel)
24
- - [11/2] [LLaVA-Interactive](https://llava-vl.github.io/llava-interactive/) is released: Experience the future of human-AI multimodal interaction with an all-in-one demo for Image Chat, Segmentation, Generation and Editing. [[Project Page](https://llava-vl.github.io/llava-interactive/)] [[Demo](https://llavainteractive.ngrok.io/)] [[Code](https://github.com/LLaVA-VL/LLaVA-Interactive-Demo)] [[Paper](https://arxiv.org/abs/2311.00571)]
25
- - [10/26] πŸ”₯ LLaVA-1.5 with LoRA achieves comparable performance as full-model finetuning, with a reduced GPU RAM requirement ([ckpts](https://github.com/haotian-liu/LLaVA/blob/main/docs/MODEL_ZOO.md#llava-v15), [script](https://github.com/haotian-liu/LLaVA#train)). We also provide a [doc](https://github.com/haotian-liu/LLaVA/blob/main/docs/Finetune_Custom_Data.md) on how to finetune LLaVA-1.5 on your own dataset with LoRA.
26
- - [10/12] Check out the Korean LLaVA (Ko-LLaVA), created by ETRI, who has generously supported our research! [[πŸ€— Demo](https://huggingface.co/spaces/etri-vilab/Ko-LLaVA)]
27
- - [10/12] LLaVA is now supported in [llama.cpp](https://github.com/ggerganov/llama.cpp/pull/3436) with 4-bit / 5-bit quantization support!
28
- - [10/11] The training data and scripts of LLaVA-1.5 are released [here](https://github.com/haotian-liu/LLaVA#train), and evaluation scripts are released [here](https://github.com/haotian-liu/LLaVA/blob/main/docs/Evaluation.md)!
29
- - [10/10] [Roboflow Deep Dive](https://blog.roboflow.com/first-impressions-with-llava-1-5/): First Impressions with LLaVA-1.5.
30
- - [10/5] πŸ”₯ LLaVA-1.5 is out! Achieving SoTA on 11 benchmarks, with just simple modifications to the original LLaVA, utilizes all public data, completes training in ~1 day on a single 8-A100 node, and surpasses methods like Qwen-VL-Chat that use billion-scale data. Check out the [technical report](https://arxiv.org/abs/2310.03744), and explore the [demo](https://llava.hliu.cc/)! Models are available in [Model Zoo](https://github.com/haotian-liu/LLaVA/blob/main/docs/MODEL_ZOO.md).
31
- - [9/26] LLaVA is improved with reinforcement learning from human feedback (RLHF) to improve fact grounding and reduce hallucination. Check out the new SFT and RLHF checkpoints at project [[LLavA-RLHF]](https://llava-rlhf.github.io/)
32
- - [9/22] [LLaVA](https://arxiv.org/abs/2304.08485) is accepted by NeurIPS 2023 as **oral presentation**, and [LLaVA-Med](https://arxiv.org/abs/2306.00890) is accepted by NeurIPS 2023 Datasets and Benchmarks Track as **spotlight presentation**.
33
- - [9/20] We summarize our empirical study of training 33B and 65B LLaVA models in a [note](https://arxiv.org/abs/2309.09958). Further, if you are interested in the comprehensive review, evolution and trend of multimodal foundation models, please check out our recent survey paper [``Multimodal Foundation Models: From Specialists to General-Purpose Assistants''.](https://arxiv.org/abs/2309.10020)
34
- <p align="center">
35
- <img src="https://github.com/Computer-Vision-in-the-Wild/CVinW_Readings/blob/main/images/mfm_evolution.jpeg?raw=true" width=50%/>
36
- </p>
37
-
38
- - [7/19] πŸ”₯ We release a major upgrade, including support for LLaMA-2, LoRA training, 4-/8-bit inference, higher resolution (336x336), and a lot more. We release [LLaVA Bench](https://github.com/haotian-liu/LLaVA/blob/main/docs/LLaVA_Bench.md) for benchmarking open-ended visual chat with results from Bard and Bing-Chat. We also support and verify training with RTX 3090 and RTX A6000. Check out [LLaVA-from-LLaMA-2](https://github.com/haotian-liu/LLaVA/blob/main/docs/LLaVA_from_LLaMA2.md), and our [model zoo](https://github.com/haotian-liu/LLaVA/blob/main/docs/MODEL_ZOO.md)!
39
- - [6/26] [CVPR 2023 Tutorial](https://vlp-tutorial.github.io/) on **Large Multimodal Models: Towards Building and Surpassing Multimodal GPT-4**! Please check out [[Slides](https://datarelease.blob.core.windows.net/tutorial/vision_foundation_models_2023/slides/Chunyuan_cvpr2023_tutorial_lmm.pdf)] [[Notes](https://arxiv.org/abs/2306.14895)] [[YouTube](https://youtu.be/mkI7EPD1vp8)] [[Bilibli](https://www.bilibili.com/video/BV1Ng4y1T7v3/)].
40
- - [6/11] We released the preview for the most requested feature: DeepSpeed and LoRA support! Please see documentations [here](./docs/LoRA.md).
41
- - [6/1] We released **LLaVA-Med: Large Language and Vision Assistant for Biomedicine**, a step towards building biomedical domain large language and vision models with GPT-4 level capabilities. Checkout the [paper](https://arxiv.org/abs/2306.00890) and [page](https://github.com/microsoft/LLaVA-Med).
42
- - [5/6] We are releasing [LLaVA-Lighting-MPT-7B-preview](https://huggingface.co/liuhaotian/LLaVA-Lightning-MPT-7B-preview), based on MPT-7B-Chat! See [here](#LLaVA-MPT-7b) for more details.
43
- - [5/2] πŸ”₯ We are releasing LLaVA-Lighting! Train a lite, multimodal GPT-4 with just $40 in 3 hours! See [here](#train-llava-lightning) for more details.
44
- - [4/27] Thanks to the community effort, LLaVA-13B with 4-bit quantization allows you to run on a GPU with as few as 12GB VRAM! Try it out [here](https://github.com/oobabooga/text-generation-webui/tree/main/extensions/llava).
45
- - [4/17] πŸ”₯ We released **LLaVA: Large Language and Vision Assistant**. We propose visual instruction tuning, towards building large language and vision models with GPT-4 level capabilities. Checkout the [paper](https://arxiv.org/abs/2304.08485) and [demo](https://llava.hliu.cc/).
46
-
47
- <!-- <a href="https://llava.hliu.cc/"><img src="assets/demo.gif" width="70%"></a> -->
48
-
49
- [![Code License](https://img.shields.io/badge/Code%20License-Apache_2.0-green.svg)](https://github.com/tatsu-lab/stanford_alpaca/blob/main/LICENSE)
50
- [![Data License](https://img.shields.io/badge/Data%20License-CC%20By%20NC%204.0-red.svg)](https://github.com/tatsu-lab/stanford_alpaca/blob/main/DATA_LICENSE)
51
- **Usage and License Notices**: The data and checkpoint is intended and licensed for research use only. They are also restricted to uses that follow the license agreement of LLaMA, Vicuna and GPT-4. The dataset is CC BY NC 4.0 (allowing only non-commercial use) and models trained using the dataset should not be used outside of research purposes.
52
-
53
-
54
- ## Contents
55
- - [Install](#install)
56
- - [LLaVA Weights](#llava-weights)
57
- - [Demo](#Demo)
58
- - [Model Zoo](https://github.com/haotian-liu/LLaVA/blob/main/docs/MODEL_ZOO.md)
59
- - [Dataset](https://github.com/haotian-liu/LLaVA/blob/main/docs/Data.md)
60
- - [Train](#train)
61
- - [Evaluation](#evaluation)
62
-
63
- ## Install
64
-
65
- If you are not using Linux, do *NOT* proceed, see instructions for [macOS](https://github.com/haotian-liu/LLaVA/blob/main/docs/macOS.md) and [Windows](https://github.com/haotian-liu/LLaVA/blob/main/docs/Windows.md).
66
-
67
- 1. Clone this repository and navigate to LLaVA folder
68
- ```bash
69
- git clone https://github.com/haotian-liu/LLaVA.git
70
- cd LLaVA
71
- ```
72
-
73
- 2. Install Package
74
- ```Shell
75
- conda create -n llava python=3.10 -y
76
- conda activate llava
77
- pip install --upgrade pip # enable PEP 660 support
78
- pip install -e .
79
- ```
80
-
81
- 3. Install additional packages for training cases
82
- ```
83
- pip install -e ".[train]"
84
- pip install flash-attn --no-build-isolation
85
- ```
86
-
87
- ### Upgrade to latest code base
88
-
89
- ```Shell
90
- git pull
91
- pip install -e .
92
- ```
93
-
94
- ### Quick Start With HuggingFace
95
-
96
- <details>
97
- <summary>Example Code</summary>
98
-
99
- ```Python
100
- from llava.model.builder import load_pretrained_model
101
- from llava.mm_utils import get_model_name_from_path
102
- from llava.eval.run_llava import eval_model
103
-
104
- model_path = "liuhaotian/llava-v1.5-7b"
105
-
106
- tokenizer, model, image_processor, context_len = load_pretrained_model(
107
- model_path=model_path,
108
- model_base=None,
109
- model_name=get_model_name_from_path(model_path)
110
- )
111
- ```
112
-
113
- Check out the details wth the `load_pretrained_model` function in `llava/model/builder.py`.
114
-
115
- You can also use the `eval_model` function in `llava/eval/run_llava.py` to get the output easily. By doing so, you can use this code on Colab directly after downloading this repository.
116
-
117
- ``` python
118
- model_path = "liuhaotian/llava-v1.5-7b"
119
- prompt = "What are the things I should be cautious about when I visit here?"
120
- image_file = "https://llava-vl.github.io/static/images/view.jpg"
121
-
122
- args = type('Args', (), {
123
- "model_path": model_path,
124
- "model_base": None,
125
- "model_name": get_model_name_from_path(model_path),
126
- "query": prompt,
127
- "conv_mode": None,
128
- "image_file": image_file,
129
- "sep": ",",
130
- })()
131
-
132
- eval_model(args)
133
- ```
134
- </details>
135
-
136
- ## LLaVA Weights
137
- Please check out our [Model Zoo](https://github.com/haotian-liu/LLaVA/blob/main/docs/MODEL_ZOO.md) for all public LLaVA checkpoints, and the instructions of how to use the weights.
138
-
139
- ## Demo
140
-
141
- To run our demo, you need to prepare LLaVA checkpoints locally. Please follow the instructions [here](#llava-weights) to download the checkpoints.
142
-
143
- ### Gradio Web UI
144
-
145
- To launch a Gradio demo locally, please run the following commands one by one. If you plan to launch multiple model workers to compare between different checkpoints, you only need to launch the controller and the web server *ONCE*.
146
-
147
- ```mermaid
148
- flowchart BT
149
- %% Declare Nodes
150
- gws("Gradio (UI Server)")
151
- c("Controller (API Server):<br/>PORT: 10000")
152
- mw7b("Model Worker:<br/>llava-v1.5-7b<br/>PORT: 40000")
153
- mw13b("Model Worker:<br/>llava-v1.5-13b<br/>PORT: 40001")
154
-
155
- %% Declare Styles
156
- classDef data fill:#3af,stroke:#48a,stroke-width:2px,color:#444
157
- classDef success fill:#8f8,stroke:#0a0,stroke-width:2px,color:#444
158
- classDef failure fill:#f88,stroke:#f00,stroke-width:2px,color:#444
159
-
160
- %% Assign Styles
161
- class id,od data;
162
- class cimg,cs_s,scsim_s success;
163
- class ncimg,cs_f,scsim_f failure;
164
-
165
- subgraph Demo Connections
166
- direction BT
167
- c<-->gws
168
-
169
- mw7b<-->c
170
- mw13b<-->c
171
- end
172
- ```
173
-
174
- #### Launch a controller
175
- ```Shell
176
- python -m llava.serve.controller --host 0.0.0.0 --port 10000
177
- ```
178
-
179
- #### Launch a gradio web server.
180
- ```Shell
181
- python -m llava.serve.gradio_web_server --controller http://localhost:10000 --model-list-mode reload
182
- ```
183
- You just launched the Gradio web interface. Now, you can open the web interface with the URL printed on the screen. You may notice that there is no model in the model list. Do not worry, as we have not launched any model worker yet. It will be automatically updated when you launch a model worker.
184
-
185
- #### Launch a model worker
186
-
187
- This is the actual *worker* that performs the inference on the GPU. Each worker is responsible for a single model specified in `--model-path`.
188
-
189
- ```Shell
190
- python -m llava.serve.model_worker --host 0.0.0.0 --controller http://localhost:10000 --port 40000 --worker http://localhost:40000 --model-path liuhaotian/llava-v1.5-13b
191
- ```
192
- Wait until the process finishes loading the model and you see "Uvicorn running on ...". Now, refresh your Gradio web UI, and you will see the model you just launched in the model list.
193
-
194
- You can launch as many workers as you want, and compare between different model checkpoints in the same Gradio interface. Please keep the `--controller` the same, and modify the `--port` and `--worker` to a different port number for each worker.
195
- ```Shell
196
- python -m llava.serve.model_worker --host 0.0.0.0 --controller http://localhost:10000 --port <different from 40000, say 40001> --worker http://localhost:<change accordingly, i.e. 40001> --model-path <ckpt2>
197
- ```
198
-
199
- If you are using an Apple device with an M1 or M2 chip, you can specify the mps device by using the `--device` flag: `--device mps`.
200
-
201
- #### Launch a model worker (Multiple GPUs, when GPU VRAM <= 24GB)
202
-
203
- If the VRAM of your GPU is less than 24GB (e.g., RTX 3090, RTX 4090, etc.), you may try running it with multiple GPUs. Our latest code base will automatically try to use multiple GPUs if you have more than one GPU. You can specify which GPUs to use with `CUDA_VISIBLE_DEVICES`. Below is an example of running with the first two GPUs.
204
-
205
- ```Shell
206
- CUDA_VISIBLE_DEVICES=0,1 python -m llava.serve.model_worker --host 0.0.0.0 --controller http://localhost:10000 --port 40000 --worker http://localhost:40000 --model-path liuhaotian/llava-v1.5-13b
207
- ```
208
-
209
- #### Launch a model worker (4-bit, 8-bit inference, quantized)
210
-
211
- You can launch the model worker with quantized bits (4-bit, 8-bit), which allows you to run the inference with reduced GPU memory footprint, potentially allowing you to run on a GPU with as few as 12GB VRAM. Note that inference with quantized bits may not be as accurate as the full-precision model. Simply append `--load-4bit` or `--load-8bit` to the **model worker** command that you are executing. Below is an example of running with 4-bit quantization.
212
-
213
- ```Shell
214
- python -m llava.serve.model_worker --host 0.0.0.0 --controller http://localhost:10000 --port 40000 --worker http://localhost:40000 --model-path liuhaotian/llava-v1.5-13b --load-4bit
215
- ```
216
-
217
- #### Launch a model worker (LoRA weights, unmerged)
218
-
219
- You can launch the model worker with LoRA weights, without merging them with the base checkpoint, to save disk space. There will be additional loading time, while the inference speed is the same as the merged checkpoints. Unmerged LoRA checkpoints do not have `lora-merge` in the model name, and are usually much smaller (less than 1GB) than the merged checkpoints (13G for 7B, and 25G for 13B).
220
-
221
- To load unmerged LoRA weights, you simply need to pass an additional argument `--model-base`, which is the base LLM that is used to train the LoRA weights. You can check the base LLM of each LoRA weights in the [model zoo](https://github.com/haotian-liu/LLaVA/blob/main/docs/MODEL_ZOO.md).
222
-
223
- ```Shell
224
- python -m llava.serve.model_worker --host 0.0.0.0 --controller http://localhost:10000 --port 40000 --worker http://localhost:40000 --model-path liuhaotian/llava-v1-0719-336px-lora-vicuna-13b-v1.3 --model-base lmsys/vicuna-13b-v1.3
225
- ```
226
-
227
- ### CLI Inference
228
-
229
- Chat about images using LLaVA without the need of Gradio interface. It also supports multiple GPUs, 4-bit and 8-bit quantized inference. With 4-bit quantization, for our LLaVA-1.5-7B, it uses less than 8GB VRAM on a single GPU.
230
-
231
- ```Shell
232
- python -m llava.serve.cli \
233
- --model-path liuhaotian/llava-v1.5-7b \
234
- --image-file "https://llava-vl.github.io/static/images/view.jpg" \
235
- --load-4bit
236
- ```
237
-
238
- <img src="images/demo_cli.gif" width="70%">
239
-
240
- ## Train
241
-
242
- *Below is the latest training configuration for LLaVA v1.5. For legacy models, please refer to README of [this](https://github.com/haotian-liu/LLaVA/tree/v1.0.1) version for now. We'll add them in a separate doc later.*
243
-
244
- LLaVA training consists of two stages: (1) feature alignment stage: use our 558K subset of the LAION-CC-SBU dataset to connect a *frozen pretrained* vision encoder to a *frozen LLM*; (2) visual instruction tuning stage: use 150K GPT-generated multimodal instruction-following data, plus around 515K VQA data from academic-oriented tasks, to teach the model to follow multimodal instructions.
245
-
246
- LLaVA is trained on 8 A100 GPUs with 80GB memory. To train on fewer GPUs, you can reduce the `per_device_train_batch_size` and increase the `gradient_accumulation_steps` accordingly. Always keep the global batch size the same: `per_device_train_batch_size` x `gradient_accumulation_steps` x `num_gpus`.
247
-
248
- ### Hyperparameters
249
- We use a similar set of hyperparameters as Vicuna in finetuning. Both hyperparameters used in pretraining and finetuning are provided below.
250
-
251
- 1. Pretraining
252
-
253
- | Hyperparameter | Global Batch Size | Learning rate | Epochs | Max length | Weight decay |
254
- | --- | ---: | ---: | ---: | ---: | ---: |
255
- | LLaVA-v1.5-13B | 256 | 1e-3 | 1 | 2048 | 0 |
256
-
257
- 2. Finetuning
258
-
259
- | Hyperparameter | Global Batch Size | Learning rate | Epochs | Max length | Weight decay |
260
- | --- | ---: | ---: | ---: | ---: | ---: |
261
- | LLaVA-v1.5-13B | 128 | 2e-5 | 1 | 2048 | 0 |
262
-
263
- ### Download Vicuna checkpoints (automatically)
264
-
265
- Our base model Vicuna v1.5, which is an instruction-tuned chatbot, will be downloaded automatically when you run our provided training scripts. No action is needed.
266
-
267
- ### Pretrain (feature alignment)
268
-
269
- Please download the 558K subset of the LAION-CC-SBU dataset with BLIP captions we use in the paper [here](https://huggingface.co/datasets/liuhaotian/LLaVA-Pretrain).
270
-
271
- Pretrain takes around 5.5 hours for LLaVA-v1.5-13B on 8x A100 (80G), due to the increased resolution to 336px. It takes around 3.5 hours for LLaVA-v1.5-7B.
272
-
273
- Training script with DeepSpeed ZeRO-2: [`pretrain.sh`](https://github.com/haotian-liu/LLaVA/blob/main/scripts/v1_5/pretrain.sh).
274
-
275
- - `--mm_projector_type mlp2x_gelu`: the two-layer MLP vision-language connector.
276
- - `--vision_tower openai/clip-vit-large-patch14-336`: CLIP ViT-L/14 336px.
277
-
278
- <details>
279
- <summary>Pretrain takes around 20 hours for LLaVA-7B on 8x V100 (32G)</summary>
280
-
281
- We provide training script with DeepSpeed [here](https://github.com/haotian-liu/LLaVA/blob/main/scripts/pretrain_xformers.sh).
282
- Tips:
283
- - If you are using V100 which is not supported by FlashAttention, you can use the [memory-efficient attention](https://arxiv.org/abs/2112.05682) implemented in [xFormers](https://github.com/facebookresearch/xformers). Install xformers and replace `llava/train/train_mem.py` above with [llava/train/train_xformers.py](llava/train/train_xformers.py).
284
- </details>
285
-
286
- ### Visual Instruction Tuning
287
-
288
- 1. Prepare data
289
-
290
- Please download the annotation of the final mixture our instruction tuning data [llava_v1_5_mix665k.json](https://huggingface.co/datasets/liuhaotian/LLaVA-Instruct-150K/blob/main/llava_v1_5_mix665k.json), and download the images from constituting datasets:
291
-
292
- - COCO: [train2017](http://images.cocodataset.org/zips/train2017.zip)
293
- - GQA: [images](https://downloads.cs.stanford.edu/nlp/data/gqa/images.zip)
294
- - OCR-VQA: [download script](https://drive.google.com/drive/folders/1_GYPY5UkUy7HIcR0zq3ZCFgeZN7BAfm_?usp=sharing), **we save all files as `.jpg`**
295
- - TextVQA: [train_val_images](https://dl.fbaipublicfiles.com/textvqa/images/train_val_images.zip)
296
- - VisualGenome: [part1](https://cs.stanford.edu/people/rak248/VG_100K_2/images.zip), [part2](https://cs.stanford.edu/people/rak248/VG_100K_2/images2.zip)
297
-
298
- After downloading all of them, organize the data as follows in `./playground/data`,
299
-
300
- ```
301
- β”œβ”€β”€ coco
302
- β”‚ └── train2017
303
- β”œβ”€β”€ gqa
304
- β”‚ └── images
305
- β”œβ”€β”€ ocr_vqa
306
- β”‚ └── images
307
- β”œβ”€β”€ textvqa
308
- β”‚ └── train_images
309
- └── vg
310
- β”œβ”€β”€ VG_100K
311
- └── VG_100K_2
312
- ```
313
-
314
- 2. Start training!
315
-
316
- You may download our pretrained projectors in [Model Zoo](https://github.com/haotian-liu/LLaVA/blob/main/docs/MODEL_ZOO.md). It is not recommended to use legacy projectors, as they may be trained with a different version of the codebase, and if any option is off, the model will not function/train as we expected.
317
-
318
- Visual instruction tuning takes around 20 hours for LLaVA-v1.5-13B on 8x A100 (80G), due to the increased resolution to 336px. It takes around 10 hours for LLaVA-v1.5-7B on 8x A100 (40G).
319
-
320
- Training script with DeepSpeed ZeRO-3: [`finetune.sh`](https://github.com/haotian-liu/LLaVA/blob/main/scripts/v1_5/finetune.sh).
321
-
322
- If you are do not have enough GPU memory:
323
-
324
- - Use LoRA: [`finetune_lora.sh`](https://github.com/haotian-liu/LLaVA/blob/main/scripts/v1_5/finetune_lora.sh). We are able to fit 13B training in 8-A100-40G/8-A6000, and 7B training in 8-RTX3090. Make sure `per_device_train_batch_size*gradient_accumulation_steps` is the same as the provided script for best reproducibility.
325
- - Replace `zero3.json` with `zero3_offload.json` which offloads some parameters to CPU RAM. This slows down the training speed.
326
-
327
- If you are interested in finetuning LLaVA model to your own task/data, please check out [`Finetune_Custom_Data.md`](https://github.com/haotian-liu/LLaVA/blob/main/docs/Finetune_Custom_Data.md)。
328
-
329
- New options to note:
330
-
331
- - `--mm_projector_type mlp2x_gelu`: the two-layer MLP vision-language connector.
332
- - `--vision_tower openai/clip-vit-large-patch14-336`: CLIP ViT-L/14 336px.
333
- - `--image_aspect_ratio pad`: this pads the non-square images to square, instead of cropping them; it slightly reduces hallucination.
334
- - `--group_by_modality_length True`: this should only be used when your instruction tuning dataset contains both language (e.g. ShareGPT) and multimodal (e.g. LLaVA-Instruct). It makes the training sampler only sample a single modality (either image or language) during training, which we observe to speed up training by ~25%, and does not affect the final outcome.
335
-
336
- ## Evaluation
337
-
338
- In LLaVA-1.5, we evaluate models on a diverse set of 12 benchmarks. To ensure the reproducibility, we evaluate the models with greedy decoding. We do not evaluate using beam search to make the inference process consistent with the chat demo of real-time outputs.
339
-
340
- See [Evaluation.md](https://github.com/haotian-liu/LLaVA/blob/main/docs/Evaluation.md).
341
-
342
- ### GPT-assisted Evaluation
343
-
344
- Our GPT-assisted evaluation pipeline for multimodal modeling is provided for a comprehensive understanding of the capabilities of vision-language models. Please see our paper for more details.
345
-
346
- 1. Generate LLaVA responses
347
-
348
- ```Shell
349
- python model_vqa.py \
350
- --model-path ./checkpoints/LLaVA-13B-v0 \
351
- --question-file \
352
- playground/data/coco2014_val_qa_eval/qa90_questions.jsonl \
353
- --image-folder \
354
- /path/to/coco2014_val \
355
- --answers-file \
356
- /path/to/answer-file-our.jsonl
357
- ```
358
-
359
- 2. Evaluate the generated responses. In our case, [`answer-file-ref.jsonl`](./playground/data/coco2014_val_qa_eval/qa90_gpt4_answer.jsonl) is the response generated by text-only GPT-4 (0314), with the context captions/boxes provided.
360
-
361
- ```Shell
362
- OPENAI_API_KEY="sk-***********************************" python llava/eval/eval_gpt_review_visual.py \
363
- --question playground/data/coco2014_val_qa_eval/qa90_questions.jsonl \
364
- --context llava/eval/table/caps_boxes_coco2014_val_80.jsonl \
365
- --answer-list \
366
- /path/to/answer-file-ref.jsonl \
367
- /path/to/answer-file-our.jsonl \
368
- --rule llava/eval/table/rule.json \
369
- --output /path/to/review.json
370
- ```
371
-
372
- 3. Summarize the evaluation results
373
-
374
- ```Shell
375
- python summarize_gpt_review.py
376
- ```
377
-
378
- ## Citation
379
-
380
- If you find LLaVA useful for your research and applications, please cite using this BibTeX:
381
- ```bibtex
382
-
383
- @misc{liu2023improvedllava,
384
- title={Improved Baselines with Visual Instruction Tuning},
385
- author={Liu, Haotian and Li, Chunyuan and Li, Yuheng and Lee, Yong Jae},
386
- publisher={arXiv:2310.03744},
387
- year={2023},
388
- }
389
-
390
- @misc{liu2023llava,
391
- title={Visual Instruction Tuning},
392
- author={Liu, Haotian and Li, Chunyuan and Wu, Qingyang and Lee, Yong Jae},
393
- publisher={arXiv:2304.08485},
394
- year={2023},
395
- }
396
- ```
397
-
398
- ## Acknowledgement
399
-
400
- - [Vicuna](https://github.com/lm-sys/FastChat): the codebase we built upon, and our base model Vicuna-13B that has the amazing language capabilities!
401
-
402
- ## Related Projects
403
-
404
- - [Instruction Tuning with GPT-4](https://github.com/Instruction-Tuning-with-GPT-4/GPT-4-LLM)
405
- - [LLaVA-Med: Training a Large Language-and-Vision Assistant for Biomedicine in One Day](https://github.com/microsoft/LLaVA-Med)
406
- - [Otter: In-Context Multi-Modal Instruction Tuning](https://github.com/Luodian/Otter)
407
-
408
- For future project ideas, please check out:
409
- - [SEEM: Segment Everything Everywhere All at Once](https://github.com/UX-Decoder/Segment-Everything-Everywhere-All-At-Once)
410
- - [Grounded-Segment-Anything](https://github.com/IDEA-Research/Grounded-Segment-Anything) to detect, segment, and generate anything by marrying [Grounding DINO](https://github.com/IDEA-Research/GroundingDINO) and [Segment-Anything](https://github.com/facebookresearch/segment-anything).
 
1
+ ---
2
+ title: LLaVA
3
+ emoji: πŸ”₯
4
+ colorFrom: purple
5
+ colorTo: gray
6
+ sdk: gradio
7
+ sdk_version: 3.36.1
8
+ app_port: 7860
9
+ ---