GLUEのQNLIでdata2vecのファインチューニングを試す
#GLUEベンチマーク
Finetuning data2vec-text on GLUE を読み解く
https://github.com/pytorch/fairseq/tree/11b2830d29aed8043e5011d64e14004347a08b50/examples/data2vec#finetuning-data2vec-text-on-glue
examples/robertaの下のREADMEを参照する
https://github.com/pytorch/fairseq/blob/main/examples/roberta/README.glue.md
データの準備
1. Download the data from GLUE website
GLUEのデータのダウンロード
glue_data/QNLIに展開される
2. Preprocess GLUE task data
https://github.com/pytorch/fairseq/blob/11b2830d29aed8043e5011d64e14004347a08b50/examples/roberta/preprocess_GLUE_tasks.sh
download bpe encoder.json, vocabulary and fairseq dictionary: wget
BPE encode: python -m examples.roberta.multiprocessing_bpe_encoder --workers 60 ...
Run fairseq preprocessing: fairseq-preprocess --workers 60 ...
QNLI-binができた(glue_dataと同じ階層)
3. Fine-tuning on GLUE task(=data2vecのREADMEの読み解きたい箇所 と思われる)
code:shell
$ python fairseq_cli/hydra_train.py -m \
--config-dir examples/roberta/config/finetuning \
--config-name qnli \
task.data=$PWD/QNLI-bin \
checkpoint.restore_file=examples/data2vec/nlp_base.pt
task.dataは絶対パスで指定
hydraの記録ディレクトリでQNLI-bin/input0/dict.txtを探そうとした
GPUが必要っぽい
AssertionError: Torch not compiled with CUDA enabled
accuracyを確認
ref: https://github.com/pytorch/fairseq/blob/main/examples/roberta/README.glue.md#inference-on-glue-task
https://gist.github.com/ftnext/90e1efb6d94d3b318bf4f5de6e97da31
https://nikkie-ftnext.hatenablog.com/entry/data2vec-nlp-base-first-step にアウトプット