Git Product home page Git Product logo

tag's Introduction

TaG

The official repository for ACL 2023 paper "A Novel Table-to-Graph Generation Approach for Document-Level Joint Entity and Relation Extraction".

Requirements

  • Python (tested on 3.8.10)
  • CUDA (tested on 11.2)
  • PyTorch (tested on 1.12.1)
  • Transformers (tested on 4.12.4)
  • apex (tested on 0.1)
  • opt-einsum (tested on 3.3.0)
  • numpy
  • scikit-learn
  • scipy
  • wandb
  • ujson
  • tqdm

Dataset

The DocRED dataset can be downloaded following the instructions at here. The Re-DocRED dataset is a revised version of DocRED and can be downloaded from here. The expected structure of files is:

TaG
 |-- dataset
 |    |-- docred/re-docred
 |    |    |-- train_annotated.json        
 |    |    |-- dev.json
 |    |    |-- test.json
 |    |    |-- rel_info.json
 |    |    |-- rel2id.json (in this repository)

We provide a copy of DocRED in data/docred. It is worth noting that TaG also need to generate intermediate data ({}-gc.json) from mention extraction prediction results, and we also provide the example files in data/docred.

Training & Evaluation

Since we detach the mention extraction (ME) stage from the end-to-end pipeline, you can train a TaG model in the following steps:

  1. Run mention extraction with src/train_me.py. An example script is run_me.sh.
  2. Preprocess span prediction with src/prepro.py. Specify the dev and test predictions with --dev_file and --test_file arguments respectively.
  3. Run coreference resolution & relation extraction with src/train_tag.py. An example script is run_tag.sh.

The evaluation results are provided in the log. To evaluate RE result on test data, you should first save the model using --save_path argument before training. The model correponds to the best dev results will be saved. After that, You can evaluate the saved model by setting the --load_path argument, and the program will generate a test file result.json.

Acknowledgement

In this repository, we refer to and use some code from ATLOP. Thanks for their open-source efforts!๐Ÿป

Citation

@inproceedings{zhang-etal-2023-novel,
    title = "A Novel Table-to-Graph Generation Approach for Document-Level Joint Entity and Relation Extraction",
    author = "Zhang, Ruoyu and Li, Yanzeng and Zou, Lei",
    booktitle = "Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)",
    month = jul,
    year = "2023",
    address = "Toronto, Canada",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2023.acl-long.607",
    doi = "10.18653/v1/2023.acl-long.607",
    pages = "10853--10865",
}

tag's People

Contributors

ridiculouz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.