Downloads · 30 days
28
2% of all-time downloads
RashidNLP/Amazon-Deberta-Base-Sentiment
Amazon-Deberta-Base-Sentiment is a text classification model from RashidNLP. 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 is a Deberta model finetuned on over 1 million reviews from Amazon's multi-reviews dataset.
Downloads · 30 days
28
2% of all-time downloads
All-time downloads
1.8K
Public
Parameters
184M
1.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.bin738 MB · 50%
How the weights are stored.
F32184M · 100%
From the Hugging Face model README
This is a Deberta model finetuned on over 1 million reviews from Amazon's multi-reviews dataset.
import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
def get_sentiment(sentence):
bert_dict = {}
vectors = tokenizer(sentence, return_tensors='pt').to(device)
outputs = bert_model(**vectors).logits
probs = torch.nn.functional.softmax(outputs, dim = 1)[0]
bert_dict['neg'] = round(probs[0].item(), 3)
bert_dict['neu'] = round(probs[1].item(), 3)
bert_dict['pos'] = round(probs[2].item(), 3)
return bert_dict
MODEL_NAME = 'RashidNLP/Amazon-Deberta-Base-Sentiment'
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
bert_model = AutoModelForSequenceClassification.from_pretrained(MODEL_NAME, num_labels = 3).to(device)
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
get_sentiment("This is quite a mess you have made")