Exploiting BERT End-to-End Aspect-Based Sentiment Analysis
- python 3.7.3
- pytorch 1.2.0
- transformers 2.0.0
- numpy 1.16.4
- tensorboardX 1.9
- tqdm 4.32.1
- some codes are borrowed from allennlp (https://github.com/allenai/allennlp, an awesome open-source NLP toolkit) and transformers (https://github.com/huggingface/transformers, formerly known as pytorch-pretrained-bert or pytorch-transformers)
- Pre-trained embedding layer: BERT-Base-Uncased (12-layer, 768-hidden, 12-heads, 110M parameters)
- Task-specific layer:
- Linear
- Recurrent Neural Networks (GRU)
- Self-Attention Networks (SAN, TFM)
- Conditional Random Fields (CRF)
- Restaurant: retaurant reviews from SemEval 2014 (task 4), SemEval 2015 (task 12) and SemEval 2016 (task 5)
- Laptop: laptop reviews from SemEval 2014
-
Reproduce the results on Restaurant and Laptop dataset:
# train the model with 5 different seed numbers python fast_run.py
-
Train the model on other ABSA dataset:
-
place data files in the directory
./data/[YOUR_DATASET_NAME]
. -
set
TASK_NAME
intrain.sh
as[YOUR_DATASET_NAME]
. -
train the model:
sh train.sh
-
- OS: REHL Server 6.4 (Santiago)
- GPU: NVIDIA GTX 1080 ti
- CUDA: 10.0
- cuDNN: v7.6.1
If the code is used in your research, please star our repo and cite our paper as follows:
@article{li2019exploiting,
title={Exploiting BERT for End-to-End Aspect-based Sentiment Analysis},
author={Li, Xin and Bing, Lidong and Zhang, Wenxuan and Lam, Wai},
journal={arXiv preprint arXiv:1910.00883},
year={2019}
}