Update README.md
Browse files
README.md
CHANGED
@@ -1,618 +1,12 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
readme of:
|
14 |
-
rewarded soups
|
15 |
-
and others
|
16 |
-
|
17 |
-
<p align="center">
|
18 |
-
<br>
|
19 |
-
<img src="examples/OFA_logo_tp_path.svg" width="150" />
|
20 |
-
<br>
|
21 |
-
<p>
|
22 |
-
<br>
|
23 |
-
|
24 |
-
<p align="center">
|
25 |
-
<a href="modelscope.md">ModelScope</a>  |  <a href="checkpoints.md">Checkpoints</a>  |  <a href="colab.md">Colab</a>  |  <a href="https://huggingface.co/ofa-sys">Demo</a>  |  <a href="http://arxiv.org/abs/2202.03052">Paper </a>  |  Blog
|
26 |
-
</p>
|
27 |
-
|
28 |
-
<p align="center">
|
29 |
-
<br>
|
30 |
-
<img src="examples/demo.gif" width="800" />
|
31 |
-
<br>
|
32 |
-
<p>
|
33 |
-
|
34 |
-
[colab]: <https://colab.research.google.com/assets/colab-badge.svg>
|
35 |
-
|
36 |
-
OFA is a unified sequence-to-sequence pretrained model (support **English** and **Chinese**) that unifies modalities (i.e., cross-modality, vision, language) and tasks (**finetuning** and **prompt tuning** are supported): image captioning (1st at the [MSCOCO Leaderboard](https://competitions.codalab.org/competitions/3221#results)), VQA ([link](https://eval.ai/web/challenges/challenge-page/830/leaderboard/2278)), visual grounding, text-to-image generation, text classification, text generation, image classification, etc. We provide **step-by-step** instructions for pretraining and finetuning and corresponding checkpoints (check official ckpt \[[EN](checkpoints.md)|[CN](checkpoints_cn.md)\] or [huggingface ckpt](https://huggingface.co/OFA-Sys)).
|
37 |
-
|
38 |
-
We sincerely welcome contributions to our project. Feel free to contact us or send us issues / PRs!
|
39 |
-
<br></br>
|
40 |
-
|
41 |
-
# Our installation
|
42 |
-
|
43 |
-
after installling pycocoevalcap, donwload needed models:
|
44 |
-
```
|
45 |
-
python -c "from pycocoevalcap.spice.spice import Spice; tmp = Spice()"
|
46 |
-
|
47 |
-
```
|
48 |
-
|
49 |
-
# Online Demos
|
50 |
-
We provide online demo via Hugging Face Spaces for you to interact with our pretrained and finetuned models. Below are the links to the demos:
|
51 |
-
* Image Captioning \[[ModelScope](https://modelscope.cn/#/models/damo/ofa_image-caption_coco_large_en/summary) | [Spaces](https://huggingface.co/spaces/OFA-Sys/OFA-Image_Caption)\]
|
52 |
-
* Visual Grounding \[[ModelScope](https://modelscope.cn/#/models/damo/ofa_visual-grounding_refcoco_large_en/summary) | [Spaces](https://huggingface.co/spaces/OFA-Sys/OFA-Visual_Grounding)\]
|
53 |
-
* Visual Question Answering \[[ModelScope](https://modelscope.cn/#/models/damo/ofa_visual-question-answering_pretrain_large_en/summary) | [Spaces](https://huggingface.co/spaces/OFA-Sys/OFA-Visual_Question_Answering)\]
|
54 |
-
* Text-to-Image Generation \[[ModelScope](https://modelscope.cn/#/models/damo/ofa_text-to-image-synthesis_coco_large_en/summary) | [Spaces](https://huggingface.co/spaces/OFA-Sys/OFA-Text2Image_Generation)\]
|
55 |
-
* Generic Interface \[[Spaces](https://huggingface.co/spaces/OFA-Sys/OFA-Generic_Interface)\]
|
56 |
-
|
57 |
-
Also we provide Colab notebooks for you to better perceive the procedures. Click [here](colab.md) to check them out!
|
58 |
-
<br></br>
|
59 |
-
|
60 |
-
# Use in Huggingface Transformers
|
61 |
-
We support the inference of OFA in Huggingface Transformers. Check the [README](transformers.md) and [Colab Notebook](https://colab.research.google.com/drive/1Ho81RBV8jysZ7e0FhsSCk_v938QeDuy3?usp=sharing) for more information. Codes are released in this branch https://github.com/OFA-Sys/OFA/tree/feature/add_transformers
|
62 |
-
<br><br>
|
63 |
-
|
64 |
-
|
65 |
-
# News
|
66 |
-
* 2022.8.22: Released checkpoints and demos of **OFA** and **Chinese CLIP** on [ModelScope](https://modelscope.cn/). Check the [README](modelscope.md) for more details!
|
67 |
-
* 2022.8.16: Released the **Chinese** version of OFA. **OFA-CN** needs only switching to `bpe_dir=../../utils/BERT_CN_dict` and `bpe=bert` and using our provided Chinese checkpoints in [checkpoints_cn.md](checkpoints_cn.md). Temporarily, we only provide base-size and large-size pretrained checkpoints and finetuned checkpoints on [MUGE Caption](https://tianchi.aliyun.com/muge) and the Chinese version of RefCOCO(-/+/g) (to release soon).
|
68 |
-
* 2022.8.5: Released support of **prompt tuning** for OFA. Check our paper [here](https://arxiv.org/abs/2208.02532)! Please see the [prompt_tuning.md](prompt_tuning.md) for further details.
|
69 |
-
* 2022.7.7: Updated support of OFA on **huggingface transformers** (fixed bugs in forward, add sequence generator from Fairseq to ensure performance, etc.). Refer to the doc [transformers.md](transformers.md) and the branch `feature/add_transformers`.
|
70 |
-
* 2022.6.17: Released the pretrained checkpoint of **OFA-Huge**. To use it, set `--arch=ofa_huge` in the script.
|
71 |
-
* 2022.5.15: OFA was accepted by **ICML 2022**
|
72 |
-
* 2022.4.28: Add support of inference on **huggingface transformers**. For how to use it, please refer to the doc [transformers.md](transformers.md) and our [huggingface models](https://huggingface.co/OFA-Sys).
|
73 |
-
* 2022.4.16: Released lightweight pretrained models **OFA-Medium** (~93M params) and **OFA-Tiny** (~33M params) in [checkpoints.md](checkpoints.md). To use them, you just need to load the corresponding checkpoint and set `--arch=ofa_medium` or `--arch=ofa_tiny` in the scripts.
|
74 |
-
|
75 |
-
<details>
|
76 |
-
<summary><b>More News</b></summary>
|
77 |
-
<p>
|
78 |
-
<ul>
|
79 |
-
<li>2022.3.23: Added [Encouraging Loss](https://arxiv.org/pdf/2110.06537.pdf) as a feature. See [README_EncouragingLoss.md](README_EncouragingLoss.md). Leveraging this feature, OFA-Large has achieved improved results in both VQA (**test-std acc: 80.67**) and Image Classification (**test acc: 85.6**) recently.</li>
|
80 |
-
<li>2022.3.21: Released codes for pretraining OFA.</li>
|
81 |
-
<li>2022.3.18: Released the finetuned <b>OFA-Base</b> (~180M parameters) checkpoints and running scripts for vision & language tasks, including: <b>Caption (146.4 CIDEr), VQA (78.07 on test-std), SNLI-VE (89.3 on dev), RefCOCO (90.67 on testA), RefCOCO+ (87.15 on testA) and RefCOCOg (82.31 on test-u)</b>.</li>
|
82 |
-
<li>2022.3.11: Released the finetuning & inference code/checkpoints for <b>Gigaword</b>.</li>
|
83 |
-
<li>2022.3.08: Released the pretrained checkpoint of <b>OFA-Base</b> in <a href="https://github.com/OFA-Sys/OFA/blob/main/checkpoints.md">checkpoints.md</a>. To use OFA-Base, you just need to load <code>ofa_base.pt</code> and change <code>--arch=ofa_large</code> to <code>--arch=ofa_base</code> in the training scripts.</li>
|
84 |
-
<li>2022.3.07: Released the finetuning & inference code/checkpoints for <b>Image Classification</b>, which achieves <b>85.0</b> accuracy on ImageNet-1K, slightly better than reported in OFA paper.</li>
|
85 |
-
<li>2022.3.04: Released the finetuning & inference code/checkpoints for <b>Text-to-Image Generation</b>.</li>
|
86 |
-
<li>2022.3.03: Released the finetuning & inference code/checkpoints for <b>SNLI-VE</b> and <b>GLUE</b>.</li>
|
87 |
-
<li>2022.2.22: Released the finetuning & inference code/checkpoints for <b>Visual Question Answering</b>, which can reproduce <b>the reported VQA accuracy in OFA paper (80.02 on test-std)</b>. Check our results on the <a href="https://eval.ai/web/challenges/challenge-page/830/leaderboard/2278">VQA Challenge</a>.</li>
|
88 |
-
<li>2022.2.15: Released finetuning & inference code/checkpoints for <b>Referring Expression Comprehension</b></li>
|
89 |
-
<li>2022.2.10: Released the inference code & finetuned checkpoint for <b>Image captioning</b>, which can reproduce <b>the results on COCO Karparthy test split (149.6 CIDEr)</b>. OFA also achieves No.1 on the COCO image captioning online leaderboard <a href='https://competitions.codalab.org/competitions/3221#results'>Link</a> (marked as M6-Team).</li>
|
90 |
-
</ul>
|
91 |
-
</p>
|
92 |
-
</details>
|
93 |
-
<br></br>
|
94 |
-
|
95 |
-
|
96 |
-
# Model Card
|
97 |
-
We list the parameters and pretrained checkpoints of OFAs below. For finetuned checkpoints, please refer to [checkpoints.md](checkpoints.md).
|
98 |
-
|
99 |
-
<table border="1" width="100%">
|
100 |
-
<tr align="center">
|
101 |
-
<th>Model</th><th>Ckpt</th><th>Params</th><th>Backbone</th><th>Hidden size</th><th>Intermediate size</th><th>Num. of heads</th><th>Enc layers</th><th>Dec layers</th>
|
102 |
-
</tr>
|
103 |
-
<tr align="center">
|
104 |
-
<td>OFA<sub>Tiny</sub></td><td><a href="https://ofa-beijing.oss-cn-beijing.aliyuncs.com/checkpoints/ofa_tiny.pt">Download</a></td><td>33M</td><td>ResNet50</td><td>256</td><td>1024</td><td>4</td><td>4</td><td>4</td>
|
105 |
-
</tr>
|
106 |
-
<tr align="center">
|
107 |
-
<td>OFA<sub>Medium</sub></td><td><a href="https://ofa-beijing.oss-cn-beijing.aliyuncs.com/checkpoints/ofa_medium.pt">Download</a></td><td>93M</td><td>ResNet101</td><td>512</td></td><td>2048</td><td>8</td><td>4</td><td>4</td>
|
108 |
-
</tr>
|
109 |
-
<tr align="center">
|
110 |
-
<td>OFA<sub>Base</sub></td><td><a href="https://ofa-beijing.oss-cn-beijing.aliyuncs.com/checkpoints/ofa_base.pt">Download</a></td><td>180M</td><td>ResNet101</td><td>768</td></td><td>3072</td><td>12</td><td>6</td><td>6</td>
|
111 |
-
</tr>
|
112 |
-
<tr align="center">
|
113 |
-
<td>OFA<sub>Large</sub></td><td><a href="https://ofa-beijing.oss-cn-beijing.aliyuncs.com/checkpoints/ofa_large.pt">Download</a></td><td>470M</td><td>ResNet152</td><td>1024</td></td><td>4096</td><td>16</td><td>12</td><td>12</td>
|
114 |
-
</tr>
|
115 |
-
<tr align="center">
|
116 |
-
<td>OFA<sub>Huge</sub></td><td><a href="https://ofa-beijing.oss-cn-beijing.aliyuncs.com/checkpoints/ofa_huge.pt">Download</a></td><td>930M</td><td>ResNet152</td><td>1280</td></td><td>5120</td><td>16</td><td>24</td><td>12</td>
|
117 |
-
</tr>
|
118 |
-
</table>
|
119 |
-
<br></br>
|
120 |
-
|
121 |
-
# Results
|
122 |
-
Below we demonstrate the results of OFAs on cross-modal understanding and generation.
|
123 |
-
|
124 |
-
<table border="1" width="100%">
|
125 |
-
<tr align="center">
|
126 |
-
<th>Task</th><th>Image Captioning</th><th>VQA</th><th>Visual Entailment</th><th colspan="3">Referring Expression Comprehension</th>
|
127 |
-
</tr>
|
128 |
-
<tr align="center">
|
129 |
-
<td>Dataset</td><td>COCO</td><td>VQA v2</td><td>SNLI-VE</td><td>RefCOCO</td><td>RefCOCO+</td><td>RefCOCOg</td>
|
130 |
-
</tr>
|
131 |
-
<tr align="center">
|
132 |
-
<td>Split</td><td>Karpathy test (CE/CIDEr)</td><td>test-dev/test-std</td><td>val/test</td><td>val/test-a/test-b</td><td>val/test-a/test-b</td><td>val-u/test-u</td>
|
133 |
-
</tr>
|
134 |
-
<tr align="center">
|
135 |
-
<td>Metric</td><td>CIDEr</td><td>Acc.</td><td>Acc.</td><td colspan="3">Acc.</td>
|
136 |
-
</tr>
|
137 |
-
<tr align="center">
|
138 |
-
<td>OFA<sub>Tiny</sub></td><td>119.0 / 128.7</td><td>70.3 / 70.4</td><td>85.3 / 85.2</td><td>80.20 / 84.07 / 75.00</td><td>68.22 / 75.13 / 57.66</td><td>72.02 / 69.74</td>
|
139 |
-
</tr>
|
140 |
-
<tr align="center">
|
141 |
-
<td>OFA<sub>Medium</sub></td><td>130.4 / 140.3</td><td>75.4 / 75.5</td><td>86.6 / 87.0</td><td>85.34 / 87.68 / 77.92</td><td>76.09 / 83.04 / 66.25</td><td>78.76 / 78.58</td>
|
142 |
-
</tr>
|
143 |
-
<tr align="center">
|
144 |
-
<td>OFA<sub>Base</sub></td><td>138.2 / 146.7</td><td>78.0 / 78.1</td><td>89.3 / 89.2</td><td>88.48 / 90.67 / 83.30</td><td>81.39 / 87.15 / 74.29</td><td>82.29 / 82.31</td>
|
145 |
-
</tr>
|
146 |
-
<tr align="center">
|
147 |
-
<td>OFA<sub>Large</sub></td><td>142.2 / 150.7</td><td>80.4 / 80.7</td><td>90.3 / 90.2</td><td>90.05 / 92.93 / 85.26</td><td>85.80 / 89.87 / 79.22</td><td>85.89 / 86.55</td>
|
148 |
-
</tr>
|
149 |
-
<tr align="center">
|
150 |
-
<td>OFA<sub>Huge</sub></td><td>145.3 / 154.9</td><td>82.0 / 82.0</td><td>91.0 / 91.2</td><td>92.04 / 94.03 / 88.44</td><td>87.86 / 91.70 / 80.71</td><td>88.07 / 88.78</td>
|
151 |
-
</tr>
|
152 |
-
</table>
|
153 |
-
<br></br>
|
154 |
-
|
155 |
-
# Requirements
|
156 |
-
* python 3.7.4
|
157 |
-
* pytorch 1.8.1
|
158 |
-
* torchvision 0.9.1
|
159 |
-
* JAVA 1.8 (for COCO evaluation)
|
160 |
-
<br></br>
|
161 |
-
|
162 |
-
# Installation
|
163 |
-
```bash
|
164 |
-
git clone https://github.com/OFA-Sys/OFA
|
165 |
-
pip install -r requirements.txt
|
166 |
-
```
|
167 |
-
<br></br>
|
168 |
-
|
169 |
-
# Datasets and Checkpoints
|
170 |
-
See [datasets.md](datasets.md) and [checkpoints.md](checkpoints.md).
|
171 |
-
<br></br>
|
172 |
-
|
173 |
-
# Training & Inference
|
174 |
-
Below we provide methods for training and inference on different tasks. We provide both pretrained OFA-Large and OFA-Base in [checkpoints.md](checkpoints.md). The scripts mentioned in this section are prepared for OFA-Large. For reproducing the downstreaming results of OFA-Base, we have also provided the corresponding finetuning and inference scripts for OFA-Base in the `run_scripts/` folder.
|
175 |
-
|
176 |
-
We recommend that your workspace directory should be organized like this:
|
177 |
-
```
|
178 |
-
OFA/
|
179 |
-
├── checkpoints/
|
180 |
-
│ ├── ofa_base.pt
|
181 |
-
│ ├── ofa_large.pt
|
182 |
-
│ ├── caption_large_best_clean.pt
|
183 |
-
│ └── ...
|
184 |
-
├── criterions/
|
185 |
-
├── data/
|
186 |
-
├── dataset/
|
187 |
-
│ ├── caption_data/
|
188 |
-
│ ├── gigaword_data/
|
189 |
-
│ └── ...
|
190 |
-
├── fairseq/
|
191 |
-
├── models/
|
192 |
-
├── run_scripts/
|
193 |
-
├── tasks/
|
194 |
-
├── train.py
|
195 |
-
├── trainer.py
|
196 |
-
└── utils/
|
197 |
-
```
|
198 |
-
|
199 |
-
|
200 |
-
## Image Processing
|
201 |
-
To ensure the efficiency of processing data, we did not store images with small files, but instead we encode them to base64 strings.
|
202 |
-
Transforming image files to base64 strings is simple. Run the following code:
|
203 |
-
```python
|
204 |
-
from PIL import Image
|
205 |
-
from io import BytesIO
|
206 |
-
import base64
|
207 |
-
|
208 |
-
img = Image.open(file_name) # path to file
|
209 |
-
img_buffer = BytesIO()
|
210 |
-
img.save(img_buffer, format=img.format)
|
211 |
-
byte_data = img_buffer.getvalue()
|
212 |
-
base64_str = base64.b64encode(byte_data) # bytes
|
213 |
-
base64_str = base64_str.decode("utf-8") # str
|
214 |
-
```
|
215 |
-
|
216 |
-
## Pretraining
|
217 |
-
Below we provide methods for pretraining OFA.
|
218 |
-
|
219 |
-
<details>
|
220 |
-
<summary><b>1. Prepare the Dataset</b></summary>
|
221 |
-
<p>
|
222 |
-
To pretrain OFA, you should first download the dataset we provide (<a href="https://ofa-beijing.oss-cn-beijing.aliyuncs.com/datasets/pretrain_data/pretrain_data_examples.zip">pretrain_data_examples.zip</a>, a small subset of the original pretraining data). For your customed pretraining datasets, please prepare your training samples into the same format. <code>pretrain_data_examples.zip</code> contains 4 TSV files: <code>vision_language_examples.tsv</code>, <code>text_examples.tsv</code>, <code>image_examples.tsv</code> and <code>detection_examples.tsv</code>. Details of these files are as follows:
|
223 |
-
<br />
|
224 |
-
<ul type="circle">
|
225 |
-
<li><b>vision_language_examples.tsv</b>:
|
226 |
-
Each line contains uniq-id, image (base64 string), caption, question, answer, ground-truth objects (objects appearing in the caption or question), dataset name (source of the data) and task type (caption, qa or visual gronunding). Prepared for the pretraining tasks of visual grounding, grounded captioning, image-text matching, image captioning and visual question answering. </li>
|
227 |
-
<li><b>text_examples.tsv</b>: Each line contains uniq-id and text. Prepared for the pretraining task of text infilling. </li>
|
228 |
-
<li><b>image_examples.tsv</b>: Each line contains uniq-id, image (base64 string, should be resized to 256*256 resolution) and image-code (generate the sparse codes for the central part of image through VQ-GAN). Prepared for the pretraining task of image infilling. </li>
|
229 |
-
<li><b>detection_examples.tsv</b>: Each line contains uniq-id, image (base64 string) and bounding box annotations (contains the top-left and bottom-right coordinates of the bounding box, object_id and object_name, seperated by commas). Prepared for the pretraining task of detection. </li>
|
230 |
-
</ul>
|
231 |
-
In addition, the folder negative_sample in pretrain_data_examples.zip contains three files <code>all_captions.txt</code>, <code>object.txt</code> and <code>type2ans.json</code>. The data in these files are used as negative samples for the image-text matching (ITM) task.
|
232 |
-
</p>
|
233 |
-
</details>
|
234 |
-
<details>
|
235 |
-
<summary><b>2. Pretraining</b></summary>
|
236 |
-
<p>
|
237 |
-
By default, the pretraining script will attempt to restore the released pretrained checkpoints of OFA-Base or OFA-Large and perform continuous pretraining. Continuous pretraining is more recommended, which achieves much better results compared with pretraining from scratch. For continuous pretraining, please download the pretrained weights in advance (see <a href='checkpoints.md'>checkpoints.md</a>) and put them in the correct directory <code>OFA/checkpoints/</code>. If not, the pretraining will begin from scratch.
|
238 |
-
</p>
|
239 |
-
<pre>
|
240 |
-
cd run_scripts/pretraining
|
241 |
-
bash pretrain_ofa_large.sh # Pretrain OFA-Large. For OFA-Base, use pretrain_ofa_base.sh
|
242 |
-
</pre>
|
243 |
-
<p>
|
244 |
-
If the pretrained OFA checkpoint is restored successfully, you will see the following information in the log:
|
245 |
-
</p>
|
246 |
-
<pre>
|
247 |
-
INFO: Loaded checkpoint ../../checkpoints/ofa_large.pt
|
248 |
-
</pre>
|
249 |
-
</details>
|
250 |
-
|
251 |
-
## Image Captioning
|
252 |
-
We provide procedures to reproduce our results of image captioning on our paper below.
|
253 |
-
<details>
|
254 |
-
<summary><b>1. Prepare the Dataset & Checkpoints</b></summary>
|
255 |
-
<p>
|
256 |
-
Download data (see <a href='datasets.md'>datasets.md</a>) and models (see <a href='checkpoints.md'>checkpoints.md</a>) and put them in the correct directory. The dataset zipfile <code>caption_data.zip</code> contains caption_stage1_train.tsv, caption_stage2_train.tsv, caption_val.tsv and caption_test.tsv. Each image corresponds to only 1 caption in <code>caption_stage1_train.tsv</code> and corresponds to multiple captions in other TSV files (about 5 captions per image). Each line of the dataset represents a caption sample with the following format. The information of uniq-id, image-id, caption, predicted object labels (taken from <a href='https://github.com/pzzhang/VinVL'>VinVL</a>, not used), image base64 string are separated by tabs.
|
257 |
-
</p>
|
258 |
-
<pre>
|
259 |
-
162365 12455 the sun sets over the trees beyond some docks. sky&&water&&dock&&pole /9j/4AAQSkZJ....UCP/2Q==
|
260 |
-
</pre>
|
261 |
-
</details>
|
262 |
-
<details>
|
263 |
-
<summary><b>2. Finetuning</b></summary>
|
264 |
-
<p>
|
265 |
-
Following previous standard practice, we divide the finetuning process of image captioning into two stages. In stage 1, we finetune OFA with cross-entropy loss on 4 NVIDIA-V100 GPUs with 32GB memory (expected to obtain ~139.5 CIDEr on the validation set at this stage). In stage 2, we select the best checkpoint of stage 1 and train with CIDEr optimization on 8 NVIDIA-V100 GPUs. <b>Note that CIDEr optimization is very unstable and requires careful hyperparameter tuning. If you encounter training errors in the stage2 finetuning, you can increase the batch size or reduce the learning rate. If neither of these works, you can directly set </b><code>--freeze-resnet</code><b> to freeze the inner states of batch normalization.</b>
|
266 |
-
</p>
|
267 |
-
<pre>
|
268 |
-
cd run_scripts/caption
|
269 |
-
nohup sh train_caption_stage1.sh > train_stage1.out & # stage 1, train with cross-entropy loss
|
270 |
-
nohup sh train_caption_stage2.sh > train_stage2.out & # stage 2, load the best ckpt of stage1 and train with CIDEr optimization
|
271 |
-
</pre>
|
272 |
-
</details>
|
273 |
-
<details>
|
274 |
-
<summary><b>3. Inference</b></summary>
|
275 |
-
<p>
|
276 |
-
Run the following commands to get your results and evaluate your model.
|
277 |
-
</p>
|
278 |
-
<pre>
|
279 |
-
cd run_scripts/caption ; sh evaluate_caption.sh # inference & evaluate
|
280 |
-
</pre>
|
281 |
-
</details>
|
282 |
-
|
283 |
-
## Text-to-Image Generation
|
284 |
-
This part provides procedures for the finetuning and inference of text-to-image generation. See below.
|
285 |
-
|
286 |
-
<details>
|
287 |
-
<summary><b>1. Prepare the Dataset & Checkpoints</b></summary>
|
288 |
-
<p>
|
289 |
-
Download data (see <a href="datasets.md">datasets.md</a>) and models (see <a href="checkpoints.md">checkpoints.md</a>) and put them in the correct directory. The dataset zipfile <code>coco_image_gen.zip</code> contains <code>coco_vqgan_train.tsv</code>, <code>coco_vqgan_dev.tsv</code> and <code>coco_vqgan_full_test.tsv</code>. Each line of the dataset represents a sample with the following format. The information of uniq-id, image-code (produced by <a href="https://github.com/CompVis/taming-transformers">vqgan</a>, a list of integers separated by single-whitespaces), lowercased caption are separated by tabs.
|
290 |
-
</p>
|
291 |
-
<pre>
|
292 |
-
1 6674 4336 4532 5334 3251 5461 3615 2469 ...4965 4190 1846 the people are posing for a group photo.
|
293 |
-
</pre>
|
294 |
-
<p>
|
295 |
-
The checkpoint zipfile <code>image_gen_large_best.zip</code> contains <code>image_gen_large_best.pt</code>, <code>vqgan/last.ckpt</code>, <code>vqgan/model.yaml</code> and <code>clip/Vit-B-16.pt</code>.
|
296 |
-
</p>
|
297 |
-
</details>
|
298 |
-
<details>
|
299 |
-
<summary><b>2. Shuffle the Training Data</b></summary>
|
300 |
-
<p>
|
301 |
-
(Optional, but achieves better result): If the disk storage is sufficient, we recommend to prepare the shuffled training data for each epoch in advance.
|
302 |
-
</p>
|
303 |
-
<pre>
|
304 |
-
cd dataset/image_gen
|
305 |
-
ln coco_vqgan_train.tsv coco_vqgan_train_1.tsv
|
306 |
-
for idx in `seq 1 9`;do shuf coco_vqgan_train_${idx}.tsv > coco_vqgan_train_$[${idx}+1].tsv;done # each file is used for an epoch
|
307 |
-
</pre>
|
308 |
-
</details>
|
309 |
-
<details>
|
310 |
-
<summary><b>3. Finetuning</b></summary>
|
311 |
-
<p>
|
312 |
-
Following previous practice, we divide the finetuning process of image generating into two stages. In stage 1, we finetune OFA with cross-entropy loss on 4 8-V100-32G-GPU servers (expected to obtain ~32.5+ CLIP Score on the validation set at this stage). In stage 2, we select the last checkpoint of stage 1 and train with CLIP Score optimization on 4 8-V100-32G-GPU servers (expected to obtain ~34.0+ CLIP Score on the validation set at this stage). During the validation, the generated image will be dumped into <code>_GEN_IMAGE_PATH_</code>.
|
313 |
-
</p>
|
314 |
-
<pre>
|
315 |
-
# run on each worker after the distributed and data configs have been correctly set following the guide in train_image_gen_stage1_distributed.sh
|
316 |
-
cd run_scripts/image_gen
|
317 |
-
nohup sh train_image_gen_stage1_distributed.sh # stage 1, train with cross-entropy loss
|
318 |
-
nohup sh train_image_gen_stage2_distributed.sh # stage 2, load the last ckpt of stage1 and train with CLIP Score optimization
|
319 |
-
</pre>
|
320 |
-
</details>
|
321 |
-
<details>
|
322 |
-
<summary><b>4. Inference</b></summary>
|
323 |
-
<p>
|
324 |
-
Run the command below to generate your images.
|
325 |
-
</p>
|
326 |
-
<pre>
|
327 |
-
cd run_scripts/image_gen ; sh evaluate_image_gen.sh # inference & evaluate (FID, IS and CLIP Score)
|
328 |
-
</pre>
|
329 |
-
</details>
|
330 |
-
|
331 |
-
## Visual Question Answering
|
332 |
-
Here we provide the finetuning and inference codes to reproduce the VQAv2 result reported in our paper (**test-std 80.02**). We believe much improvement on accuracy can still be achieved based on this codebase :)
|
333 |
-
<details>
|
334 |
-
<summary><b>1. Prepare the Dataset & Checkpoints</b></summary>
|
335 |
-
<p>
|
336 |
-
Download data (see <a href="datasets.md">datasets.md</a>) and models (see <a href="checkpoints.md">checkpoints.md</a>) and put them in the correct directory. The dataset zipfile <code>vqa_data.zip</code> is around 100G and the decompressed data costs around 135G disk storage, which contains the training, validation and testing samples together with other necessary data resources. (Since <code>vqa_data.zip</code> is large in size, we have also provided chunked parts of the dataset files for more convenient and stable downloading. Please refer to <a href="https://github.com/OFA-Sys/OFA/issues/68#issuecomment-1096837349">issue #68</a>.) Following common practice, VG-QA samples are also included in the training data. To adapt to the seq2seq paradigm of OFA, we transform original VQA training questions with multiple golden answers into multiple training samples. For the original VQA validation set, we keep around 10k samples for our validation and utilize the other samples for training. Each line of the dataset represents a VQA sample with the following format. The information of question-id, image-id, question, answer (with confidence), predicted object labels (taken from <a href="https://github.com/pzzhang/VinVL">VinVL</a>, slightly brings around +0.1 accuracy improvement), image base64 string are separated by tabs.
|
337 |
-
</p>
|
338 |
-
<pre>
|
339 |
-
79459 79459 is this person wearing shorts? 0.6|!+no house&&short&&...&&sky /9j/4AAQS...tigZ/9k=
|
340 |
-
</pre>
|
341 |
-
<p>
|
342 |
-
For fine-tuning on customed VQA-formulated tasks, please refer to issue <a href="https://github.com/OFA-Sys/OFA/issues/76">#76</a>, <a href="https://github.com/OFA-Sys/OFA/issues/105">#105</a> and <a href="https://github.com/OFA-Sys/OFA/issues/73">#73</a> for more information.
|
343 |
-
</p>
|
344 |
-
</details>
|
345 |
-
<details>
|
346 |
-
<summary><b>2. Shuffle the Training Data</b></summary>
|
347 |
-
<p>
|
348 |
-
(Optional, but achieves better finetuning accuracy): If the disk storage is sufficient, we recommend to prepare the shuffled training data for each epoch in advance. In our experiments, we use shuffling which brings around <b>+0.3</b> improvement on VQA accuracy.
|
349 |
-
</p>
|
350 |
-
<pre>
|
351 |
-
cd dataset/vqa_data
|
352 |
-
ln vqa_train.tsv vqa_train_1.tsv
|
353 |
-
for idx in `seq 1 9`;do shuf vqa_train_${idx}.tsv > vqa_train_$[${idx}+1].tsv;done # each file is used for an epoch
|
354 |
-
</pre>
|
355 |
-
</details>
|
356 |
-
<details>
|
357 |
-
<summary><b>3. Finetuning</b></summary>
|
358 |
-
<p>
|
359 |
-
In our experiments, the VQA finetuning is performed on 4 8-A100-GPU servers (<i>with RDMA</i>). Here provides the finetuning script <code>train_vqa_distributed.sh</code>, which supports multi-server distributed training (as well as single-server training). Please refer to the comments in the beginning of the script and set the configs correctly according to your distribution environment. If you have shuffled the training data in the previous step, please correctly specify the training data path following the guide in the script comments. <b>The command should be run on each worker.</b>
|
360 |
-
</p>
|
361 |
-
<pre>
|
362 |
-
# run on each worker after the distributed and data configs have been correctly set following the guide in train_vqa_distributed.sh
|
363 |
-
cd run_scripts/vqa
|
364 |
-
bash train_vqa_distributed.sh
|
365 |
-
</pre>
|
366 |
-
<p>
|
367 |
-
In our experiments, the finetuning costs around 36 hours (for 12 epochs). After each epoch, an evaluation on validation set is performed. The best validation accuracy during finetuning will be around 80.8. The log is saved in <code>${log_dir}</code>.
|
368 |
-
</p>
|
369 |
-
<p>
|
370 |
-
<i>(Update on validation time-cost)</i> As will be mentioned in the <i>4. Inference</i> section, we prepare 2 types of inference: beam-search and all-candidate inference. By default, all-candidate inference is used for validation during fine-tuning, which achieves better accuracy but costs much time. Now we have added a new option in the training scripts called <code>--val-inference-type</code> to switch the validation inference type during fine-tuning. If you feel the validation takes too long, you can refer to <a href="https://github.com/OFA-Sys/OFA/pull/79">PR #79</a> to activate beam-search validation, which significantly takes much less time, with around 0.5-0.6 validation score degradation compared with all-candidate validation.
|
371 |
-
</p>
|
372 |
-
</details>
|
373 |
-
<details>
|
374 |
-
<summary><b>4. Inference</b></summary>
|
375 |
-
<p>
|
376 |
-
We provide 2 types of inference, <b>beam-search</b> (much faster but gets sub-optimal accuracy) and <b>all-candidate evaluation</b> (slower but best accuracy). <br></br>
|
377 |
-
For beam-search inference, use the script <code>evaluate_vqa_beam.sh</code>. Refer to the command below. The inference on test set costs around 16 GPU hours. After inference on test set, the result JSON file will be dumped in the <code>${result_path}</code> defined in the shell script. You can submit the result <code>test_predict.json</code> to <a href="https://eval.ai/web/challenges/challenge-page/830/overview">EvalAI</a>. Using our released finetuned checkpoint, beam-search inference will get 80.15 validation accuracy, 79.36 test-dev accuracy and 79.48 test-std accuracy (around 0.6 lower than all-candidate evaluation).
|
378 |
-
</p>
|
379 |
-
<pre>
|
380 |
-
cd run_scripts/vqa
|
381 |
-
bash evaluate_vqa_beam.sh val # specify 'val' or 'test'
|
382 |
-
</pre>
|
383 |
-
<p>
|
384 |
-
For all-candidate evaluation, we recommend to use the distributed script <code>evaluate_vqa_allcand_distributed.sh</code>. Please refer to the guide in the script to set the distributed configs before running. The result JSON file will be dumped in the <code>${result_path}</code> defined in the shell script of rank-0 server. All-candidate evaluation computes scores on all the candidate answers in the VQA dataset, which achieves <b>80.82</b> validation accuracy, <b>79.87</b> test-dev accuracy and <b>80.02</b> test-std accuracy, reproducing our reported results in the paper. However, the inference on test set costs around 1k GPU hours, which is much slower.
|
385 |
-
</p>
|
386 |
-
<pre>
|
387 |
-
# run on each worker after the distributed configs have been correctly set following the guide in evaluate_vqa_allcand_distributed.sh
|
388 |
-
cd run_scripts/vqa
|
389 |
-
bash evaluate_vqa_allcand_distributed.sh val # specify 'val' or 'test'
|
390 |
-
</pre>
|
391 |
-
</details>
|
392 |
-
|
393 |
-
## Referring Expression Comprehension
|
394 |
-
Here provides procedures for you to prepare data, train, and evaluate your model on visual grounding.
|
395 |
-
<details>
|
396 |
-
<summary><b>1. Prepare the Dataset & Checkpoints</b></summary>
|
397 |
-
<p>
|
398 |
-
Download data (see <a href='datasets.md'>datasets.md</a>) and models (see <a href='checkpoints.md'>checkpoints.md</a>) and put them in the correct directory. We provide RefCOCO (split by UNC), RefCOCO+ (split by UNC) and RefCOCOg (split by UMD) datasets. See <a href='https://www.tensorflow.org/datasets/catalog/ref_coco'>RefCOCO</a> and <a href="https://github.com/lichengunc/refer">Refer</a> for more details. Note that in the original dataset, each region-coord (or bounding box) may corresponds to multiple descriptive texts. We split these texts into multiple samples so that the region-coord in each sample corresponds to only one text. Each line of the processed dataset represents a sample with the following format. The information of uniq-id, image-id, text, region-coord (separated by commas), image base64 string are separated by tabs.
|
399 |
-
</p>
|
400 |
-
<pre>
|
401 |
-
79_1 237367 A woman in a white blouse holding a glass of wine. 230.79,121.75,423.66,463.06 9j/4AAQ...1pAz/9k=
|
402 |
-
</pre>
|
403 |
-
</details>
|
404 |
-
<details>
|
405 |
-
<summary><b>2. Finetuning</b></summary>
|
406 |
-
<p>
|
407 |
-
Unlike the original paper, we finetune OFA with a drop-path rate of 0.2, and found that training with this hyper-parameter achieves better results. We will update the reported results of the paper later.
|
408 |
-
</p>
|
409 |
-
<pre>
|
410 |
-
cd run_scripts/refcoco
|
411 |
-
nohup sh train_refcoco.sh > train_refcoco.out & # finetune for refcoco
|
412 |
-
nohup sh train_refcocoplus.sh > train_refcocoplus.out & # finetune for refcoco+
|
413 |
-
nohup sh train_refcocog.sh > train_refcocog.out & # finetune for refcocog
|
414 |
-
</pre>
|
415 |
-
</details>
|
416 |
-
<details>
|
417 |
-
<summary><b>3. Inference</b></summary>
|
418 |
-
<p>
|
419 |
-
Run the following commands for the evaluation.
|
420 |
-
</p>
|
421 |
-
<pre>
|
422 |
-
cd run_scripts/refcoco ; sh evaluate_refcoco.sh # inference & evaluate for refcoco/refcoco+/refcocog
|
423 |
-
</pre>
|
424 |
-
</details>
|
425 |
-
|
426 |
-
## Visual Entailment
|
427 |
-
We provide steps for you to reproduce our results in visual entailment. See the details below.
|
428 |
-
|
429 |
-
<details>
|
430 |
-
<summary><b>1. Prepare the Dataset & Checkpoints</b></summary>
|
431 |
-
<p>
|
432 |
-
Download data (see <a href="datasets.md">datasets.md</a>) and models (see <a href="checkpoints.md">checkpoints.md</a>) and put them in the correct directory. Each line of the processed dataset represents a sample with the following format. The information of uniq-id, image-id, image base64 string, hypothesis, caption (or text premise), label are separated by tabs.
|
433 |
-
</p>
|
434 |
-
<pre>
|
435 |
-
252244149.jpg#1r1n 252244149 /9j/4AAQ...MD/2Q== a man in pink and gold is chewing on a wooden toothpick. a man in pink is chewing a toothpick on the subway. neutral
|
436 |
-
</pre>
|
437 |
-
</details>
|
438 |
-
<details>
|
439 |
-
<summary><b>2. Finetuning</b></summary>
|
440 |
-
<p>
|
441 |
-
In our experiments, the SNLI-VE finetuning is performed on 8 NVIDIA-V100 GPUs with 32GB memory. In this task, we experimented with only a few sets of hyperparameters. We believe that proper hyperparameter tuning can lead to further accuracy improvement.
|
442 |
-
</p>
|
443 |
-
<pre>
|
444 |
-
cd run_scripts/snli_ve
|
445 |
-
nohup sh train_snli_ve.sh > train_snli_ve.out & # finetune for snli_ve
|
446 |
-
</pre>
|
447 |
-
</details>
|
448 |
-
<details>
|
449 |
-
<summary><b>3. Inference</b></summary>
|
450 |
-
<p>
|
451 |
-
Run the following command to obtain the results.
|
452 |
-
</p>
|
453 |
-
<pre>
|
454 |
-
cd run_scripts/snli_ve ; sh evaluate_snli_ve.sh dev # specify 'dev' or 'test'
|
455 |
-
</pre>
|
456 |
-
</details>
|
457 |
-
|
458 |
-
## GLUE
|
459 |
-
Here we provide steps for you to finetune and evaluate our model on language understanding tasks. We demonstrate our practice for the GLUE benchmark.
|
460 |
-
|
461 |
-
<details>
|
462 |
-
<summary><b>1. Prepare the Dataset & Checkpoints</b></summary>
|
463 |
-
<p>
|
464 |
-
Download data (see <a href="datasets.md">datasets.md</a>) and models (see <a href="checkpoints.md">checkpoints.md</a>) and put them in the correct directory. we provide 7 language understanding datasets from GLUE benchmark, including COLA, MNLI, MRPC, QNLI, QQP, RTE and SST2. More details about these datasets can be found in this <a href="https://openreview.net/pdf?id=rJ4km2R5t7">link</a>.
|
465 |
-
</p>
|
466 |
-
</details>
|
467 |
-
<details>
|
468 |
-
<summary><b>2. Finetuning</b></summary>
|
469 |
-
<p>
|
470 |
-
For each task, we have tried multiple sets of hyperparameters (including learning rate, batch size, training epochs). The results under different sets of hyperparameters can be found in <code>${log_dir}</code>.
|
471 |
-
</p>
|
472 |
-
<pre>
|
473 |
-
cd run_scripts/glue
|
474 |
-
nohup sh train_cola.sh > train_cola.out & # finetune for cola
|
475 |
-
nohup sh train_mnli.sh > train_mnli.out & # finetune for mnli
|
476 |
-
nohup sh train_mrpc.sh > train_mrpc.out & # finetune for mrpc
|
477 |
-
nohup sh train_qnli.sh > train_qnli.out & # finetune for qnli
|
478 |
-
nohup sh train_qqp.sh > train_qqp.out & # finetune for qqp
|
479 |
-
nohup sh train_rte.sh > train_rte.out & # finetune for rte
|
480 |
-
nohup sh train_sst2.sh > train_sst2.out & # finetune for sst2
|
481 |
-
</pre>
|
482 |
-
</details>
|
483 |
-
|
484 |
-
## Image Classification on ImageNet-1K
|
485 |
-
We provide the finetuning and inference codes which reproduce **85.0 ImageNet-1K accuracy**, slightly better than reported in our paper.
|
486 |
-
|
487 |
-
<details>
|
488 |
-
<summary><b>1. Prepare the Dataset & Checkpoints</b></summary>
|
489 |
-
<p>
|
490 |
-
Download data (see <a href="datasets.md">datasets.md</a>) and models (see <a href="checkpoints.md">checkpoints.md</a>) and put them in the correct directory. Our provided data is derived from the original <a href="http://image-net.org/">ImageNet-1K</a> (ILSVRC2012 train & validation) dataset and shares the same data split with it. To formulate the classification task into seq2seq paradigm, we use the <a href="https://github.com/HoldenCaulfieldRye/caffe/blob/master/data/ilsvrc12/synset_words.txt">synset words</a> provided by Caffe as the generation target for each image class. Each line of the processed dataset represents a sample with the following format. The information of image base64 string, classification label (1-indexed, conform to the order in <code>synset_words.txt</code>), synset words of the label are separated by tabs.
|
491 |
-
</p>
|
492 |
-
<pre>
|
493 |
-
_9j_4AAQS...fzX__Z 769 rugby ball
|
494 |
-
</pre>
|
495 |
-
</details>
|
496 |
-
<details>
|
497 |
-
<summary><b>2. Shuffle the Training Data</b></summary>
|
498 |
-
<p>
|
499 |
-
(Optional, but achieves better finetuning accuracy): If the disk storage is sufficient, we recommend to prepare the shuffled training data for each epoch in advance. In our experiments, we use shuffling which brings around <b>+0.2</b> improvement on ImageNet-1K accuracy.
|
500 |
-
</p>
|
501 |
-
<pre>
|
502 |
-
cd dataset/imagenet_1k_data
|
503 |
-
ln imagenet_1k_train.tsv imagenet_1k_train_1.tsv
|
504 |
-
for idx in `seq 1 9`;do shuf imagenet_1k_train_${idx}.tsv > imagenet_1k_train_$[${idx}+1].tsv;done # each file is used for an epoch one by one
|
505 |
-
</pre>
|
506 |
-
</details>
|
507 |
-
<details>
|
508 |
-
<summary><b>3. Finetuning</b></summary>
|
509 |
-
<p>
|
510 |
-
In our experiments, the ImageNet-1K finetuning is performed on 2 8-A100-GPU servers (<i>with RDMA</i>). Here provides the finetuning script <code>train_imagenet_distributed.sh</code>, which supports multi-server distributed training (as well as single-server training). Please refer to the comments in the beginning of the script and set the configs correctly according to your distribution environment. If you have shuffled the training data in the previous step, please correctly specify the training data path following the guide in the script comments. <b>The command should be run on each worker.</b> For quick evaluation during finetuning, by default we sample 20% of the original validation split and report accuracy on this subset after each epoch. The accuracy on the validation subset is generally ±0.1 relative to accuracy on the whole validation split.
|
511 |
-
</p>
|
512 |
-
<pre>
|
513 |
-
# run on each worker after the distributed and data configs have been correctly set following the guide in train_imagenet_distributed.sh
|
514 |
-
cd run_scripts/image_classify
|
515 |
-
bash train_imagenet_distributed.sh
|
516 |
-
</pre>
|
517 |
-
<p>
|
518 |
-
In our experiments, the finetuning costs around 80 hours (for 32 epochs). The best accuracy on validation subset during finetuning will be around 85.0. The log is saved in <code>${log_dir}</code>.
|
519 |
-
</p>
|
520 |
-
</details>
|
521 |
-
<details>
|
522 |
-
<summary><b>4. Inference</b></summary>
|
523 |
-
<p>
|
524 |
-
To get the validation accuracy on the whole ImageNet-1K validation set, run the following command. The evaluation costs around 10 GPU hours. The accuracy will be reported in the stdout (expected to be around <b>85.0</b>).
|
525 |
-
</p>
|
526 |
-
<pre>
|
527 |
-
cd run_scripts/image_classify ; sh evaluate_imagenet.sh # inference & evaluate for imagenet-1k
|
528 |
-
</pre>
|
529 |
-
</details>
|
530 |
-
|
531 |
-
## Gigaword
|
532 |
-
We provide steps for you to reproduce our results in Gigaword. See the details below.
|
533 |
-
|
534 |
-
<details>
|
535 |
-
<summary><b>1. Prepare the Dataset & Checkpoints</b></summary>
|
536 |
-
<p>
|
537 |
-
Download data (see <a href="datasets.md">datasets.md</a>) and models (see <a href="checkpoints.md">checkpoints.md</a>) and put them in the correct directory. The original dataset is taken from <a href="https://github.com/microsoft/unilm/">UniLM</a> and we organized the data into the tsv format. Each line of the processed dataset represents a sample with the following format. The information of source and target texts are separated by tabs.
|
538 |
-
</p>
|
539 |
-
<pre>
|
540 |
-
factory orders for manufactured goods rose #.# percent in september... us september factory orders up #.# percent
|
541 |
-
</pre>
|
542 |
-
</details>
|
543 |
-
<details>
|
544 |
-
<summary><b>2. Finetuning</b></summary>
|
545 |
-
<p>
|
546 |
-
Run the following command to train the model.
|
547 |
-
</p>
|
548 |
-
<pre>
|
549 |
-
cd run_scripts/gigaword
|
550 |
-
nohup sh train_gigaword.sh > train_gigaword.out & # finetune for gigaword
|
551 |
-
</pre>
|
552 |
-
</details>
|
553 |
-
<details>
|
554 |
-
<summary><b>3. Inference</b></summary>
|
555 |
-
<p>
|
556 |
-
Run the following command to obtain the results (~36.43 rougeL).
|
557 |
-
</p>
|
558 |
-
<pre>
|
559 |
-
cd run_scripts/gigaword ; sh evaluate_gigaword.sh # inference & evaluate for gigaword
|
560 |
-
</pre>
|
561 |
-
</details>
|
562 |
-
|
563 |
-
<br></br>
|
564 |
-
|
565 |
-
# Gallery
|
566 |
-
Below we provide examples of OFA in text-to-image generation and open-ended VQA. Also, we demonstrate its performance in unseen task (Grounded QA) as well as unseen domain (Visual Grounding on images from unseen domains).
|
567 |
-
|
568 |
-
## Text-to-Image Generation
|
569 |
-
|
570 |
-
![case1](examples/case1.png)
|
571 |
-
|
572 |
-
|
573 |
-
## Open-Ended VQA
|
574 |
-
![open_vqa](examples/open_vqa.png)
|
575 |
-
|
576 |
-
## Grounded QA (unseen task)
|
577 |
-
![grounded_qa](examples/grounded_qa.png)
|
578 |
-
|
579 |
-
## Visual Grounding (unseen domain)
|
580 |
-
![vg](examples/viusal_grounding.png)
|
581 |
-
<br></br>
|
582 |
-
|
583 |
-
# Related Codebase
|
584 |
-
* [Fairseq](https://github.com/pytorch/fairseq)
|
585 |
-
* [taming-transformers](https://github.com/CompVis/taming-transformers)
|
586 |
-
<br></br>
|
587 |
-
|
588 |
-
|
589 |
-
# Getting Involved
|
590 |
-
Feel free to submit Github issues or pull requests. Welcome to contribute to our project!
|
591 |
-
|
592 |
-
To contact us, never hestitate to send an email to `[email protected]` or `[email protected]`!
|
593 |
-
<br></br>
|
594 |
-
|
595 |
-
|
596 |
-
# Citation
|
597 |
-
Please cite our paper if you find it helpful :)
|
598 |
-
|
599 |
-
```
|
600 |
-
@article{wang2022ofa,
|
601 |
-
author = {Peng Wang and
|
602 |
-
An Yang and
|
603 |
-
Rui Men and
|
604 |
-
Junyang Lin and
|
605 |
-
Shuai Bai and
|
606 |
-
Zhikang Li and
|
607 |
-
Jianxin Ma and
|
608 |
-
Chang Zhou and
|
609 |
-
Jingren Zhou and
|
610 |
-
Hongxia Yang},
|
611 |
-
title = {OFA: Unifying Architectures, Tasks, and Modalities Through a Simple Sequence-to-Sequence
|
612 |
-
Learning Framework},
|
613 |
-
journal = {CoRR},
|
614 |
-
volume = {abs/2202.03052},
|
615 |
-
year = {2022}
|
616 |
-
}
|
617 |
-
```
|
618 |
-
<br></br>
|
|
|
1 |
+
---
|
2 |
+
title: UnIVAL
|
3 |
+
emoji: 🌍
|
4 |
+
colorFrom: purple
|
5 |
+
colorTo: pink
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 3.12.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: true
|
10 |
+
license: apache-2.0
|
11 |
+
---
|
12 |
+
Generic interface for UnIVAL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|