IMDB Sentiment Analysis
Classify a movie review into Positive or Negative review using DistilBERT Transformer.
A pre-trained DistilBERT transformer model was used which was fine-tuned on the IMDB reviews dataset.
Webapp
Home page
Positive review
Prediction for Positive review
Negative Review
Prediction for negative review
Repository Structure
main
|── models
| |── model # Holds model files
| └── tokenizer # Holds tokenizer files
|
|── screenshots # Contains webapp screenshots
|
|── src
| |── __init__.py
| └── models_utils.py # Model loading and prediction utility
|
|── templates
| |── index.html
| └── error.html
|
|── training
| └── imdb_sentiment_analysis_training.ipynb # Training notebook
|
|── .gitignore
|── README.md
|── app.py
|── params.yaml
|── requirements.txt
└── setup.py
Setup
- Create a new conda environment
conda create -n imdb-sentiment-analysis python==3.7
- run the setup file
Note - If any error occurs for any package, comment the corresponding package in requirements.txt file and install the dependency separately.
pip install .
- Use the notebook provided in Training folder to train a DistilBERT Transformer model on the imdb reviews dataset.
- Download/Save the trained Model and Tokenizer files and paste them in the corresponding folder in the models directory.
- Run the app
python app.py