fancyzhx/amazon_polarity
Viewer • Updated • 4M • 17.1k • 48
How to use AdamCodd/distilbert-base-uncased-finetuned-sentiment-amazon with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="AdamCodd/distilbert-base-uncased-finetuned-sentiment-amazon") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("AdamCodd/distilbert-base-uncased-finetuned-sentiment-amazon")
model = AutoModelForSequenceClassification.from_pretrained("AdamCodd/distilbert-base-uncased-finetuned-sentiment-amazon")This model is a fine-tuned version of distilbert-base-uncased on a subset of the amazon-polarity dataset.
[Update 10/10/23] The model has been retrained on a larger part of the dataset with an improvement on the loss, f1 score and accuracy. It achieves the following results on the evaluation set:
This sentiment classifier has been trained on 360_000 samples for the training set, 40_000 samples for the validation set and 40_000 samples for the test set.
from transformers import pipeline
# Create the pipeline
sentiment_classifier = pipeline('text-classification', model='AdamCodd/distilbert-base-uncased-finetuned-sentiment-amazon')
# Now you can use the pipeline to get the sentiment
result = sentiment_classifier("This product doesn't fit me at all.")
print(result)
#[{'label': 'negative', 'score': 0.9994848966598511}]
More information needed
The following hyperparameters were used during training:
(Previous results before retraining from the model evaluator)
| key | value |
|---|---|
| eval_accuracy | 0.94112 |
| eval_auc | 0.9849 |
| eval_f1_score | 0.9417 |
| eval_precision | 0.9321 |
| eval_recall | 0.95149 |
If you want to support me, you can here.