Giter Club home page Giter Club logo

textclassification's Introduction

PyTorch 文本分类

包含的模型如下

TextCNN

LSTM BiLSTM

GRU BiGRU

TransformerEncoder

环境

torch==1.10.1+cu113
argparse==1.4.0
numpy==1.22.3
sklearn==0.0
scikit-learn==1.0.2
pandas==1.1.1
tqdm==4.62.3

使用方法

  1. 安装环境
pip install requirements.txt
  1. 运行代码
python main.py

注意事项

更换模型请在main.py中修改default部分,例如GRU/BiGRU模型,使用下面代码

parser.add_argument('--model', type=str, default='GRU', help='CNN, GRU, LSTM, TransformerEncoder')

欢迎star

textclassification's People

Contributors

freerotate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

chyweichen

textclassification's Issues

some questions

Why does it run poorly on English data sets such as SST2 and CR?
Hope to get your prompt reply!

AttributeError: 'DataLoader' object has no attribute 'eval'怎么解决呢

请问遇到这个问题该怎么解决呢
File "D:\pythondata\TextClassification-master\train.py", line 38, in train
dev_loss, dev_acc, dev_f1, dev_report, dev_confusion = evaluate(model, dev_loader, config, vocab)
File "D:\pythondata\TextClassification-master\train.py", line 53, in evaluate
model.eval() #评价模式
AttributeError: 'DataLoader' object has no attribute 'eval'

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.