Text Classification
Transformers
Safetensors
modernbert
sentiment-analysis
multilingual
restaurants
5-star
text-embeddings-inference
Instructions to use Festooned/Multilingual-Restaurant-Reviews-Sentiment with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Festooned/Multilingual-Restaurant-Reviews-Sentiment with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Festooned/Multilingual-Restaurant-Reviews-Sentiment")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("Festooned/Multilingual-Restaurant-Reviews-Sentiment") model = AutoModelForSequenceClassification.from_pretrained("Festooned/Multilingual-Restaurant-Reviews-Sentiment", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Initial upload of Multilingual-Restaurant-Reviews-Sentiment
Browse files20 unmodified lines2122232425262764 unmodified lines92939495969798996 unmodified lines1061071081091101111121131141151168 unmodified lines12512612712812913013113213313413513613713813914014114220 unmodified linesHey there! This isn't just _another_ sentiment model. This is a fine-tuned powerhouse specifically designed to understand the nuance of 1-to-5 star restaurant reviews across **5 different languages**.It was trained on a massive, perfectly balanced dataset of **400,000 real, human-written, reviews** and achieves state-of-the-art performance.## ✨ Model Features64 unmodified linesSince this is a regression model, the output is a single float number. You'll want to round it to get a final "star" rating.```pythonfrom transformers import AutoTokenizer, AutoModelForSequenceClassification, pipelinemodel_name = "Festooned/Multilingual-Restaurant-Reviews-Sentiment"tokenizer = AutoTokenizer.from_pretrained(model_name)6 unmodified lines# Let's create a pipelinesentiment_pipe = pipeline("text-classification", model=model, tokenizer=tokenizer)# Example reviewsreviews = ["This was the best pasta I've ever had in my life. Absolutely incredible.", # 5-star"El servicio fue terrible y la comida tardó una hora en llegar.", # 1-star"It was... fine. Nothing special, but not bad either." # 3-star]# Get the raw predictions8 unmodified lines# (Remember our labels are 0-4, so we add 1)# ---for text, pred in zip(reviews, raw_preds):# 'score' is the raw regression value from 0-4raw_score = pred['score']# Round to the nearest starstar_rating_rounded = round(raw_score) + 1# Or just use the raw score!star_rating_precise = raw_score + 1print(f"Review: {text[:30]}...")print(f" Precise Rating: {star_rating_precise:.2f} stars")print(f" Rounded Rating: {star_rating_rounded} stars\n")```---20 unmodified lines2122232425262764 unmodified lines92939495969798991001011021031041051061071081091101111121131141151161176 unmodified lines1241251261271281291301311321331348 unmodified lines14314414514614714814915015115215315415515615715815920 unmodified linesHey there! This isn't just _another_ sentiment model. This is a fine-tuned powerhouse specifically designed to understand the nuance of 1-to-5 star restaurant reviews across **5 different languages**.It was trained on a massive, perfectly balanced dataset of **400,000+ real, human-written, reviews** and achieves state-of-the-art performance.## ✨ Model Features64 unmodified linesSince this is a regression model, the output is a single float number. You'll want to round it to get a final "star" rating.### ⚠️ A Critical Note on Input Format**This is very important for getting the best performance!**This model was not just trained on review text; it was trained using a specific format that includes **both the review title and the review text**, separated by the `[SEP]` token.The title often contains a powerful summary of the sentiment (e.g., "Best Pasta Ever!" or "Total Rip-off!"). Using this format ensures the model gets the same type of input it was trained on.**Correct Format:**`input_text = review_title + " [SEP] " + review_text`If you only have the review text, the model will still work well, but performance will be slightly lower.### Pipeline Usage ExampleHere is how you should format your inputs before passing them to the pipeline:```pythonfrom transformers import AutoTokenizer, AutoModelForSequenceClassification, pipelineimport numpy as np # Make sure to import numpymodel_name = "Festooned/Multilingual-Restaurant-Reviews-Sentiment"tokenizer = AutoTokenizer.from_pretrained(model_name)6 unmodified lines# Let's create a pipelinesentiment_pipe = pipeline("text-classification", model=model, tokenizer=tokenizer)# Example reviews using the recommended formatreviews = ["Absolutely incredible [SEP] This was the best pasta I've ever had in my life.", # 5-star"Servicio terrible [SEP] El servicio fue terrible y la comida tardó una hora en llegar.", # 1-star"It was fine [SEP] It was... fine. Nothing special, but not bad either." # 3-star]# Get the raw predictions8 unmodified lines# (Remember our labels are 0-4, so we add 1)# ---for text, pred in zip(reviews, raw_preds):# 'score' is the raw regression value (our model predicts 0-4)raw_score = pred['score']# Round and clamp to be safe (0-4)star_label_rounded = np.clip(round(raw_score), 0, 4)# Add 1 to get the 1-5 star ratingfinal_star_rating = int(star_label_rounded + 1)print(f"Review: {text[:40]}...")print(f" Final Rating: {final_star_rating} stars\n")```---
README.md+30-13