DeBERTa: Decoding-enhanced BERT with Disentangled Attention
Paper
•
2006.03654
•
Published
•
3
This repository contains a fine-tuned DeBERTa model for sentiment analysis using the McDonald's review dataset from Kaggle. The model has been fine-tuned to classify customer sentiments as positive, negative, or neutral.
microsoft/deberta-v3-baseThe dataset consists of customer reviews from McDonald's, labeled with sentiment categories:
0: Negative1: Neutral2: PositiveTo load and use the model for inference:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_name = "iSathyam03/McD_Reviews_Sentiment_Analysis"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
def predict_sentiment(text):
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
prediction = torch.argmax(logits, dim=1).item()
sentiment_labels = {0: "Negative", 1: "Neutral", 2: "Positive"}
return sentiment_labels[prediction]
# Example
text = "The fries were amazing but the burger was stale."
print(predict_sentiment(text))
You can deploy this model using Hugging Face's Inference API or via Streamlit/Gradio for an interactive UI.
If you use this model, please cite this repository and the original DeBERTa paper:
@article{he2020deberta,
title={DeBERTa: Decoding-enhanced BERT with Disentangled Attention},
author={He, Pengcheng and Liu, Xiaodong and Gao, Jianfeng and Chen, Weizhu},
journal={arXiv preprint arXiv:2006.03654},
year={2020}
}
Base model
microsoft/deberta-v3-small