最开始知道题目中的论文,是看到BERT做数据增强的论文,Conditional BERT Contextual Augmentation,看到有同学分析的文章(见https://zhuanlan.zhihu.com/p/53141568),文章中提到了Kobayashi的这篇论文,刚好有开源的代码,作为英专毕业数年的不合格程序媛,自己写代码是不现实的,决定用开源的代码复现一下实验结果,记录以下作为参考。
原代码在Github上的地址:<https://github.com/pfnet-research/contextual_augmentation>
按照readme中的顺序,从上到下依次执行命令:
1. Prepare a label-conditional bi-directional language model
(1) # download wikitext
sh prepare_rawwikitext.sh
(2) # install chainer and spacy
命令:pip install cupy--->> pip install cupy-cuda90
提示:
Collecting cupy-cuda90
Downloading https://files.pythonhosted.org/packages/30/a5/89d64c99a8b17c1ed64fcc0c9207ff6bc70efe90a9c567d616eb910aee34/cupy_cuda90-6.2.0-cp36-cp36m-manylinux1_x86_64.whl (270.4MB)
|████████████████████████████████| 270.4MB 17kB/s
Collecting fastrlock>=0.3 (from cupy-cuda90)
Requirement already satisfied: numpy>=1.9.0 in /dnn4_added/wanglina/wln_install/python-3.6/lib/python3.6/site-packages (from cupy-cuda90) (1.16.4)
Requirement already satisfied: six>=1.9.0 in /dnn4_added/wanglina/wln_install/python-3.6/lib/python3.6/site-packages (from cupy-cuda90) (1.12.0)
Installing collected packages: fastrlock, cupy-cuda90
Successfully installed cupy-cuda90-6.2.0 fastrlock-0.4
命令:pip install chainer
提示:
Collecting chainer
Downloading https://files.pythonhosted.org/packages/2c/5a/86c50a0119a560a39d782c4cdd9b72927c090cc2e3f70336e01b19a5f97a/chainer-6.2.0.tar.gz (873kB)
|████████████████████████████████| 880kB 174kB/s
Requirement already satisfied: setuptools in /dnn4_added/wanglina/wln_install/python-3.6/lib/python3.6/site-packages (from chainer) (28.8.0)
Collecting typing<=3.6.6 (from chainer)
Collecting typing_extensions<=3.6.6 (from chainer)
Downloading https://files.pythonhosted.org/packages/62/4f/392a1fa2873e646f5990eb6f956e662d8a235ab4