Git Product home page Git Product logo

pytorch_multi_head_selection_re's Introduction

"Joint entity recognition and relation extraction as a multi-head selection problem" (Expert Syst. Appl, 2018)

paper

official tensorflow version

This model is extreamly useful for real-world RE usage. I originally reimplemented for a competition (Chinese IE). I will add CoNLL04 dataset and BERT model.

Requirement

  • python 3.6
  • pytorch 1.20

Dataset

Chinese IE

Chinese Information Extraction Competition link

Unzip *.json into ./raw_data/chinese/

CoNLL04

We use the data processed by official version.

already in ./raw_data/CoNLL04/

Run

python main.py --mode preprocessing --exp_name chinese_selection_re
python main.py --mode train --exp_name chinese_selection_re 
python main.py --mode evaluation --exp_name chinese_selection_re

If you want to try other experiments:

set exp_name as conll_selection_re or conll_bert_re

Result

Chinese

Training speed: 10min/epoch

precision recall f1
Ours (dev) 0.7443 0.6960 0.7194
Winner (test) 0.8975 0.8886 0.893

CoNLL04

Test set:

precision recall f1
Ours (LSTM) 0.6531 0.3153 0.4252
Ours (BERT-freeze) 0.5233 0.4975 0.5101
Official 0.6375 0.6043 0.6204

We use the strictest setting: a triplet is correct only if the relation and all the tokens of head and tail are correct.

Details

The model was originally used for Chinese IE, thus, it's a bit different from the official paper:

They use pretrained char-word embedding while we use word embedding initialized randomly; they use 3-layer LSTM while we use 1-layer LSTM.

ADD

offline bert model fix bugs of bert tokenizer update and add all requirements

TODO

  • Tune the hyperparameters of BERT+MUL for Chinese
  • Add full fine-tune bert

pytorch_multi_head_selection_re's People

Contributors

windchimeran avatar yzho0907 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.