Model Overview
- Base Model: google-bert/bert-base-uncased
- Dataset: SetFit/amazon_reviews_multi_en,
- Classes: Binary classification (
Positive
,Negative
) - Performance:
- Test Accuracy: 89%
- Validation Accuracy: 89%
Figure 1: Confusion matrix for test data
Figure 2: Confusion matrix for validation data
How to Use the Model
Below is an example of how to load and use the model for sentiment classification:
from transformers import BertTokenizer, BertForSequenceClassification
import torch
import streamlit as st
# Load the tokenizer and model
tokenizer = BertTokenizer.from_pretrained(
"ashish-001/Bert-Amazon-review-sentiment-classifier")
model = BertForSequenceClassification.from_pretrained(
"ashish-001/Bert-Amazon-review-sentiment-classifier")
# Example usage
text = "This product is amazing!"
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)
logits = outputs.logits
sentiment = torch.argmax(logits, dim=1).item()
print(f"Predicted sentiment: {'Positive' if sentiment == 1 else 'Negative'}")
- Downloads last month
- 7
Model tree for ashish-001/Bert-Amazon-review-sentiment-classifier
Base model
google-bert/bert-base-uncased