-
Wandb AI -- https://wandb.ai/anshsharma210504
Welcome to my sentiment analysis project! This repository showcases the fine-tuning of a BERT model using Hugging Face, deployment on WandB AI and Heroku via FastAPI, and the complete workflow of testing, evaluating, and productizing the model for real-world applications.
The project aims to classify sentiment in student reviews about campus events and amenities into Positive, Negative, or Neutral categories. This end-to-end implementation covers:
- Data Preparation: Creating a custom dataset with
ReviewTextandSentimentLabels. - Fine-Tuning: Leveraging the pre-trained BERT model to adapt to the dataset.
- Evaluation: Measuring performance with accuracy, F1-score, and confusion matrix.
- Visualization: Showcasing sentiment distributions and insights via Matplotlib.
- Productization: Deploying the model for public use via FastAPI on both local and cloud servers.
-
Fine-Tuned BERT Model
- Adapted pre-trained BERT using Hugging Face for sentiment classification.
- Optimized with AdamW optimizer and evaluated on metrics like accuracy and F1-score.
-
Deployment
- FastAPI: Designed an intuitive REST API for real-time sentiment predictions.
- Hosted on Heroku and tested locally for seamless integration.
-
Monitoring & Logging
- Tracked model performance and fine-tuning experiments on WandB AI.
-
Evaluation Metrics
- Performance visualized with confusion matrices and sentiment distribution graphs.
- Programming: Python
- Frameworks: Hugging Face Transformers, FastAPI
- Deployment: Heroku, Local Server
- Monitoring: WandB AI
- Visualization: Matplotlib, Seaborn
- Custom dataset with
ReviewTextandSentimentLabels(Positive, Negative, Neutral). - Preprocessing: Text cleaning, tokenization, and encoding of labels.
-
Base Model: BERT (bert-base-uncased).
-
Added a classification head for sentiment analysis.
-
Optimizer: AdamW with learning rate scheduling.
-
Metrics: Accuracy, F1-score, and confusion matrix.
- Tested on unseen data with detailed analysis of predictions.
- Plotted sentiment distributions for better insights.
- Built a REST API with FastAPI:
- Endpoint:
/predict - Input:
ReviewText - Output: Predicted sentiment and confidence score.
- Endpoint:
- Deployed on Heroku and tested via a local server.
├── app.py # FastAPI application code
├── requirements.txt # Python dependencies
├── data/ # Dataset folder
├── models/ # Saved fine-tuned BERT model
├── visualizations/ # Evaluation metrics and graphs
└── README.md # Project documentation



