A pytorch implementation of HuggingFace BERT that uses the Amazon Food Review data to predict the rating on a 5 point scale from the review by the user. The base repo for the article - (insert url)
The repo demonstrates how to go about with fine tuning a pre-trained BERT model(I have used bert-base-uncased).
- Ensure that you have venv installed.
- Create the env
python3 -m venv env
- Enter the env
source env/bin/activate
pip install torch
pip install transformers
pip install pandas
- Download the dataset(https://www.kaggle.com/snap/amazon-fine-food-reviews).
mkdir AMAZON-DATASET
- unzip the dataset and place the Reviews.csv file inside AMAZON-DATASET
Run python3 main.py
If you have a cuda ready GPU, then the code will leverage it for training. In the event your GPU does not do the job, set the "forceCPU" config to True to verify that it works and raise an issue here.