Downloads · 30 days
19
4% of all-time downloads
AdhamEhab/fine-tuned-bert-yelp
fine-tuned-bert-yelp is a machine learning model from AdhamEhab. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
This model is a BERT-base-uncased fine-tuned on the Yelp Review Full dataset. The task is 5-class sentiment classification (1 to 5 stars).
Downloads · 30 days
19
4% of all-time downloads
All-time downloads
487
Public
Parameters
109M
438 MB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors438 MB · 100%
From the Hugging Face model README
This model is a BERT-base-uncased fine-tuned on the Yelp Review Full dataset.
The task is 5-class sentiment classification (1 to 5 stars).
bert-base-uncasedOn the validation split:
from transformers import BertTokenizer, BertForSequenceClassification
model = BertForSequenceClassification.from_pretrained("AdhamEhab/fine-tuned-bert-yelp")
tokenizer = BertTokenizer.from_pretrained("AdhamEhab/fine-tuned-bert-yelp")
text = "The food was amazing and the service was excellent!"
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)
pred = outputs.logits.argmax(dim=-1).item()
print("Predicted star rating:", pred + 1) # labels are 0-4 -> map to 1-5