--- license: apache-2.0 datasets: - ajaykarthick/imdb-movie-reviews base_model: - google-bert/bert-base-uncased tags: - sentiment_analysis --- # 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`: ```python 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](https://www.kaggle.com/code/saubhagyavishwakarma/sentiment-bert-model?scriptVersionId=247854860) * 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](mailto:saubhagyah5331@gmail.com) ๐Ÿ”— [GitHub](https://github.com/Saubhagyah5331)