GithubHelp home page GithubHelp logo

allennlp_classification's Introduction

用allennlp写的文本分类模型

本项目利用AllenNLP实现了基于LSTM、TEXTCNN、BERT的文本分类模型。配套的教程见链接,链接。按照范例准备数据后,你可以直接训练你的LSTM和TEXTCNN分类模型。

如果需要实现BERT模型,你需要下载bert的预训练模型,推荐中文预训练BERT-wwm

文件目录

allennlp_classification
├── AllenFrame
│   ├── data.py
│   ├── model.py
│   └── moduls.py
├── data
│   ├── test.csv
│   └── train.csv
├── examples
│   ├── model_bert.json
│   ├── model_albert.json
│   ├── model_cnn.json
│   └── model_lstm.json
├── pre_train
│   ├── bert
│   │   ├── chinese_wwm_ext_pytorch.tar.gz
│   │   └── vocab.txt
│   ├── albert
│   │   ├── bert_config.json
│   │   ├── pytorch_model.bin
│   │   └── vocab.txt
├── README.md
└── train.sh

data中是训练语料的存储范例。 examples里面的json文件对应模型的配置文件。 pre_train是Bert、Robert以及Albert的预训练模型,你需要自己重写下载后替换。 AllenFrame目录下是定义和修改后的相关类。

项目运行

  1. clone本项目到本地
  2. 安装Allennlp
  3. 准备自己的训练语料
  4. 修改并运行./examples/train.sh

TODO

  1. 增加albert模型,目前的albert模型有问题,训练过程不收敛。

allennlp_classification's People

Contributors

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