Text Classification
Transformers
Safetensors
English
distilbert
sentiment-analysis
Eval Results (legacy)
text-embeddings-inference
Instructions to use bmdavis/my-language-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bmdavis/my-language-model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="bmdavis/my-language-model")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("bmdavis/my-language-model") model = AutoModelForSequenceClassification.from_pretrained("bmdavis/my-language-model", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add README.md with model description
Browse files
README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🧠 Sentiment Analysis Model — DistilBERT Fine-Tuned on IMDb 🎬
|
| 2 |
+
|
| 3 |
+
This model is a fine-tuned version of [`distilbert-base-uncased`](https://huggingface.co/distilbert-base-uncased) on the [IMDb movie review dataset](https://huggingface.co/datasets/imdb) for **binary sentiment classification** (positive/negative). It was trained using Hugging Face Transformers and PyTorch.
|
| 4 |
+
|
| 5 |
+
## 🔍 Intended Use
|
| 6 |
+
|
| 7 |
+
This model is designed to classify movie reviews (or other English text) as **positive** or **negative** sentiment. It's ideal for:
|
| 8 |
+
- Opinion mining
|
| 9 |
+
- Social media analysis
|
| 10 |
+
- Review classification
|
| 11 |
+
- Text classification demos
|
| 12 |
+
|
| 13 |
+
## 🧪 Example Usage
|
| 14 |
+
|
| 15 |
+
```python
|
| 16 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 17 |
+
import torch
|
| 18 |
+
|
| 19 |
+
model_name = "bmdavis/my-language-model"
|
| 20 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 21 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 22 |
+
|
| 23 |
+
text = "This movie was amazing and really well-acted!"
|
| 24 |
+
inputs = tokenizer(text, return_tensors="pt")
|
| 25 |
+
outputs = model(**inputs)
|
| 26 |
+
prediction = torch.argmax(outputs.logits).item()
|
| 27 |
+
|
| 28 |
+
print("Sentiment:", "Positive" if prediction == 1 else "Negative")
|