China-ChallengeHub/bert4ner.pytorch

BERT models for Named Entity Recognition

Python

0

32 commits

updated Jun 1, 2021

See the code

README

bert4ner.pytorch

A PyTorch implementation of Bert models for Named Entity Recognition(NER).

Quick start

The training arguments can be found in args/. To train CRF models, the command should be like

$ python run_ner_crf.py args/bert_crf-clue_ner.json

Requirements

RTX3090, Driver Version: 455.38, CUDA Version: 11.1

  • apex==0.1
  • numpy==1.19.4
  • pandas==1.1.4
  • scipy==1.5.4
  • seqeval==1.2.2
  • torch==1.7.0
  • torchtyping==0.1.1
  • tqdm==4.49.0
  • transformers==4.5.0
  • allennlp==2.4.0

Datasets

Datasets used in this repository can be found in OYE93/Chinese-NLP-Corpus - Github and CLUEbenchmark.

Models

Pretrained language model(PLM) including

  • BERT: e.g. hfl/chinese-roberta-wwm-ext
  • NEZHA: e.g. nghuyong/ernie-1.0
  • FLAT

Named Entity Recognition Prediction Header including

  • CRF: Bidirectional LSTM-CRF Models for Sequence Tagging
  • SPAN
  • Biaffine: Named Entity Recognition as Dependency Parsing

Benchmarks

Models

The performance on dev set of CLUENER2000(F1 score).

entitiyHuman PerformanceBert-crfBert-spanBert-biaffineBert-span-v2
Address43.0464.3065.7665.4769.51
Book71.7082.5883.6181.2382.84
Company49.3280.8283.1181.9685.36
Game80.3984.9385.2984.0685.66
Government79.2782.9283.0781.2586.02
Movie63.2183.0683.1183.6287.26
Person Name74.4988.8788.8787.3889.58
Organization65.4180.2782.4880.5684.58
Position55.3879.5180.6980.7680.24
Scene51.8576.5672.3774.0775.25
Overall@Macro63.4180.3880.8479.8982.63
Overall@Micro/80.2681.0080.0882.72
entitiyBert-span-v2Ernie-span-v2
Address69.5167.16
Book82.8481.82
Company85.3684.11
Game85.6687.39
Government86.0284.48
Movie87.2686.92
Person Name89.5889.37
Organization84.5883.67
Position80.2481.26
Scene75.2573.60
Overall@Macro82.6381.98
Overall@Micro82.7282.19

Datasets

Reference

China-ChallengeHub/bert4ner.pytorch

BERT models for Named Entity Recognition

Python

0

32 commits

updated Jun 1, 2021

See the code

README

bert4ner.pytorch

A PyTorch implementation of Bert models for Named Entity Recognition(NER).

Quick start

The training arguments can be found in args/. To train CRF models, the command should be like

$ python run_ner_crf.py args/bert_crf-clue_ner.json

Requirements

RTX3090, Driver Version: 455.38, CUDA Version: 11.1

  • apex==0.1
  • numpy==1.19.4
  • pandas==1.1.4
  • scipy==1.5.4
  • seqeval==1.2.2
  • torch==1.7.0
  • torchtyping==0.1.1
  • tqdm==4.49.0
  • transformers==4.5.0
  • allennlp==2.4.0

Datasets

Datasets used in this repository can be found in OYE93/Chinese-NLP-Corpus - Github and CLUEbenchmark.

Models

Pretrained language model(PLM) including

  • BERT: e.g. hfl/chinese-roberta-wwm-ext
  • NEZHA: e.g. nghuyong/ernie-1.0
  • FLAT

Named Entity Recognition Prediction Header including

  • CRF: Bidirectional LSTM-CRF Models for Sequence Tagging
  • SPAN
  • Biaffine: Named Entity Recognition as Dependency Parsing

Benchmarks

Models

The performance on dev set of CLUENER2000(F1 score).

entitiyHuman PerformanceBert-crfBert-spanBert-biaffineBert-span-v2
Address43.0464.3065.7665.4769.51
Book71.7082.5883.6181.2382.84
Company49.3280.8283.1181.9685.36
Game80.3984.9385.2984.0685.66
Government79.2782.9283.0781.2586.02
Movie63.2183.0683.1183.6287.26
Person Name74.4988.8788.8787.3889.58
Organization65.4180.2782.4880.5684.58
Position55.3879.5180.6980.7680.24
Scene51.8576.5672.3774.0775.25
Overall@Macro63.4180.3880.8479.8982.63
Overall@Micro/80.2681.0080.0882.72
entitiyBert-span-v2Ernie-span-v2
Address69.5167.16
Book82.8481.82
Company85.3684.11
Game85.6687.39
Government86.0284.48
Movie87.2686.92
Person Name89.5889.37
Organization84.5883.67
Position80.2481.26
Scene75.2573.60
Overall@Macro82.6381.98
Overall@Micro82.7282.19

Datasets

Reference