Spaces:
Runtime error
Runtime error
gmftbyGMFTBY
commited on
Commit
•
e96e20b
1
Parent(s):
8366b03
update README
Browse files
README.md
CHANGED
@@ -1,195 +1,13 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
****
|
16 |
-
|
17 |
-
<span id='all_catelogue'/>
|
18 |
-
|
19 |
-
## Catalogue:
|
20 |
-
* <a href='#introduction'>1. Introduction</a>
|
21 |
-
* <a href='#environment'>2. Running PandaGPT Demo</a>
|
22 |
-
* <a href='#install_environment'>2.1. Environment Installation</a>
|
23 |
-
* <a href='#download_imagebind_model'>2.2. Prepare ImageBind Checkpoint</a>
|
24 |
-
* <a href='#download_vicuna_model'>2.3. Prepare Vicuna Checkpoint</a>
|
25 |
-
* <a href='#download_pandagpt'>2.4. Prepare Delta Weights of PandaGPT</a>
|
26 |
-
* <a href='#running_demo'>2.5. Deploying Demo</a>
|
27 |
-
* <a href='#train_pandagpt'>3. Train Your Own PandaGPT</a>
|
28 |
-
* <a href='#data_preparation'>3.1. Data Preparation</a>
|
29 |
-
* <a href='#training_configurations'>3.2. Training Configurations</a>
|
30 |
-
* <a href='#model_training'>3.3. Training PandaGPT</a>
|
31 |
-
* <a href='#license'>Usage and License Notices</a>
|
32 |
-
* <a href='#acknowledgments'>Acknowledgments</a>
|
33 |
-
|
34 |
-
****
|
35 |
-
|
36 |
-
<span id='introduction'/>
|
37 |
-
|
38 |
-
### 1. Introduction: <a href='#all_catelogue'>[Back to Top]</a>
|
39 |
-
|
40 |
-
<p align="center" width="100%">
|
41 |
-
<img src="./PandaGPT.png" alt="PandaGPT-4" style="width: 80%; min-width: 300px; display: block; margin: auto;">
|
42 |
-
</p>
|
43 |
-
|
44 |
-
PandaGPT is the first foundation model capable of instruction-following data across six modalities, without the need of explicit supervision. It demonstrates a diverse set of multimodal capabilities such as complex understanding/reasoning, knowledge-grounded description, and multi-turn conversation.
|
45 |
-
|
46 |
-
|
47 |
-
****
|
48 |
-
|
49 |
-
<span id='environment'/>
|
50 |
-
|
51 |
-
### 2. Running PandaGPT Demo: <a href='#all_catelogue'>[Back to Top]</a>
|
52 |
-
|
53 |
-
<span id='install_environment'/>
|
54 |
-
|
55 |
-
#### 2.1. Environment Installation:
|
56 |
-
To install the required environment, please run
|
57 |
-
```
|
58 |
-
pip install -r requirements.txt
|
59 |
-
```
|
60 |
-
|
61 |
-
Then install the Pytorch package with the correct cuda version, for example
|
62 |
-
```
|
63 |
-
pip install torch==1.13.1+cu117 -f https://download.pytorch.org/whl/torch/
|
64 |
-
```
|
65 |
-
|
66 |
-
<span id='download_imagebind_model'/>
|
67 |
-
|
68 |
-
#### 2.2. Prepare ImageBind Checkpoint:
|
69 |
-
You can download the pre-trained ImageBind model using [this link](https://dl.fbaipublicfiles.com/imagebind/imagebind_huge.pth). After downloading, put the downloaded file (imagebind_huge.pth) in [[./pretrained_ckpt/imagebind_ckpt/]](./pretrained_ckpt/imagebind_ckpt/) directory.
|
70 |
-
|
71 |
-
<span id='download_vicuna_model'/>
|
72 |
-
|
73 |
-
#### 2.3. Prepare Vicuna Checkpoint:
|
74 |
-
To prepare the pre-trained Vicuna model, please follow the instructions provided [[here]](./pretrained_ckpt#1-prepare-vicuna-checkpoint).
|
75 |
-
|
76 |
-
|
77 |
-
<span id='download_pandagpt'/>
|
78 |
-
|
79 |
-
#### 2.4. Prepare Delta Weights of PandaGPT:
|
80 |
-
|
81 |
-
|**Base Language Model**|**Maximum Length**|**Huggingface Delta Weights Address**|
|
82 |
-
|:-------------:|:-------------:|:-------------:|
|
83 |
-
|Vicuna-7B (version 0)|512|[openllmplayground/pandagpt_7b_max_len_512](https://huggingface.co/openllmplayground/pandagpt_7b_max_len_512)|
|
84 |
-
|Vicuna-7B (version 0)|1024|[openllmplayground/pandagpt_7b_max_len_1024](https://huggingface.co/openllmplayground/pandagpt_7b_max_len_1024)|
|
85 |
-
|Vicuna-13B (version 0)|256|[openllmplayground/pandagpt_13b_max_len_256](https://huggingface.co/openllmplayground/pandagpt_13b_max_len_256)|
|
86 |
-
|Vicuna-13B (version 0)|400|[openllmplayground/pandagpt_13b_max_len_400](https://huggingface.co/openllmplayground/pandagpt_13b_max_len_400)|
|
87 |
-
|
88 |
-
We release the delta weights of PandaGPT trained with different strategies in the table above. After downloading, put the downloaded 7B/13B delta weights file (pytorch_model.pt) in the [[./pretrained_ckpt/pandagpt_ckpt/7b/]](./pretrained_ckpt/pandagpt_ckpt/7b/) or [[./pretrained_ckpt/pandagpt_ckpt/13b/]](./pretrained_ckpt/pandagpt_ckpt/13b/) directory. In our online demo, we use the `openllmplayground/pandagpt_7b_max_len_512` and `openllmplayground/pandagpt_13b_max_len_400` as our default models.
|
89 |
-
|
90 |
-
<span id='running_demo'/>
|
91 |
-
|
92 |
-
#### 2.5. Deploying Demo:
|
93 |
-
Upon completion of previous steps, you can run the demo as
|
94 |
-
```bash
|
95 |
-
cd ./code/
|
96 |
-
python web_demo.py
|
97 |
-
```
|
98 |
-
|
99 |
-
****
|
100 |
-
|
101 |
-
<span id='train_pandagpt'/>
|
102 |
-
|
103 |
-
### 3. Train Your Own PandaGPT: <a href='#all_catelogue'>[Back to Top]</a>
|
104 |
-
|
105 |
-
**Prerequisites:** Before training the model, making sure the environment is properly installed and the checkpoints of ImageBind and Vicuna are downloaded. You can refer to [here](https://github.com/yxuansu/PandaGPT#2-running-pandagpt-demo-back-to-top) for more information.
|
106 |
-
|
107 |
-
<span id='data_preparation'/>
|
108 |
-
|
109 |
-
#### 3.1. Data Preparation:
|
110 |
-
|
111 |
-
**Declaimer:** To ensure the reproducibility of our results, we have released our training datasets. The datasets must be used for research purpose only. The use of the datasets must comply with the licenses from original sources. These datasets may be taken down when requested by the original authors.
|
112 |
-
|
113 |
-
|**Training Task**|**Dataset Address**|
|
114 |
-
|:-------------:|:-------------:|
|
115 |
-
|Visual Instruction|[openllmplayground/pandagpt_visual_instruction_dataset](https://huggingface.co/datasets/openllmplayground/pandagpt_visual_instruction_dataset)|
|
116 |
-
|
117 |
-
After downloading, put the downloaded file and unzip them under the [[./data/]](./data/) directory.
|
118 |
-
|
119 |
-
> **** The directory should look like:
|
120 |
-
|
121 |
-
.
|
122 |
-
└── ./data/
|
123 |
-
├── pandagpt4_visual_instruction_data.json
|
124 |
-
└── /images/
|
125 |
-
├── 000000426538.jpg
|
126 |
-
├── 000000306060.jpg
|
127 |
-
└── ...
|
128 |
-
|
129 |
-
|
130 |
-
<span id='training_configurations'/>
|
131 |
-
|
132 |
-
#### 3.2 Training Configurations:
|
133 |
-
|
134 |
-
The table below show the training hyperparameters used in our experiments. The hyperparameters are selected based on the constrain of our computational resources, i.e. 8 x A100 (40G) GPUs.
|
135 |
-
|
136 |
-
|**Base Language Model**|**Training Task**|**Epoch Number**|**Batch Size**|**Learning Rate**|**Maximum Length**|
|
137 |
-
|:-------------:|:-------------:|:-------------:|:-------------:|:-------------:|:-------------:|
|
138 |
-
|7B|Visual Instruction|2|64|5e-4|1024|
|
139 |
-
|13B|Visual Instruction|2|64|5e-4|400|
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
<span id='model_training'/>
|
144 |
-
|
145 |
-
|
146 |
-
#### 3.3. Training PandaGPT:
|
147 |
-
|
148 |
-
To train PandaGPT, please run the following commands:
|
149 |
-
```yaml
|
150 |
-
cd ./code/scripts/
|
151 |
-
chmod +x train.sh
|
152 |
-
cd ..
|
153 |
-
./scripts/train.sh
|
154 |
-
```
|
155 |
-
|
156 |
-
The key arguments of the training script are as follows:
|
157 |
-
* `--data_path`: The data path for the json file `pandagpt4_visual_instruction_data.json`.
|
158 |
-
* `--image_root_path`: The root path for the downloaded images.
|
159 |
-
* `--imagebind_ckpt_path`: The path where saves the ImageBind checkpoint `imagebind_huge.pth`.
|
160 |
-
* `--vicuna_ckpt_path`: The directory that saves the pre-trained Vicuna checkpoints.
|
161 |
-
* `--max_tgt_len`: The maximum length of training instances.
|
162 |
-
* `--save_path`: The directory which saves the trained delta weights. This directory will be automatically created.
|
163 |
-
|
164 |
-
Note that the epoch number can be set in the `epochs` argument at [./code/config/openllama_peft.yaml](./code/config/openllama_peft.yaml) file. The `train_micro_batch_size_per_gpu` and `gradient_accumulation_steps` arguments in [./code/dsconfig/openllama_peft_stage_1.json](./code/dsconfig/openllama_peft_stage_1.json) should be set as `2` and `4` for 7B model, and set as `1` and `8` for 13B model.
|
165 |
-
|
166 |
-
****
|
167 |
-
|
168 |
-
<span id='license'/>
|
169 |
-
|
170 |
-
### Usage and License Notices:
|
171 |
-
|
172 |
-
PandaGPT is intended and licensed for research use only. 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. The delta weights are also CC BY NC 4.0 (allowing only non-commercial use).
|
173 |
-
|
174 |
-
|
175 |
-
****
|
176 |
-
|
177 |
-
<span id='acknowledgments'/>
|
178 |
-
|
179 |
-
### Acknowledgments:
|
180 |
-
|
181 |
-
|
182 |
-
This repo benefits from [OpenAlpaca](https://github.com/yxuansu/OpenAlpaca), [ImageBind](https://github.com/facebookresearch/ImageBind), [LLaVA](https://github.com/haotian-liu/LLaVA), and [MiniGPT-4](https://github.com/Vision-CAIR/MiniGPT-4). Thanks for their wonderful works!
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
|
|
1 |
+
---
|
2 |
+
title: PandaGPT
|
3 |
+
emoji: 🐼
|
4 |
+
colorFrom: purple
|
5 |
+
colorTo: gray
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 3.27
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
license: other
|
11 |
+
---
|
12 |
+
|
13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|