For replicating the reported results, you can simply open Run.ipynb
in Google Colab or use this link, and follow its instruction to replicate the results.
- Download the following files, which are our trained models, and put them in the /checkpoints directory.
2- Now, you can evaluate the model using the following bash command:
python ./test.py \
--model_name="Casrel_Rethinking" \
--rel_num=171 \
--path="./checkpoints/model_rethinking" \
--test_prefix="test_triples" \
--dataset="WebNLG" \
Several important options include:
--model_name
: the model that is used, CASREL or Rethinking--path
: the path of the downloaded checkpoint--test_prefix
: the prefix of the data file that you want to evaluate the model with (you can use any file name in data/WebNLG without the.json
extension)--dataset
: the dataset that you are using
The expected results is as follows:
correct_num: 1406, predict_num: 1572, gold_num: 1581
f1: 0.8918, precision: 0.8944, recall: 0.8893
You can train the model from scratch using the following bash command:
python ./train.py \
--model_name="Casrel_Rethinking" \
--batch_size=6 \
--max_epoch=50 \
--test_epoch=10 \
--max_len=64 \
--rel_num=24 \
--dataset="NYT" \
In this project, we used the following sources:
- PyTorch implementation of the original paper.
- Datasets and data processors provided by the original CASREL.