PhoBERT + 2 layer BiLSTM for Sentiment Analysis ๐โโ๏ธ
-
Download data from this link. Extract data and set value of
SOURCE_FOLDER
intrain_lstm_phobert.py
to path of dataset. -
Download pretrained model here. Set value of state_dict_path to the path of pretrained_model.
-
Remember to run
pip3 install -r requirements.txt
to install all nescessary packages. -
To install CocCoc Tokenizer, please run:
git clone https://github.com/coccoc/coccoc-tokenizer.git
When coccoc-tokenizer is already cloned. Run these commands on terminal to install it.
$ git clone https://github.com/coccoc/coccoc-tokenizer
$ cd coccoc-tokenizer && mkdir build && cd build
$ cmake -DBUILD_PYTHON=1 -DCMAKE_INSTALL_PREFIX=$HOME/.local ..
$ make install
- Now you can train your own model, by running:
python3 train_lstm_phobert.py
You can also run to evaluate pretrained model by running:
python3 evaluate.py
If you want to test pretrained model on your data. Please put your data into an txt file. You can see an example at test.txt
. After that, you can run:
python3 test_lstm_phobert.py