Pytorch reimplement of the paper "A Novel Cascade Binary Tagging Framework for Relational Triple Extraction" ACL2020. The original code was written in keras.
I followed the previous work of longlongman.
I made some changes in order to better apply to the English DataSet. The changed I have made are listed:
-
I changed the tokenizer from HBTokenizer to AutoTokenizer;
-
Establish the position mapping of the source text and word segmentation in order to fit the English datasets.
-
transformers==4.11.0
-
torch==1.10.0
The data are in form of json. Take one as an example:
{ "text": "#####################", "triple_list": [ [
[
"aaa","start_position","end_position"
],
predicate,
[
"bbb","start_position","end_position"
]
] ] }
-
Get the pre-trained English BERT model
-
Train the model
python train.py
-
Test the model
python test.py