Giter Club home page Giter Club logo

nlp-series-relation-extraction's Introduction

项目说明:

本项目是关系抽取相关模型的代码复现
包括以下四种方法

  • 序列标注
  • 层叠式指针网络(基于主语感知)
  • Multi-head Selection
  • Deep Biaffine Attention

用的数据是百度21年语言技术经验竞赛抽取赛道的数据,四种方法的效果如下表,更详细的请看我的知乎博文 https://zhuanlan.zhihu.com/p/381894616

F1值
官方baseline 64.69
层叠式指针网络(基于主语感知) 61.22
Multi-head Selection 67.90
Deep Biaffine Attention 68.45

环境

  • python=3.6
  • torch=1.7
  • transformers=4.5.0

运行示例

序列标注

python3 run_baseline.py
--max_len=200
--model_name_or_path=预训练模型路径
--per_gpu_train_batch_size=80
--per_gpu_eval_batch_size=100
--learning_rate=1e-4
--num_train_epochs=40
--output_dir="./output"
--weight_decay=0.01
--early_stop=2

层叠式指针网络(基于主语感知)

python3 run_mpn.py
--max_len=200
--model_name_or_path=预训练模型路径
--per_gpu_train_batch_size=100
--per_gpu_eval_batch_size=100
--learning_rate=1e-4
--num_train_epochs=40
--output_dir="./output"
--weight_decay=0.01
--early_stop=2

Multi-head Selection

python3 run_mhs.py
--max_len=200
--model_name_or_path=/data/zhoujx/prev_trained_model/rbt3
--per_gpu_train_batch_size=25
--per_gpu_eval_batch_size=30
--learning_rate=1e-4
--num_train_epochs=40
--output_dir="./output"
--weight_decay=0.01
--early_stop=2

Deep Biaffine Attention

python3 run_mhs_biaffine.py
--max_len=200
--model_name_or_path=/data/zhoujx/prev_trained_model/rbt3
--per_gpu_train_batch_size=15
--per_gpu_eval_batch_size=20
--learning_rate=1e-4
--num_train_epochs=40
--output_dir="./output"
--weight_decay=0.01
--early_stop=2
--overwrite_cache=True

nlp-series-relation-extraction's People

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.