ajaykarthick/imdb-movie-reviews
Viewer β’ Updated β’ 50k β’ 410 β’ 6
This is a fine-tuned BERT model (bert-base-uncased) for sentiment analysis on the IMDb movie review dataset. The model classifies text into:
bert-base-uncasedYou 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]}")
bert-base-uncasedThis model is available for public use under the Apache 2.0.
Saubhagya Vishwakarma π§ saubhagya.v@simformsolutions.com π GitHub
Base model
google-bert/bert-base-uncased