BERT Sentiment Analysis π
This is a fine-tuned BERT model (bert-base-uncased
) for sentiment analysis on the IMDb movie review dataset. The model classifies text into:
- β Positive
- β Negative
π§ Model Details
- Base Model:
bert-base-uncased
- Dataset: IMDb (via Hugging Face Datasets)
- Classes: Binary classification (0: Positive, 1: Negative)
- Framework: PyTorch
- Training: Fine-tuned using Hugging Face Transformers and Datasets on GPU
π₯ How to Use
You can use this model directly with π€ transformers
:
from transformers import BertTokenizer, BertForSequenceClassification
import torch
import torch.nn.functional as F
model_name = "saubhagya122k4/bert-sentiment-analysis"
tokenizer = BertTokenizer.from_pretrained(model_name)
model = BertForSequenceClassification.from_pretrained(model_name)
model.eval()
text = "This movie was fantastic! I really enjoyed it."
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=70)
with torch.no_grad():
outputs = model(**inputs)
probs = F.softmax(outputs.logits, dim=1)
predicted = torch.argmax(probs, dim=1).item()
labels = {0: "Positive", 1: "Negative"}
print(f"Sentiment: {labels[predicted]}")
π Performance
- Accuracy: ~93% on test set
- Tokenizer:
bert-base-uncased
- Sequence Length: 70 tokens
π Training & Fine-tuning
- Notebook: View on Kaggle
- Framework: PyTorch + Hugging Face Transformers
- Batch Size: 16
- Epochs: 3
- Optimizer: AdamW
π¦ Use Cases
- Movie review classification
- Customer feedback analysis
- Product sentiment detection
π§Ύ License
This model is available for public use under the Apache 2.0.
πββοΈ Author
Saubhagya Vishwakarma π§ saubhagya.v@simformsolutions.com π GitHub
- Downloads last month
- 39
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
π
1
Ask for provider support
Model tree for saubhagya122k4/bert-sentiment-analysis
Base model
google-bert/bert-base-uncased