项目作者: QQQQQby

项目描述 :
ELMo-MLP Classifier
高级语言: Python
项目地址: git://github.com/QQQQQby/ELMo-MLP.git
创建时间: 2020-05-06T14:01:45Z
项目社区:https://github.com/QQQQQby/ELMo-MLP

开源协议:

下载


ELMo Based Classifier

ELMo Introduction

ELMo, or Embeddings from Language Model, is a bidirectional language model based on RNN.

Bidirectional LSTM units are pre-trained with unlabeled data to generate ELMo representations. Then we can easily fine-tune the model to help us to classify labeled texts.

In this repository, we use the pre-trained ELMo with Tensorflow Hub.

MLP(Multi-Layer Perceptron) is used in our classification task. Accuracy might be higher if we used DNN or CNN rather than MLP.

Dataset

The classification task is subtask B of SemEval-2019 Task 8: Fact Checking in Community Question Answering Forums. The data for this task is provided in another repository: https://github.com/tsvm/factcheck-cqa.

Requirements

You should install python version 3.5 or later, Tensorflow version 1.x and Tensorflow Hub.

  1. pip install tensorflow tensorflow-hub

Run

  1. optional arguments:
  2. -h, --help show this help message and exit
  3. --num_epochs NUM_EPOCHS
  4. Number of epochs.
  5. --batch_size BATCH_SIZE
  6. Batch size.
  7. --learning_rate LEARNING_RATE
  8. Learning rate.
  9. --lamb LAMB Regularization coefficient for weights.
  10. --output_path OUTPUT_PATH
  11. Save path.
  12. --dataset_path DATASET_PATH
  13. Data path.
  14. --labels LABELS Labels of texts.
  15. --use_gpu USE_GPU whether to use gpu.
  16. --do_train DO_TRAIN whether to train the model.
  17. --do_eval DO_EVAL whether to do the evaluation.
  18. --do_test DO_TEST whether to predict test data.

Train and evaluate:

  1. python run_classifier.py

For Windows users:

  1. ./run.bat