hongwang600 / DocRed

41 stars 6 forks source link

Code cloned from https://github.com/thunlp/DocRED/tree/master/code

Baseline code

Requirements and Installation

python3

pytorch>=1.0

pip3 install -r requirements.txt

preprocessing data

Download metadata from TsinghuaCloud or GoogleDrive for baseline method and put them into prepro_data folder.

python3 gen_data.py --in_path ../data --out_path prepro_data

relation extration

training:

CUDA_VISIBLE_DEVICES=0 python3 train.py --model_name BiLSTM --save_name checkpoint_BiLSTM --train_prefix dev_train --test_prefix dev_dev

testing (--test_prefix dev_dev for dev set, dev_test for test set):

CUDA_VISIBLE_DEVICES=0 python3 test.py --model_name BiLSTM --save_name checkpoint_BiLSTM --train_prefix dev_train --test_prefix dev_dev --input_theta 0.3601

evaluation

dev result can evaluated by

python3 evalutaion result.josn ../data/dev.json

test result should be submit to Codalab.