Giter VIP home page Giter VIP logo

mre-in-one-pass's Introduction

Extracting Multiple-Relations in One-Pass with Pre-Trained Transformers

Notes

This repo contains the implementation for the algorithm in:

@article{wang2019extracting,
  title={Extracting Multiple-Relations in One-Pass with Pre-Trained Transformers},
  author={Wang, Haoyu and Tan, Ming and Yu, Mo and Chang, Shiyu and Wang, Dakuo and Xu, Kun and Guo, Xiaoxiao and Potdar, Saloni},
  journal={arXiv preprint arXiv:1902.01030},
  year={2019}
}

The codes are modified based on the original BERT repo. Some unrelated modules from the original repo have been deleted in order to make it easy to understand.

Data

We provide the processed Semeval2018 data along with the repo. For ACE dataset, we could not share it within this place due to the data policy.

Training (MRE)

The following command will work for training the model on Semeval dataset. For other configurable arguments, please refer to run_classifier.py.

python run_classifier.py \
        --task_name=semeval \
        --do_train=true \
        --do_eval=false \
        --do_predict=false \
        --data_dir=$DATA_DIR/semeval2018/multi \
        --vocab_file=$BERT_BASE_DIR/vocab.txt \
        --bert_config_file=$BERT_BASE_DIR/bert_config.json \
        --init_checkpoint=$BERT_BASE_DIR/bert_model.ckpt \
        --max_seq_length=128 \
        --train_batch_size=4 \
        --learning_rate=2e-5 \
        --num_train_epochs=30 \
        --max_distance=2 \
        --max_num_relations=12 \
        --output_dir=<path to store the checkpoint>

Predicting (MRE)

The following command will work for using the trained model to inference on the test dataset.

python run_classifier.py \
        --task_name=semeval \
        --do_train=false \
        --do_eval=false \
        --do_predict=true \
        --data_dir=$DATA_DIR/semeval2018/multi \
        --vocab_file=$BERT_BASE_DIR/vocab.txt \
        --bert_config_file=$BERT_BASE_DIR/bert_config.json \
        --init_checkpoint=$BERT_BASE_DIR/bert_model.ckpt \
        --max_seq_length=256 \
        --max_distance=2 \
        --max_num_relations=12 \
        --output_dir=<path to the stored checkpoint>

Training (SRE)

The following command will work for training the model on Semeval dataset. For other configurable arguments, please refer to run_classifier.py.

python run_classifier.py \
        --task_name=semeval \
        --do_train=true \
        --do_eval=false \
        --do_predict=false \
        --data_dir=$DATA_DIR/semeval2018/single \
        --vocab_file=$BERT_BASE_DIR/vocab.txt \
        --bert_config_file=$BERT_BASE_DIR/bert_config.json \
        --init_checkpoint=$BERT_BASE_DIR/bert_model.ckpt \
        --max_seq_length=128 \
        --train_batch_size=4 \
        --learning_rate=2e-5 \
        --num_train_epochs=15 \
        --max_distance=2 \
        --max_num_relations=1 \
        --output_dir=<path to store the checkpoint>

Predicting (SRE)

The following command will work for using the trained model to inference on the test dataset.

python run_classifier.py \
        --task_name=semeval \
        --do_train=false \
        --do_eval=false \
        --do_predict=true \
        --data_dir=$DATA_DIR/semeval2018/single \
        --vocab_file=$BERT_BASE_DIR/vocab.txt \
        --bert_config_file=$BERT_BASE_DIR/bert_config.json \
        --init_checkpoint=$BERT_BASE_DIR/bert_model.ckpt \
        --max_seq_length=256 \
        --max_distance=2 \
        --max_num_relations=1 \
        --output_dir=<path to the stored checkpoint>

mre-in-one-pass's People

Contributors

jacobdevlin-google avatar cbockman avatar dalequark avatar abhishekraok avatar bogdandidenko avatar eric-haibin-lin avatar zhaoyongke avatar soloice avatar hsm207 avatar ywkim avatar tianxin1860 avatar stefan-it avatar pengli09 avatar msramalho avatar jasonjpu avatar qwfy avatar rodgzilla avatar georgefeng avatar craigcitro avatar imcaspar avatar ammarasmro avatar aijunbai avatar 0xflotus avatar

Watchers

James Cloos 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.