Archive of AI

Source Snapshot / 2022-02-07-alibaba-qwen-ofa-unified-multimodal-3

OFA 官方代码与模型仓库

Linked event: 2022-02-07 · OFA Unified Multimodal Framework Released, Later Published at ICML 2022

Publisher
OFA-Sys/GitHub
Archived
2026-11-23
Capture Method
Direct page capture
HTTP / SHA-256
200 / 808e8876e4a11b58
Original URL
Open source ↗
Wayback Backup
Not archived
This page preserves a plain-text static snapshot against link rot. When citing figures, tables, or full legal terms, verify against the original URL and Wayback Machine archive.

[来源关键摘录] 仓库提供 Apache 2.0 代码许可、模型检查点、预训练与微调教程,支持图像描述、问答、定位等任务。

[正文前段节选] Skip to content

Navigation Menu

Appearance settings

You signed in with another tab or window. Reload to refresh your session.

You signed out in another tab or window. Reload to refresh your session.

You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

Repository navigation

NotificationsYou must be signed in to change notification settings

Fork249 (249)

Star2.6k (2.6k)You must be signed in to star a repository

Official repository of OFA (ICML 2022). Paper: OFA: Unifying Architectures, Tasks, and Modalities Through a Simple Sequence-to-Sequence Learning Framework

chineseimage-captioningmultimodalpretrained-modelspretrainingpromptprompt-tuningreferring-expression-comprehensiontext-to-image-synthesisvision-languagevisual-question-answering

Apache-2.0 license

Custom properties

Report repository

BranchesTags

Open more actions menu

Latest commit

Folders and files

Last commit message

Last commit date

README_EncouragingLoss.md

README_mmspeech.md

checkpoints.md

checkpoints_cn.md

modelscope.md

prompt_tuning.md

requirements.txt

transformers.md

View all files

Repository files navigation

ModelScope  |  Checkpoints  |  Colab  |  Demo  |  Paper   |  Blog

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), VQA (link), 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|CN] or Hugging Face ckpt).

We sincerely welcome contributions to our project. Feel free to contact us or send us issues / PRs!

Online Demos

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:

Image Captioning [ModelScope | Spaces]

Visual Grounding [ModelScope | Spaces]

Visual Question Answering [ModelScope | Spaces]

Text-to-Image Generation [ModelScope | Spaces]

Generic Interface [Spaces]

Chinese OCR [ModelScope | Spaces]

Also we provide Colab notebooks for you to better perceive the procedures. Click here to check them out!

Use in Hugging Face Transformers

We support the inference of OFA in Hugging Face Transformers. Check the README and Colab Notebook for more information. Codes are released in this branch https://github.com/OFA-Sys/OFA/tree/feature/add_transformers

2023.5.11: Two papers (OFA-OCR and OFA-prompt) are accepted by ACL. The evaluation scripts and checkpoints of OFA-OCR are released.

