From 23e051135e1b74239361c97c95bf0b69dce134f4 Mon Sep 17 00:00:00 2001 From: weili-nlp Date: Fri, 20 May 2022 18:01:06 +0800 Subject: [PATCH 1/4] open release code for UNIMO-2 --- NLP/UNIMO-2/.idea/UNIMO2-Open.iml | 12 + NLP/UNIMO-2/.idea/misc.xml | 4 + NLP/UNIMO-2/.idea/modules.xml | 8 + NLP/UNIMO-2/.idea/vcs.xml | 6 + NLP/UNIMO-2/.idea/workspace.xml | 90 + NLP/UNIMO-2/CHANGELOG.md | 24 + NLP/UNIMO-2/README.md | 216 + NLP/UNIMO-2/ci.yml | 18 + NLP/UNIMO-2/data/download_MNLI-AX.sh | 14 + NLP/UNIMO-2/env_local/env.sh | 25 + NLP/UNIMO-2/env_local/utils.sh | 105 + NLP/UNIMO-2/images/cross-modal.graffle | Bin 0 -> 700658 bytes NLP/UNIMO-2/images/cross-modal.png | Bin 0 -> 450406 bytes NLP/UNIMO-2/images/paper.png | Bin 0 -> 211698 bytes NLP/UNIMO-2/images/textual.png | Bin 0 -> 156160 bytes NLP/UNIMO-2/images/visual.png | Bin 0 -> 99776 bytes .../model_files/config/grounded_base_en.json | 31 + .../model_files/config/grounded_large_en.json | 31 + .../model_files/config/roberta_base_en.json | 14 + .../model_files/config/roberta_large_en.json | 14 + .../model_files/config/vit_base_en.json | 26 + .../model_files/config/vit_large_en.json | 26 + .../dict/roberta_base_en.encoder.json | 1 + .../dict/roberta_base_en.vocab.bpe | 50001 +++++++++++++++ .../dict/roberta_base_en.vocab.txt | 50265 ++++++++++++++++ NLP/UNIMO-2/requirements.txt | 60 + .../MNLI-AX/model_conf | 58 + .../classification-grounded/MNLI-AX/run.sh | 132 + .../classification-grounded/method_conf | 5 + .../img2txt-grounded/coco-oscar/model_conf | 80 + .../script/img2txt-grounded/coco-oscar/run.sh | 124 + .../script/img2txt-grounded/method_conf | 5 + .../Flickr30k-fleet/model_conf | 62 + .../retrieval-grounded/Flickr30k-fleet/run.sh | 127 + .../script/retrieval-grounded/method_conf | 5 + NLP/UNIMO-2/setup.cfg | 80 + NLP/UNIMO-2/setup.py | 18 + NLP/UNIMO-2/src/__init__.py | 0 NLP/UNIMO-2/src/__main__.py | 21 + NLP/UNIMO-2/src/args/__init__.py | 12 + .../src/args/classification_grounded_args.py | 130 + NLP/UNIMO-2/src/args/img2txt_oscar_args.py | 146 + .../src/args/retrieval_grounded_args.py | 134 + NLP/UNIMO-2/src/eval/__init__.py | 12 + NLP/UNIMO-2/src/eval/gen_eval.py | 131 + NLP/UNIMO-2/src/finetune/__init__.py | 0 .../src/finetune/classifier_grounded.py | 201 + NLP/UNIMO-2/src/finetune/glue_eval.py | 222 + NLP/UNIMO-2/src/finetune/img2txt_oscar.py | 1690 + NLP/UNIMO-2/src/finetune/img_eval.py | 218 + .../src/finetune/retrieval_grounded_fleet.py | 256 + NLP/UNIMO-2/src/finetune/trigram_blocking.py | 175 + NLP/UNIMO-2/src/launch.py | 137 + NLP/UNIMO-2/src/model/__init__.py | 0 NLP/UNIMO-2/src/model/roberta_tokenization.py | 633 + NLP/UNIMO-2/src/model/transformer_encoder.py | 400 + NLP/UNIMO-2/src/model/unimo_grounded.py | 1494 + .../src/model/unimo_grounded_baseline.py | 948 + .../src/model/vision_transformer_encoder.py | 400 + NLP/UNIMO-2/src/reader/__init__.py | 0 .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 174 bytes .../reader/classification_grounded_reader.py | 252 + .../src/reader/img2txt_oscar_reader.py | 404 + .../src/reader/retrieval_grounded_reader.py | 399 + .../src/reader/unimo_grounded_batching.py | 552 + NLP/UNIMO-2/src/run_classifier_grounded.py | 515 + NLP/UNIMO-2/src/run_img2txt_oscar.py | 337 + .../src/run_retrieval_grounded_fleet.py | 326 + NLP/UNIMO-2/src/utils/__init__.py | 0 NLP/UNIMO-2/src/utils/args.py | 57 + NLP/UNIMO-2/src/utils/bleu.py | 107 + NLP/UNIMO-2/src/utils/cmrc2018_eval.py | 153 + NLP/UNIMO-2/src/utils/extract_eval_res.py | 64 + NLP/UNIMO-2/src/utils/fp16.py | 204 + NLP/UNIMO-2/src/utils/image_utils.py | 240 + NLP/UNIMO-2/src/utils/init.py | 141 + NLP/UNIMO-2/src/utils/new_stat_res.py | 99 + NLP/UNIMO-2/src/utils/optimization.py | 136 + NLP/UNIMO-2/src/utils/optimization_fleet.py | 106 + .../src/utils/optimization_fleet_new.py | 92 + NLP/UNIMO-2/src/utils/pos_emb_interpolate.py | 50 + NLP/UNIMO-2/src/utils/stat_res.py | 72 + NLP/UNIMO-2/src/utils/utils.py | 47 + 83 files changed, 113400 insertions(+) create mode 100644 NLP/UNIMO-2/.idea/UNIMO2-Open.iml create mode 100644 NLP/UNIMO-2/.idea/misc.xml create mode 100644 NLP/UNIMO-2/.idea/modules.xml create mode 100644 NLP/UNIMO-2/.idea/vcs.xml create mode 100644 NLP/UNIMO-2/.idea/workspace.xml create mode 100644 NLP/UNIMO-2/CHANGELOG.md create mode 100644 NLP/UNIMO-2/README.md create mode 100644 NLP/UNIMO-2/ci.yml create mode 100644 NLP/UNIMO-2/data/download_MNLI-AX.sh create mode 100644 NLP/UNIMO-2/env_local/env.sh create mode 100644 NLP/UNIMO-2/env_local/utils.sh create mode 100644 NLP/UNIMO-2/images/cross-modal.graffle create mode 100644 NLP/UNIMO-2/images/cross-modal.png create mode 100644 NLP/UNIMO-2/images/paper.png create mode 100644 NLP/UNIMO-2/images/textual.png create mode 100644 NLP/UNIMO-2/images/visual.png create mode 100644 NLP/UNIMO-2/model_files/config/grounded_base_en.json create mode 100644 NLP/UNIMO-2/model_files/config/grounded_large_en.json create mode 100644 NLP/UNIMO-2/model_files/config/roberta_base_en.json create mode 100644 NLP/UNIMO-2/model_files/config/roberta_large_en.json create mode 100644 NLP/UNIMO-2/model_files/config/vit_base_en.json create mode 100644 NLP/UNIMO-2/model_files/config/vit_large_en.json create mode 100644 NLP/UNIMO-2/model_files/dict/roberta_base_en.encoder.json create mode 100644 NLP/UNIMO-2/model_files/dict/roberta_base_en.vocab.bpe create mode 100644 NLP/UNIMO-2/model_files/dict/roberta_base_en.vocab.txt create mode 100644 NLP/UNIMO-2/requirements.txt create mode 100644 NLP/UNIMO-2/script/classification-grounded/MNLI-AX/model_conf create mode 100644 NLP/UNIMO-2/script/classification-grounded/MNLI-AX/run.sh create mode 100644 NLP/UNIMO-2/script/classification-grounded/method_conf create mode 100644 NLP/UNIMO-2/script/img2txt-grounded/coco-oscar/model_conf create mode 100644 NLP/UNIMO-2/script/img2txt-grounded/coco-oscar/run.sh create mode 100644 NLP/UNIMO-2/script/img2txt-grounded/method_conf create mode 100644 NLP/UNIMO-2/script/retrieval-grounded/Flickr30k-fleet/model_conf create mode 100644 NLP/UNIMO-2/script/retrieval-grounded/Flickr30k-fleet/run.sh create mode 100644 NLP/UNIMO-2/script/retrieval-grounded/method_conf create mode 100644 NLP/UNIMO-2/setup.cfg create mode 100755 NLP/UNIMO-2/setup.py create mode 100644 NLP/UNIMO-2/src/__init__.py create mode 100644 NLP/UNIMO-2/src/__main__.py create mode 100644 NLP/UNIMO-2/src/args/__init__.py create mode 100644 NLP/UNIMO-2/src/args/classification_grounded_args.py create mode 100644 NLP/UNIMO-2/src/args/img2txt_oscar_args.py create mode 100644 NLP/UNIMO-2/src/args/retrieval_grounded_args.py create mode 100644 NLP/UNIMO-2/src/eval/__init__.py create mode 100644 NLP/UNIMO-2/src/eval/gen_eval.py create mode 100644 NLP/UNIMO-2/src/finetune/__init__.py create mode 100644 NLP/UNIMO-2/src/finetune/classifier_grounded.py create mode 100644 NLP/UNIMO-2/src/finetune/glue_eval.py create mode 100644 NLP/UNIMO-2/src/finetune/img2txt_oscar.py create mode 100644 NLP/UNIMO-2/src/finetune/img_eval.py create mode 100644 NLP/UNIMO-2/src/finetune/retrieval_grounded_fleet.py create mode 100644 NLP/UNIMO-2/src/finetune/trigram_blocking.py create mode 100644 NLP/UNIMO-2/src/launch.py create mode 100644 NLP/UNIMO-2/src/model/__init__.py create mode 100644 NLP/UNIMO-2/src/model/roberta_tokenization.py create mode 100644 NLP/UNIMO-2/src/model/transformer_encoder.py create mode 100644 NLP/UNIMO-2/src/model/unimo_grounded.py create mode 100644 NLP/UNIMO-2/src/model/unimo_grounded_baseline.py create mode 100644 NLP/UNIMO-2/src/model/vision_transformer_encoder.py create mode 100644 NLP/UNIMO-2/src/reader/__init__.py create mode 100644 NLP/UNIMO-2/src/reader/__pycache__/__init__.cpython-37.pyc create mode 100644 NLP/UNIMO-2/src/reader/classification_grounded_reader.py create mode 100644 NLP/UNIMO-2/src/reader/img2txt_oscar_reader.py create mode 100644 NLP/UNIMO-2/src/reader/retrieval_grounded_reader.py create mode 100644 NLP/UNIMO-2/src/reader/unimo_grounded_batching.py create mode 100644 NLP/UNIMO-2/src/run_classifier_grounded.py create mode 100644 NLP/UNIMO-2/src/run_img2txt_oscar.py create mode 100644 NLP/UNIMO-2/src/run_retrieval_grounded_fleet.py create mode 100644 NLP/UNIMO-2/src/utils/__init__.py create mode 100644 NLP/UNIMO-2/src/utils/args.py create mode 100644 NLP/UNIMO-2/src/utils/bleu.py create mode 100644 NLP/UNIMO-2/src/utils/cmrc2018_eval.py create mode 100644 NLP/UNIMO-2/src/utils/extract_eval_res.py create mode 100644 NLP/UNIMO-2/src/utils/fp16.py create mode 100644 NLP/UNIMO-2/src/utils/image_utils.py create mode 100644 NLP/UNIMO-2/src/utils/init.py create mode 100644 NLP/UNIMO-2/src/utils/new_stat_res.py create mode 100644 NLP/UNIMO-2/src/utils/optimization.py create mode 100644 NLP/UNIMO-2/src/utils/optimization_fleet.py create mode 100644 NLP/UNIMO-2/src/utils/optimization_fleet_new.py create mode 100644 NLP/UNIMO-2/src/utils/pos_emb_interpolate.py create mode 100644 NLP/UNIMO-2/src/utils/stat_res.py create mode 100644 NLP/UNIMO-2/src/utils/utils.py diff --git a/NLP/UNIMO-2/.idea/UNIMO2-Open.iml b/NLP/UNIMO-2/.idea/UNIMO2-Open.iml new file mode 100644 index 000000000..7c9d48f0f --- /dev/null +++ b/NLP/UNIMO-2/.idea/UNIMO2-Open.iml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/NLP/UNIMO-2/.idea/misc.xml b/NLP/UNIMO-2/.idea/misc.xml new file mode 100644 index 000000000..fdf575236 --- /dev/null +++ b/NLP/UNIMO-2/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/NLP/UNIMO-2/.idea/modules.xml b/NLP/UNIMO-2/.idea/modules.xml new file mode 100644 index 000000000..aa8af3339 --- /dev/null +++ b/NLP/UNIMO-2/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/NLP/UNIMO-2/.idea/vcs.xml b/NLP/UNIMO-2/.idea/vcs.xml new file mode 100644 index 000000000..94a25f7f4 --- /dev/null +++ b/NLP/UNIMO-2/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/NLP/UNIMO-2/.idea/workspace.xml b/NLP/UNIMO-2/.idea/workspace.xml new file mode 100644 index 000000000..89213821b --- /dev/null +++ b/NLP/UNIMO-2/.idea/workspace.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - 1652167313560 - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From f3932a934404899249f80098134df4b2d24e7d4e Mon Sep 17 00:00:00 2001 From: weili-nlp Date: Fri, 20 May 2022 18:21:57 +0800 Subject: [PATCH 4/4] clean code --- .../reader/__pycache__/__init__.cpython-37.pyc | Bin 174 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 NLP/UNIMO-2/src/reader/__pycache__/__init__.cpython-37.pyc diff --git a/NLP/UNIMO-2/src/reader/__pycache__/__init__.cpython-37.pyc b/NLP/UNIMO-2/src/reader/__pycache__/__init__.cpython-37.pyc deleted file mode 100644 index 71148146013e89bc904ce1f15a69d009a4fd4b0c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 174 zcmZ?b<>g`kg7yWI;z9Id5CH>>K!yVl7qb9~6oz01O-8?!3`HPe1o10eKeRZts8~NI zvphA^!c;$?GC3o$C^w)eKPxr4q*y;GF*Bu9zW}HtKQA#yH#t8gRlhVZGdEv1CABOy uC%-_yxF}h_C^a!9wMaicJ~J<~BtBlRpz;=nO>TZlX-=vg$imM+%m4uG=PpM8