• Stars
    star
    120
  • Rank 295,983 (Top 6 %)
  • Language
    Python
  • Created almost 6 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This repo contains a PyTorch implementation of a BiLSTM-CRF model for named entity recognition task.

PyTorch solution of NER task Using BiLSTM-CRF model.

This repo contains a PyTorch implementation of a BiLSTM-CRF model for named entity recognition task.

Structure of the code

At the root of the project, you will see:

โ”œโ”€โ”€ pyner
|  โ””โ”€โ”€ callback
|  |  โ””โ”€โ”€ lrscheduler.pyใ€€ใ€€
|  |  โ””โ”€โ”€ trainingmonitor.pyใ€€
|  |  โ””โ”€โ”€ ...
|  โ””โ”€โ”€ config
|  |  โ””โ”€โ”€ basic_config.py #a configuration file for storing model parameters
|  โ””โ”€โ”€ datasetใ€€ใ€€ใ€€
|  โ””โ”€โ”€ ioใ€€ใ€€ใ€€ใ€€
|  |  โ””โ”€โ”€ data_loader.pyใ€€ใ€€
|  |  โ””โ”€โ”€ data_transformer.pyใ€€ใ€€
|  โ””โ”€โ”€ model
|  |  โ””โ”€โ”€ embedding
|  |  โ””โ”€โ”€ layers
|  |  โ””โ”€โ”€ nn
|  โ””โ”€โ”€ output #save the ouput of model
|  โ””โ”€โ”€ preprocessing #text preprocessing 
|  โ””โ”€โ”€ train #used for training a model
|  |  โ””โ”€โ”€ trainer.py 
|  |  โ””โ”€โ”€ ...
|  โ””โ”€โ”€ utils # a set of utility functions
|  โ””โ”€โ”€ test
โ”œโ”€โ”€ test_predict.py
โ”œโ”€โ”€ train_bilstm_crf.py
โ”œโ”€โ”€ train_word2vec.py

Dependencies

  • csv
  • tqdm
  • numpy
  • pickle
  • scikit-learn
  • PyTorch 1.0
  • matplotlib

How to use the code

  1. Download the source_BIO_2014_cropus.txt from BaiduPan(password: 1fa3) and place it into the /pyner/dataset/raW directory.
  2. Modify configuration information in pyner/config/basic_config.py(the path of data,...).
  3. run python train_bilstm_crf.py ๏ผŽ
  4. run python test_predict.py ๏ผŽ

Result

----------- Train entity score:
Type: LOC - precision: 0.9043 - recall: 0.9089 - f1: 0.9066
Type: PER - precision: 0.8925 - recall: 0.9215 - f1: 0.9068
Type: ORG - precision: 0.8279 - recall: 0.9016 - f1: 0.8632
Type: T - precision: 0.9408 - recall: 0.9462 - f1: 0.9435
----------- valid entity score:
Type: T - precision: 0.9579 - recall: 0.9558 - f1: 0.9568
Type: PER - precision: 0.9058 - recall: 0.9205 - f1: 0.9131

training Figure

More Repositories

1

awesome-pretrained-chinese-nlp-models

Awesome Pretrained Chinese NLP Models๏ผŒ้ซ˜่ดจ้‡ไธญๆ–‡้ข„่ฎญ็ปƒๆจกๅž‹&ๅคงๆจกๅž‹&ๅคšๆจกๆ€ๆจกๅž‹&ๅคง่ฏญ่จ€ๆจกๅž‹้›†ๅˆ
Python
4,712
star
2

BERT-NER-Pytorch

Chinese NER(Named Entity Recognition) using BERT(Softmax, CRF, Span)
Python
2,062
star
3

Bert-Multi-Label-Text-Classification

This repo contains a PyTorch implementation of a pretrained BERT model for multi-label text classification.
Python
860
star
4

albert_pytorch

A Lite Bert For Self-Supervised Learning Language Representations
Python
708
star
5

NeZha_Chinese_PyTorch

NEZHA: Neural Contextualized Representation for Chinese Language Understanding
Python
261
star
6

lookahead_pytorch

pytorch implement of Lookahead Optimizer
Python
188
star
7

TorchBlocks

A PyTorch-based toolkit for natural language processing
Python
151
star
8

daguan_2019_rank9

datagrand 2019 information extraction competition rank9
Python
130
star
9

Deep_Learning_For_Computer_Vision_With_Python

Deep Learning For Computer Vision With Python
Python
118
star
10

BERT-chinese-text-classification-pytorch

This repo contains a PyTorch implementation of a pretrained BERT model for text classification.
Python
99
star
11

electra_pytorch

ELECTRA: Pre-training Text Encoders as Discriminators Rather Than Generators
Python
91
star
12

CLUE_pytorch

CLUE baseline pytorch CLUE็š„pytorch็‰ˆๆœฌๅŸบ็บฟ
Python
73
star
13

MobileBert_PyTorch

MobileBERT: a Compact Task-Agnostic BERT for Resource-Limited Devices
Python
61
star
14

BERT-Attribute-Value-Extract

A Pytorch implementation of "Scaling Up Open Tagging from Tens to Thousands: Comprehension Empowered Attribute Value Extraction from Product Title" (ACL 2019).
Python
59
star
15

multi-sample_dropout_pytorch

a simple pytorch implement of Multi-Sample Dropout
Python
56
star
16

BERT-SDA

A PyTorch implementation of "Improving BERT Fine-Tuning via Self-Ensemble and Self-Distillation"
Python
56
star
17

ERNIE-text-classification-pytorch

This repo contains a PyTorch implementation of a pretrained ERNIE model for text classification.
Python
54
star
18

chinese-word2vec-pytorch

word2vec implementation for skip-gram in pytorch
Python
53
star
19

bert-sentence-similarity-pytorch

This repo contains a PyTorch implementation of a pretrained BERT model for sentence similarity task.
Python
49
star
20

label_smoothing_pytorch

pytorch implement of Label Smoothing
Python
32
star
21

EvoNorms_PyTorch

Evolving Normalization-Activation Layers
Python
19
star
22

NovoGrad-pytorch

pytorch implement of NovoGrad Optimizer
Python
18
star
23

cw2vec-pytorch

cw2vec implementation in pytorch
Python
17
star
24

train-bert-pytorch

Python
15
star
25

knowledge-driven-dialogue-lic2019-rank5

2019่ฏญ่จ€ไธŽๆ™บ่ƒฝๆŠ€ๆœฏ็ซž่ต›็ฌฌ5ๅๆ–นๆกˆ
Python
14
star
26

2021-GAIIC-Track1-idea

ๅ…จ็ƒไบบๅทฅๆ™บ่ƒฝๆŠ€ๆœฏๅˆ›ๆ–ฐๅคง่ต›ใ€่ต›้“ไธ€ใ€‘
10
star
27

pytorch_fashionMNIST_practice

ไฝฟ็”จpytorch่ฟ›่กŒๅ›พๅƒ่ฎญ็ปƒ็š„ๆจกๆฟ
Python
9
star
28

keras_learning

Jupyter Notebook
9
star
29

Contextual-Chinese-Strokes-Embeddings

Implementation of the language model for Contextual chinese strokes Embeddings with PyTorch
Python
8
star
30

lonePatient.github.io

HTML
6
star
31

kaggle-camera-model-identification

IEEE's Signal Processing Society - Camera Model Identification
Python
6
star
32

tensorflow-eager-examples

Examples of Eager Execution in tensorflow
Python
6
star
33

char-cnn-text-classification

This repo contains a PyTorch implementation of a char-level CNN model for text classification.
Python
3
star