2023.1.11: Released MuE (https://arxiv.org/abs/2211.11152), which significantly accelerates OFA with little performance degradation. Many thanks to the first author, Shengkun Tang (@Tangshengku). See the branch feature/MuE and PR for more information.

2022.12.20: Released OFA-OCR, a model for Chinese text recognition based on OFA. Check our paper and demo.

2022.12.7: Released the MMSpeech an ASR pre-training method based on OFA. Check our paper here! Please see the README_mmspeech.md for further details.

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. Temporarily, we only provide base-size and large-size pretrained checkpoints and finetuned checkpoints on MUGE Caption and the Chinese version of RefCOCO(-/+/g) (to release soon).

2022.8.5: Released support of prompt tuning for OFA. Check our paper here! Please see the prompt_tuning.md for further details.

2022.7.7: Updated support of OFA on Hugging Face transformers (fixed bugs in forward, add sequence generator from Fairseq to ensure performance, etc.). Refer to the doc transformers.md and the branch feature/add_transformers.

2022.6.17: Released the pretrained checkpoint of OFA-Huge. To use it, set --arch=ofa_huge in the script.

2022.5.15: OFA was accepted by ICML 2022

2022.4.28: Add support of inference on **Hugging Face transformers**. For how to use it, please refer to the doc [transformers.md](transformers.md) and our [Hugging Face models](https://huggingface.co/OFA-Sys).

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.

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.

2022.3.21: Released codes for pretraining OFA.

2022.3.18: Released the finetuned OFA-Base (~180M parameters) checkpoints and running scripts for vision & language tasks, including: 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).

2022.3.11: Released the finetuning & inference code/checkpoints for Gigaword.

2022.3.08: Released the pretrained checkpoint of OFA-Base in checkpoints.md. To use OFA-Base, you just need to load ofa_base.pt and change --arch=ofa_large to --arch=ofa_base in the training scripts.

2022.3.07: Released the finetuning & inference code/checkpoints for Image Classification, which achieves 85.0 accuracy on ImageNet-1K, slightly better than reported in OFA paper.

2022.3.04: Released the finetuning & inference code/checkpoints for Text-to-Image Generation.

2022.3.03: Released the finetuning & inference code/checkpoints for SNLI-VE and GLUE.

2022.2.22: Released the finetuning & inference code/checkpoints for Visual Question Answering, which can reproduce the reported VQA accuracy in OFA paper (80.02 on test-std). Check our results on the VQA Challenge.

2022.2.15: Released finetuning & inference code/checkpoints for Referring Expression Comprehension

2022.2.10: Released the inference code & finetuned checkpoint for Image captioning, which can reproduce the results on COCO Karparthy test split (149.6 CIDEr). OFA also achieves No.1 on the COCO image captioning online leaderboard Link (marked as M6-Team).

We list the parameters and pretrained checkpoints of OFAs below. For finetuned checkpoints, please refer to checkpoints.md.

ModelCkptParamsBackboneHidden sizeIntermediate sizeNum. of headsEnc layersDec layers

OFATinyDownload33MResNet502561024444

OFAMediumDownload93MResNet1015122048844

OFABaseDownload180MResNet10176830721266

OFALargeDownload470MResNet15210244096161212

OFAHugeDownload930MResNet15212805120162412

Below we demonstrate the results of OFAs on cross-modal understanding and generation.

TaskImage CaptioningVQAVisual EntailmentReferring Expression Comprehension

DatasetCOCOVQA v2SNLI-VERefCOCORefCOCO+RefCOCOg

SplitKarpathy test (CE/CIDEr)test-dev/test-stdval/testval/test-a/test-bval/test-a/test-bval-u/test-u

MetricCIDErAcc.Acc.Acc.

OFATiny119.0 / 128.770.3 / 70.485.3 / 85.280.20 / 84.07 / 75.0068.22 / 75.13 / 57.6672.02 / 69.74

OFAMedium130.4 / 140.375.4 / 75.586.6 / 87.085.34 / 87.68 / 77.9276.09 / 83.04 / 66.2578.76 / 78.58

OFABase138.2 / 146.778.0 / 78.189.3 / 89.288.48 / 90.67 / 83.3081.39 / 87.15 / 74.2982.29 / 82.31

OFALarge142.2 / 150.780.4 / 80.790.3 / 90.290.05 / 92.93 / 85.2685.80 / 89.87 / 79.2285.89 / 86.55

OFAHuge145.3 / 154.982.0 / 82.091.0 / 91.292.04 / 94.03 / 88.4487.86 / 91.70 / 80.7188.07 / 88.78

Requirements

python 3.7.4

pytorch 1.8.1

torchvision 0.9.1

JAVA 1.8 (for COCO evaluation)

Installation

git clone https://github.com/OFA-Sys/OFA

pip install -r requirements.txt

Datasets and Checkpoints

[...内容已截断,完整版请查看原文或 Wayback 快照]