Skip to content

Commit 455dbdf

Browse files
[feat] Add UNITER yaml config
Add configs for UNITER vqa2 finetuning. ghstack-source-id: a0301cb Pull Request resolved: #1128
1 parent 3185734 commit 455dbdf

File tree

4 files changed

+169
-0
lines changed

4 files changed

+169
-0
lines changed

mmf/configs/zoo/models.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,3 +546,21 @@ unit:
546546
- url: mmf://models/unit_models/unit.all_8_datasets.shared_dec_with_coco_init_without_task_embedding.tar.gz
547547
file_name: unit.all_8_datasets.shared_dec_with_coco_init_without_task_embedding.tar.gz
548548
hashcode: c4a3c1072f07e605de76402ff7c0e2bc8d4514561c52dc94b3d28b3d4d7f698e
549+
550+
uniter:
551+
defaults: ${uniter.pretrained}
552+
pretrained:
553+
version: 1.0_2020_11_29
554+
resources:
555+
- url: mmf://models/uniter/uniter.pretrained.tar.gz
556+
file_name: uniter.pretrained.tar.gz
557+
hashcode: e843e65a3d8b4ed353779b96d654dde0440f5f04a79b3b4740309d40a3542664
558+
559+
villa:
560+
defaults: ${villa.pretrained}
561+
pretrained:
562+
version: 1.0_2020_11_29
563+
resources:
564+
- url: mmf://models/uniter/villa.pretrained.tar.gz
565+
file_name: villa.pretrained.tar.gz
566+
hashcode: 7a8f31421ef644fddc99bd142a0090660573dd526a779d025253c3fd996754fc

projects/uniter/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# UNITER
2+
3+
This repository contains the code for pytorch implementation of UNITER model, released originally under this ([repo](https://github.com/ChenRocks/UNITER/)). Please cite the following papers if you are using UNITER model from mmf:
4+
5+
* Chen, Y.-C., Li, L., Yu, L., Kholy, A. E., Ahmed, F., Gan,
6+
Z., Cheng, Y., and jing Liu, J. *Uniter: Universal imagetext representation learning.* In European Conference on
7+
Computer Vision, 2020b. ([arXiV](https://arxiv.org/pdf/1909.11740))
8+
```
9+
@inproceedings{chen2020uniter,
10+
title={Uniter: Universal image-text representation learning},
11+
author={Chen, Yen-Chun and Li, Linjie and Yu, Licheng and Kholy, Ahmed El and Ahmed, Faisal and Gan, Zhe and Cheng, Yu and Liu, Jingjing},
12+
booktitle={ECCV},
13+
year={2020}
14+
}
15+
```
16+
17+
18+
Please see [https://mmf.sh/docs/projects/uniter](https://mmf.sh/docs/projects/uniter) for more details on how to use the UNITER model.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
model_config:
2+
uniter:
3+
do_pretraining: true
4+
mask_probability: 0.15
5+
tasks:
6+
- mlm
7+
- itm
8+
- mrc
9+
- mrfr
10+
- wra
11+
heads:
12+
mlm:
13+
type: mlm
14+
vocab_size: 28996
15+
itm:
16+
type: itm
17+
mrc:
18+
type: mrc
19+
mrfr:
20+
type: mrfr
21+
wra:
22+
type: wra
23+
text_embeddings:
24+
vocab_size: 28996
25+
26+
dataset_config:
27+
masked_coco:
28+
false_caption: true
29+
false_caption_probability: 0.1
30+
zoo_requirements:
31+
- coco.defaults
32+
return_features_info: true
33+
use_features: true
34+
use_images: false
35+
processors:
36+
masked_token_processor:
37+
type: uniter_text_tokenizer
38+
params:
39+
from_pretrained: bert-base-cased
40+
tokenizer_config:
41+
type: bert-base-cased
42+
params:
43+
do_lower_case: false
44+
mask_probability: 0.15
45+
max_seq_length: 25
46+
images:
47+
train:
48+
- coco/defaults/images/train2014
49+
- coco/defaults/images/val2014
50+
- coco/defaults/images/train2014
51+
- coco/defaults/images/val2014
52+
- coco/defaults/images/val2014
53+
val:
54+
- coco/defaults/images/val2014
55+
test:
56+
- coco/defaults/images/test2015
57+
58+
optimizer:
59+
type: adam_w
60+
params:
61+
lr: 5e-5
62+
eps: 1e-8
63+
64+
scheduler:
65+
type: warmup_linear
66+
params:
67+
num_warmup_steps: 6000
68+
num_training_steps: 60000
69+
70+
training:
71+
batch_size: 480
72+
lr_scheduler: true
73+
# Don't forget to update schedule_attributes if you update this
74+
max_updates: 60000
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# includes:
2+
# - ../projects/unit/configs/vqa2_dataset_cfg.yaml
3+
4+
model_config:
5+
uniter:
6+
do_pretraining: false
7+
tasks: vqa2
8+
heads:
9+
vqa2:
10+
type: mlp
11+
num_labels: 3129
12+
lr_multiplier: 10
13+
losses:
14+
vqa2: logit_bce
15+
text_embeddings:
16+
vocab_size: 28996
17+
18+
dataset_config:
19+
vqa2:
20+
return_features_info: true
21+
use_features: true
22+
use_images: false
23+
processors:
24+
text_processor:
25+
type: uniter_text_tokenizer
26+
params:
27+
from_pretrained: bert-base-cased
28+
tokenizer_config:
29+
type: bert-base-cased
30+
params:
31+
do_lower_case: false
32+
mask_probability: 0
33+
max_seq_length: 60
34+
35+
optimizer:
36+
type: adam_w
37+
params:
38+
lr: 8e-5
39+
eps: 1e-8
40+
weight_decay: 0.01
41+
42+
scheduler:
43+
type: warmup_linear
44+
params:
45+
num_warmup_steps: 600
46+
num_training_steps: 5000
47+
48+
evaluation:
49+
metrics:
50+
- vqa_accuracy
51+
52+
training:
53+
batch_size: 5120
54+
lr_scheduler: true
55+
# Don't forget to update schedule_attributes if you update this
56+
max_updates: 5000
57+
early_stop:
58+
criteria: vqa2/vqa_accuracy
59+
minimize: false

0 commit comments

Comments
 (0)