This repo contains the PyTorch implementaion for the paper Relational Graph Attention Network for Aspect-based Sentiment Analysis.
For any questions about the implementation, plaese email [email protected].
- Python 3.6.8
- PyTorch 1.2.0
- Transformers https://github.com/huggingface/transformers
- CUDA 9.0
First, download and unzip GloVe vectors(glove.840B.300d.zip
) from https://nlp.stanford.edu/projects/glove/. Then change the value of parameter --glove_dir
to the directory of the word vector file.
Download the pytorch version pre-trained bert-base-uncased
model and vocabulary from the link provided by huggingface. Then change the value of parameter --bert_model_dir
to the directory of the bert model.
The preprocess codes are in data_preprocess_semeval.py
and data_preprocess_twitter.py
. However we already provided the preprocessed datasets with dependency parcing results in ./data/
, so you can skip preprocess.
Run:
./run.sh