Giter Site home page Giter Site logo

19020011038 / pytorch_ner_bilstm_cnn_crf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brucexia6116/pytorch_chinese_ner_pos

0.0 0.0 0.0 3.77 MB

End-to-end Sequence Labeling via Bi-directional LSTM-CNNs-CRF implement in pyotrch

License: Apache License 2.0

Shell 0.31% Python 92.17% Perl 7.51%

pytorch_ner_bilstm_cnn_crf's Introduction

NER-LSTM-CNNs-CRF

Requirement

PyTorch: 1.0.1
Python: 3.6
Cuda: 8.0 or 9.0(support cuda speed up, can chose)

Usage

modify the config file, detail see the Config directory
Train:
	The best nn model will be saved during training.
	---> sh run_train_p.sh
Test:
	Train finished. Decoding test data, and write decode result to file.
	---> sh run_test.sh
Eval:
	For the decode result file, use conlleval script in Tools directory to calculate F-score.
	---> sh run_eval.sh  

Config

[Embed]
	pretrained_embed = True(default: False)
	nnembed = True
	pretrained_embed_file = embed file path
[Data]
	max_count = -1  ## Number of sentences loaded(-1 represents all)
[Save]
	save_pkl = True(save pkl file for test, default True)
	save_best_model = True(save best performance result for test, default True)
[Model]
	use_crf = True  ## CRF 
	use_char = True  ## CNN
	model_bilstm = True  ##BiLSTM
	embed_dim = 100, lstm_hiddens = 200
	dropout_emb = 0.5, dropout = 0.5
	max_char_len = 20, char_dim = 30, conv_filter_sizes = 3, conv_filter_nums = 30
[Optimizer]
	sgd = True
	learning_rate = 0.015 , weight_decay = 1.0e-8
	use_lr_decay = True, lr_rate_decay = 0.05, min_lrate = 0.000005, max_patience = 1
[Train]
	batch_size = 10
	early_max_patience = 10(early stop max patience)

This is a major configuration file description, for more detailed reference to config.cfg file and config readme.

Model

  • BiLSTM
    • CNN
    • CRF

Data

  • The number of sentences:
Data Train Dev Test
conll2003 14987 3466 3684
  • The Data format is BIES label, data sample in Data directory.

  • Tag convert scripr in Here [tagSchemeConverter.py]

  • Conll2003 dataset can be downloaded from Conll2003

  • Pre-Trained Embedding can be downloaded from glove.6B.zip

Performance

  • Performance on the Conll2003, eval on the script conlleval in Tools

  • log in final_log

Model % P % R % F1
BLSTM 88.61 88.50 88.56
BLSTM-CRF 90.33 88.81 89.56
BLSTM-CNN 89.23 90.97 90.09
BLSTM-CNN-CRF 91.42 91.24 91.33

Reference

Question

  • if you have any question, you can open a issue or email bamtercelboo@{gmail.com, 163.com}.

  • if you have any good suggestions, you can PR or email me.

pytorch_ner_bilstm_cnn_crf's People

Contributors

dalinvip 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.