Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,66 @@
|
|
1 |
---
|
2 |
license: mit
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
---
|
4 |
+
# 🔥 SPHINX: A Mixer of Tasks, Domains, and Embeddings
|
5 |
+
|
6 |
+
Official implementation of ['SPHINX: A Mixer of Tasks, Domains, and Embeddings Advances Multi-modal Large Language Models']().
|
7 |
+
|
8 |
+
Try out our [web demo 🚀](http://imagebind-llm.opengvlab.com/) here!
|
9 |
+
|
10 |
+
## News
|
11 |
+
* **[2023-10-17]** We release the demo, code, and model of SPHINX 🎉.
|
12 |
+
|
13 |
+
## Introduction
|
14 |
+
|
15 |
+
We present $\color{goldenrod}{SPHINX}$, a versatile multi-modal large language model (MLLM) with a mixer of training tasks, data domains, and visual embeddings.
|
16 |
+
|
17 |
+
- **Task Mix.** For all-purpose capabilities, we mix a variety of vision-language tasks for mutual improvement: VQA, REC, REG, OCR, etc.
|
18 |
+
|
19 |
+
- **Embedding Mix.** We capture robust visual representations by fusing distinct visual architectures, pre-training, and granularity.
|
20 |
+
|
21 |
+
- **Domain Mix.** For data from real-world and synthetic domains, we mix the weights of two domain-specific models for complementarity.
|
22 |
+
|
23 |
+
<p align="center"> <img src="figs/pipeline.png"/ width="90%"> <br>
|
24 |
+
</p>
|
25 |
+
|
26 |
+
## Demo
|
27 |
+
Via our proposed three-fold mixer, $\color{goldenrod}{SPHINX}$ exhibits superior multi-modal understanding and reasoning powers.
|
28 |
+
<p align="center"> <img src="figs/1.png"/ width="70%"> <br>
|
29 |
+
</p>
|
30 |
+
<p align="center"> <img src="figs/2.png"/ width="70%"> <br>
|
31 |
+
</p>
|
32 |
+
<p align="center"> <img src="figs/3.png"/ width="70%"> <br>
|
33 |
+
</p>
|
34 |
+
<p align="center"> <img src="figs/4.png"/ width="50%"> <br>
|
35 |
+
</p>
|
36 |
+
<p align="center"> <img src="figs/5.png"/ width="60%"> <br>
|
37 |
+
</p>
|
38 |
+
|
39 |
+
## Inference
|
40 |
+
This section provides a step-by-step guide for hosting a local SPHINX demo. If you're already familiar with the LLAMA2-Accessory toolkit, note that hosting a SPHINX demo follows the same pipeline as hosting demos for the other models supported by LLAMA2-Accessory.
|
41 |
+
|
42 |
+
### Installation
|
43 |
+
SPHINX is built upon LLaMA2-Accessory, please follow the instructions [here](https://llama2-accessory.readthedocs.io/en/latest/install.html) for environment setup.
|
44 |
+
|
45 |
+
### Weights
|
46 |
+
We provide the beta-version checkpoints on [HuggingFace🤗](https://huggingface.co/Alpha-VLLM/LLaMA2-Accessory/tree/main/finetune/mm/sphinx-sft). Please download them to your own machine. The file structure should appear as follows:
|
47 |
+
```
|
48 |
+
ckpt_path/
|
49 |
+
├── consolidated.00-of-02.model.pth
|
50 |
+
└── consolidated.01-of-02.model.pth
|
51 |
+
```
|
52 |
+
|
53 |
+
### Host Local Demo
|
54 |
+
Execute the following command for demo hosting:
|
55 |
+
``` bash
|
56 |
+
cd LLaMA2-Accessory/accessory
|
57 |
+
python demos/multi_turn_mm.py --n_gpus=2 \
|
58 |
+
--tokenizer_path=/path/to/tokenizer.model --llama_type=llama_ens \
|
59 |
+
--pretrained_path ckpt_path/
|
60 |
+
```
|
61 |
+
Explanation of each argument:
|
62 |
+
|
63 |
+
+ `--n_gpus`: Number of gpus to use. Utilizing more GPUs will alleviate memory usage on each GPU through model parallelism. Currently, this argument should be set to either 1 or 2, as support for *consolidated ckpt num < gpu num* is not yet available.
|
64 |
+
+ `--tokenizer_path`: Path to the official LLaMA2 tokenizer. Note that the tokenizer file is the same for both LLaMA and LLaMA2. You may download it from [here](https://huggingface.co/Alpha-VLLM/LLaMA2-Accessory/blob/main/config/tokenizer.model).
|
65 |
+
+ `--llama_type`: The model architecture of SPHINX is defined in [accessory/model/LLM/llama_ens.py](../accessory/model/LLM/llama_ens.py), and specifying `--llama_type=llama_ens ` tells the demo program to use this architecture.
|
66 |
+
+ `--pretrained_path`: The path to pre-trained checkpoint.
|