Instructions to use divyansh126/SentimentAnalysisBert with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use divyansh126/SentimentAnalysisBert with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="divyansh126/SentimentAnalysisBert")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("divyansh126/SentimentAnalysisBert") model = AutoModelForSequenceClassification.from_pretrained("divyansh126/SentimentAnalysisBert", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 2,659 Bytes
19a3834 e444c37 19a3834 e444c37 19a3834 e444c37 19a3834 e444c37 19a3834 e444c37 19a3834 e444c37 19a3834 e444c37 19a3834 e444c37 19a3834 e444c37 19a3834 e444c37 19a3834 e444c37 19a3834 e444c37 19a3834 e444c37 19a3834 e444c37 19a3834 e444c37 19a3834 e444c37 19a3834 e444c37 19a3834 e444c37 19a3834 e444c37 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | ---
library_name: transformers
tags:
- text-classification
- bert
- sentiment-analysis
license: mit
language:
- en
metrics:
- accuracy
- f1
- precision
- recall
base_model:
- google-bert/bert-base-uncased
pipeline_tag: text-classification
---
## Model Details
- **Model type**: BERT-based sequence classification
- **Base model**: `bert-base-uncased`
- **Number of classes**: 3
- **Trained on**: Custom labeled dataset
- **Framework**: PyTorch with ๐ค Transformers
- **Max sequence length**: 512
- **Tokenizer**: `bert-base-uncased`
### Model Description
This is a fine-tuned `bert-base-uncased` model for **multi-class text classification**. The model was trained on a custom dataset to classify text into 3 categories: `Negative`, `Neutral`, and `Positive`.
- **Developed by:** Divyansh Rajput
- **Model type:** Transformer(Bert-Base-Uncased)
- **Language(s) (NLP):** English
- **License:** Mit
- **Finetuned from model :** Bert-Base-Uncased
### Model Sources
- **Repository:** https://huggingface.co/divyansh126/SentimentAnalysisBert/
## ๐ Classes
| Label | Description |
|-------|-------------|
| 0 | Negative |
| 1 | Neutral |
| 2 | Positive |
## ๐ How to Get Started with the Model##
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("divyansh126/")
model = AutoModelForSequenceClassification.from_pretrained("your-username/your-model-name")
inputs = tokenizer("I loved the product!", return_tensors="pt")
outputs = model(**inputs)
predicted_class = outputs.logits.argmax(dim=-1).item()
## ๐งช Training Details
- **Training framework**: Hugging Face `Trainer`
- **Epochs**: 1
- **Batch size**: 32
- **Learning rate**: 2e-5
- **Device**: Trained on GPU (`cuda`)
### Training Data
Dataset Link - https://www.kaggle.com/datasets/jp797498e/twitter-entity-sentiment-analysis
## Evaluation
## ๐ Evaluation
| Metric | Score |
|------------|---------|
| Accuracy | 0.85 |
| F1 Score | 0.85 |
| Precision | 0.85 |
| Recall | 0.85 |
#### Summary
This model is a fine-tuned version of BERT (bert-base-uncased) for multi-class text classification. It has been trained to classify input text into three sentiment-based categories: Negative (0), Neutral (1), and Positive (2).
The model was trained on a custom dataset using the Hugging Face Trainer API with PyTorch. It uses standard preprocessing with a maximum sequence length of 512 tokens. This fine-tuned BERT model achieves strong performance in sentiment classification tasks and is suitable for real-time predictions in production environments or APIs. |