GithubHelp home page GithubHelp logo

napoler / albert-chinese-ner Goto Github PK

View Code? Open in Web Editor NEW

This project forked from prohiryu/albert-chinese-ner

0.0 1.0 0.0 3.74 MB

使用预训练语言模型ALBERT做中文NER

License: MIT License

Python 100.00%

albert-chinese-ner's Introduction

albert-chinese-ner

前言

这次的albert某种程度上可能比bert本身更具有意义,恰逢中文预训练模型出来,还是按照之前的数据来做NER方面的fine-tune

PS: 移步传统bert ner模型

Resources

Papers

配置

  1. 下载albert中文模型,这里使用的是base
  2. 将模型文件夹重命名为albert_base_zh,放入项目中
  3. 运行
    python albert_ner.py --task_name ner --do_train true --do_eval true --data_dir data --vocab_file ./albert_config/vocab.txt --bert_config_file ./albert_base_zh/albert_config_base.json --max_seq_length 128 --train_batch_size 64 --learning_rate 2e-5 --num_train_epochs 3 --output_dir albert_base_ner_checkpoints

4.最好使用tensorflow > 1.13, 这里运行的是1.15,不支持tf2.0

结果

Base模型下训练3个epoch后:

INFO:tensorflow:  eval_f = 0.9280548
INFO:tensorflow:  eval_precision = 0.923054
INFO:tensorflow:  eval_recall = 0.9331808
INFO:tensorflow:  global_step = 2374
INFO:tensorflow:  loss = 13.210413

测试结果同样:

[CLS]
B-LOC
I-LOC
O
B-LOC
I-LOC
I-PER
O
O
O
O
O
O
O
O
O
[SEP]
[CLS]

总结

比起Bert本体,模型确实小了很多,效果却基本相当甚至领先bert,训练时间大幅缩小,NLP的“大舰巨炮”时代可能真的要过去了

albert-chinese-ner's People

Contributors

prohiryu avatar

Watchers

 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.