Train new SciBERT models using AllenNLP
masterTo train new models or reproduce results using AllenNLP, follow these steps:
Setup Environment: Install dependencies using Python 3.6.
pip install -r requirements.txtPrepare Model Files: Download a PyTorch model and decompress it.
tar -xvf scibert_scivocab_uncased.tarThis creates a directory containing
vocab.txtandweights.tar.gz.Configure Task and Dataset: Modify the
scibert/scripts/train_allennlp_local.shscript. For example, to run Named Entity Recognition (NER) on thebc5cdrdataset:DATASET='bc5cdr' TASK='ner'Set Environment Variables: Point the script to your model files.
export BERT_VOCAB=path-to/scibert_scivocab_uncased.vocab export BERT_WEIGHTS=path-to/scibert_scivocab_uncased.tar.gzRun Training: Execute the script with a serialization directory.
./scibert/scripts/train_allennlp_local.sh [serialization-directory]
pip install -r requirements.txt
tar -xvf scibert_scivocab_uncased.tar
export BERT_VOCAB=path-to/scibert_scivocab_uncased.vocab
export BERT_WEIGHTS=path-to/scibert_scivocab_uncased.tar.gz
./scibert/scripts/train_allennlp_local.sh [serialization-directory]