Skip to content

IAmHedgehog/SagDRE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SagDRE

Code for KDD 2022 paper SagDRE: Sequence-Aware Graph-Based Document-Level Relation Extraction with Adaptive Margin Loss.

If you make use of this code in your work, please kindly cite the following paper:

@inproceedings{wei2022sagdre,
  title={SagDRE: Sequence-Aware Graph-Based Document-Level Relation Extraction with Adaptive Margin Loss},
  author={Wei, Ying and Li, Qi},
  booktitle={Proceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  pages={2000--2008},
  year={2022}
}

Requirements

  • Python (tested on 3.7.4)
  • CUDA (tested on 10.2)
  • PyTorch (tested on 1.7.0)
  • Transformers (tested on 3.4.0)
  • numpy (tested on 1.19.4)
  • spacy (tested on 3.2.4)
  • apex (tested on 0.1)
  • opt-einsum (tested on 3.3.0)
  • ujson
  • tqdm

Dataset

The DocRED dataset can be downloaded following the instructions at link.

The CDR dataset can be obtained by following the instructions in edge-oriented graph.

The CHR dataset can be obtained at link.

Please process CDR and CHR datasets by following the instructions in edge-oriented graph. The expected structure of files is:

SagDRE
 |-- dataset
 |    |-- docred
 |    |    |-- train_annotated.json        
 |    |    |-- train_distant.json
 |    |    |-- dev.json
 |    |    |-- test.json
 |    |-- cdr
 |    |    |-- train_filter.data
 |    |    |-- dev_filter.data
 |    |    |-- test_filter.data
 |    |-- chr
 |    |    |-- train.data
 |    |    |-- dev.data
 |    |    |-- test.data

Training and Evaluation

DocRED

Train the BERT model on DocRED with the following command:

>> cd scripts
>> sh run_docred.sh  # for BERT

CDR and CHR

Train CDA and CHR model with the following command:

>> sh scripts/run_cdr.sh  # for CDR
>> sh scripts/run_chr.sh  # for CHR

This code is partially based on the code of ATLOP

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages