Instructions to use Talip7/bert-base-sst2-finetuned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Talip7/bert-base-sst2-finetuned with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Talip7/bert-base-sst2-finetuned")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("Talip7/bert-base-sst2-finetuned") model = AutoModelForSequenceClassification.from_pretrained("Talip7/bert-base-sst2-finetuned") - Notebooks
- Google Colab
- Kaggle
metadata
language: en
license: mit
library_name: transformers
datasets:
- glue
- sst2
metrics:
- accuracy
pipeline_tag: text-classification
widget:
- text: This movie was an absolute masterpiece, I loved every minute of it!
example_title: Positive Example
- text: The plot was boring and the acting was subpar.
example_title: Negative Example
BERT Base Uncased β Fine-tuned on SST-2
This model is a fine-tuned version of bert-base-uncased on the GLUE SST-2 dataset for binary sentiment analysis.
Model Details
- Developed by: Talip7
- Base model: BERT Base Uncased
- Model type: Transformer encoder (BERT)
- Language: English
- Task: Sentiment Analysis (Binary Classification)
Training Details
- Dataset: GLUE / SST-2
- Training framework: PyTorch
- Libraries: π€ Transformers, π€ Datasets, π€ Accelerate
- Optimizer: AdamW
- Learning rate: 3e-5
- Epochs: 3
- Learning rate scheduler: Linear
- Hardware: GPU (via π€ Accelerate)
Evaluation Results
The model was evaluated on the SST-2 validation set.
- Accuracy: 0.9289 (92.89%)
Intended Use
This model can be used for:
- Binary sentiment analysis on English text
- Educational purposes (learning fine-tuning with Hugging Face)
- Benchmarking sentiment classification models
Limitations
- Trained only on movie reviews (SST-2); performance may degrade on other domains.
- Does not explicitly handle sarcasm or complex sentiment.
- Not suitable for multilingual sentiment analysis.
Usage
π€ Transformers Pipeline
from transformers import pipeline
classifier = pipeline(
"text-classification",
model="Talip7/bert-base-sst2-finetuned"
)
classifier("I love this project!")
π₯ PyTorch Usage
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
tokenizer = AutoTokenizer.from_pretrained("Talip7/bert-base-sst2-finetuned")
model = AutoModelForSequenceClassification.from_pretrained("Talip7/bert-base-sst2-finetuned")
text = "This movie was absolutely fantastic!"
inputs = tokenizer(text, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
prediction = torch.argmax(logits, dim=-1).item()
label_map = {0: "Negative", 1: "Positive"}
print(f"Prediction: {label_map[prediction]}")