Downloads · 30 days
26
27% of all-time downloads
cassieli226/cheese-text-distilbert-predictor
cheese-text-distilbert-predictor is a text classification model from cassieli226. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as mit.
This repository contains a fine-tuned DistilBERT model for classifying cheese descriptions into their country/region of origin. The model was trained on the aslan-ng/cheese-text dataset as part of Homework 1 for CMU 2…
Downloads · 30 days
26
27% of all-time downloads
All-time downloads
97
Public
Parameters
67M
1.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors268 MB · 100%
From the Hugging Face model README
This repository contains a fine-tuned DistilBERT model for classifying cheese descriptions into their country/region of origin.
The model was trained on the aslan-ng/cheese-text dataset as part of Homework 1 for CMU 24-679 (Designing and Deploying AI/ML).
| Dataset | Accuracy | F1 (Weighted) | Precision | Recall |
|---|---|---|---|---|
| Augmented Test | 0.9300 | 0.9123 | 0.9168 | 0.9300 |
| External Validation | 0.9500 | 0.9323 | 0.9214 | 0.9500 |
The model generalizes well beyond the augmented split, achieving 95% accuracy on the original validation set.
Common confusions occur between geographically or culturally close regions:
These errors reflect real-world overlaps in cheese naming and history.
```bash pip install transformers torch datasets ```
```python from transformers import AutoTokenizer, AutoModelForSequenceClassification import torch
model_id = "cassieli226/cheese-text-distilbert-predictor" tokenizer = AutoTokenizer.from_pretrained(model_id) model = AutoModelForSequenceClassification.from_pretrained(model_id)
text = "Halloumi is a semi-hard Cypriot cheese known for its high melting point." inputs = tokenizer(text, return_tensors="pt")
with torch.no_grad(): logits = model(**inputs).logits predicted_class = logits.argmax(dim=-1).item()
print("Predicted class:", model.config.id2label[predicted_class]) ```