Amey
commited on
Commit
·
19c67e5
1
Parent(s):
ad00b7f
Update README.md
Browse files
README.md
CHANGED
@@ -1,4 +1,101 @@
|
|
1 |
---
|
2 |
license: mit
|
3 |
pipeline_tag: visual-question-answering
|
4 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
pipeline_tag: visual-question-answering
|
4 |
+
---
|
5 |
+
|
6 |
+
## Install
|
7 |
+
|
8 |
+
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).
|
9 |
+
|
10 |
+
1. Clone this repository and navigate to LLaVA folder
|
11 |
+
```bash
|
12 |
+
git clone https://github.com/haotian-liu/LLaVA.git
|
13 |
+
cd LLaVA
|
14 |
+
```
|
15 |
+
|
16 |
+
2. Install Package
|
17 |
+
```Shell
|
18 |
+
conda create -n llava python=3.10 -y
|
19 |
+
conda activate llava
|
20 |
+
pip install --upgrade pip # enable PEP 660 support
|
21 |
+
pip install -e .
|
22 |
+
```
|
23 |
+
|
24 |
+
3. Install additional packages for training cases
|
25 |
+
```
|
26 |
+
pip install -e ".[train]"
|
27 |
+
pip install flash-attn --no-build-isolation
|
28 |
+
```
|
29 |
+
|
30 |
+
### Upgrade to latest code base
|
31 |
+
|
32 |
+
```Shell
|
33 |
+
git pull
|
34 |
+
pip install -e .
|
35 |
+
```
|
36 |
+
|
37 |
+
## LLaVA Weights
|
38 |
+
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.
|
39 |
+
|
40 |
+
## Demo
|
41 |
+
|
42 |
+
To run our demo, you need to prepare LLaVA checkpoints locally. Please follow the instructions [here](#llava-weights) to download the checkpoints.
|
43 |
+
|
44 |
+
### Gradio Web UI
|
45 |
+
|
46 |
+
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*.
|
47 |
+
|
48 |
+
```mermaid
|
49 |
+
flowchart BT
|
50 |
+
%% Declare Nodes
|
51 |
+
gws("Gradio (UI Server)")
|
52 |
+
c("Controller (API Server):<br/>PORT: 10000")
|
53 |
+
mw7b("Model Worker:<br/>llava-v1.5-7b<br/>PORT: 40000")
|
54 |
+
mw13b("Model Worker:<br/>llava-v1.5-13b<br/>PORT: 40001")
|
55 |
+
|
56 |
+
%% Declare Styles
|
57 |
+
classDef data fill:#3af,stroke:#48a,stroke-width:2px,color:#444
|
58 |
+
classDef success fill:#8f8,stroke:#0a0,stroke-width:2px,color:#444
|
59 |
+
classDef failure fill:#f88,stroke:#f00,stroke-width:2px,color:#444
|
60 |
+
|
61 |
+
%% Assign Styles
|
62 |
+
class id,od data;
|
63 |
+
class cimg,cs_s,scsim_s success;
|
64 |
+
class ncimg,cs_f,scsim_f failure;
|
65 |
+
|
66 |
+
subgraph Demo Connections
|
67 |
+
direction BT
|
68 |
+
c<-->gws
|
69 |
+
|
70 |
+
mw7b<-->c
|
71 |
+
mw13b<-->c
|
72 |
+
end
|
73 |
+
```
|
74 |
+
|
75 |
+
#### Launch a controller
|
76 |
+
```Shell
|
77 |
+
python -m llava.serve.controller --host 0.0.0.0 --port 10000
|
78 |
+
```
|
79 |
+
|
80 |
+
#### Launch a gradio web server.
|
81 |
+
```Shell
|
82 |
+
python -m llava.serve.gradio_web_server --controller http://localhost:10000 --model-list-mode reload
|
83 |
+
```
|
84 |
+
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.
|
85 |
+
|
86 |
+
#### Launch a model worker
|
87 |
+
|
88 |
+
This is the actual *worker* that performs the inference on the GPU. Each worker is responsible for a single model specified in `--model-path`.
|
89 |
+
|
90 |
+
```Shell
|
91 |
+
python -m llava.serve.model_worker --host 0.0.0.0 --controller http://localhost:10000 --port 40000 --worker http://localhost:40000 --model-path ameywtf/tinyllava-1.1b-v0.1
|
92 |
+
```
|
93 |
+
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.
|
94 |
+
|
95 |
+
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.
|
96 |
+
```Shell
|
97 |
+
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>
|
98 |
+
```
|
99 |
+
|
100 |
+
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`.
|
101 |
+
|