Instructions to use cardiffnlp/roberta-base-sentiment with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cardiffnlp/roberta-base-sentiment with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="cardiffnlp/roberta-base-sentiment")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("cardiffnlp/roberta-base-sentiment") model = AutoModelForSequenceClassification.from_pretrained("cardiffnlp/roberta-base-sentiment", device_map="auto") - Notebooks
- Google Colab
- Kaggle
model update
Browse filesFiles changed (3)
- README.mdAdded+88
- best_run_hyperparameters.jsonAdded+1
- metric.jsonAdded+1
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788---datasets:- tweet_evalmetrics:- f1- accuracymodel-index:- name: cardiffnlp/roberta-base-sentiment results: - task: type: text-classification name: Text Classification dataset: name: tweet_eval type: sentiment split: test metrics: - name: Micro F1 (tweet_eval/sentiment) type: micro_f1_tweet_eval/sentiment value: 0.7086453923803321 - name: Macro F1 (tweet_eval/sentiment) type: micro_f1_tweet_eval/sentiment value: 0.7097736527692039 - name: Accuracy (tweet_eval/sentiment) type: accuracy_tweet_eval/sentiment value: 0.7086453923803321pipeline_tag: text-classificationwidget:- text: Get the all-analog Classic Vinyl Edition of "Takin Off" Album from {@herbiehancock@} via {@bluenoterecords@} link below {{URL}} example_title: "topic_classification 1" - text: Yes, including Medicare and social security saving👍 example_title: "sentiment 1" - text: All two of them taste like ass. example_title: "offensive 1" - text: If you wanna look like a badass, have drama on social media example_title: "irony 1" - text: Whoever just unfollowed me you a bitch example_title: "hate 1" - text: I love swimming for the same reason I love meditating...the feeling of weightlessness. example_title: "emotion 1" - text: Beautiful sunset last night from the pontoon @TupperLakeNY example_title: "emoji 1" ---# cardiffnlp/roberta-base-sentiment
This model is a fine-tuned version of [roberta-base](https://huggingface.co/roberta-base) on the [`tweet_eval (sentiment)`](https://huggingface.co/datasets/tweet_eval) via [`tweetnlp`](https://github.com/cardiffnlp/tweetnlp).Training split is `train` and parameters have been tuned on the validation split `validation`.
Following metrics are achieved on the test split `test` ([link](https://huggingface.co/cardiffnlp/roberta-base-sentiment/raw/main/metric.json)).
- F1 (micro): 0.7086453923803321- F1 (macro): 0.7097736527692039- Accuracy: 0.7086453923803321
### UsageInstall tweetnlp via pip.```shellpip install tweetnlp```Load the model in python.```pythonimport tweetnlpmodel = tweetnlp.Classifier("cardiffnlp/roberta-base-sentiment", max_length=128)model.predict('Get the all-analog Classic Vinyl Edition of "Takin Off" Album from {@herbiehancock@} via {@bluenoterecords@} link below {{URL}}')```
### Reference
```@inproceedings{dimosthenis-etal-2022-twitter, title = "{T}witter {T}opic {C}lassification", author = "Antypas, Dimosthenis and Ushio, Asahi and Camacho-Collados, Jose and Neves, Leonardo and Silva, Vitor and Barbieri, Francesco", booktitle = "Proceedings of the 29th International Conference on Computational Linguistics", month = oct, year = "2022", address = "Gyeongju, Republic of Korea", publisher = "International Committee on Computational Linguistics"}```
1{"learning_rate": 1.717762111233842e-05, "num_train_epochs": 2, "per_device_train_batch_size": 16}1{"eval_loss": 0.7201297879219055, "eval_f1": 0.7086453923803321, "eval_f1_macro": 0.7097736527692039, "eval_accuracy": 0.7086453923803321, "eval_runtime": 68.9465, "eval_samples_per_second": 178.167, "eval_steps_per_second": 22.278}README.mdAdded+88
best_run_hyperparameters.jsonAdded+1
metric.jsonAdded+1