This is a RoBERTa-base model trained on ~90m tweets until the end of 2019 (see
here
) and finetuned for multi-label topic classification on a corpus of 11,267
tweets
.
The original RoBERTa-base model can be found
here
and the original reference paper is
TweetEval
. This model is suitable for English.
from transformers import AutoModelForSequenceClassification, TFAutoModelForSequenceClassification
from transformers import AutoTokenizer
import numpy as np
from scipy.special import expit
MODEL = f"cardiffnlp/tweet-topic-19-multi"
tokenizer = AutoTokenizer.from_pretrained(MODEL)
# PT
model = AutoModelForSequenceClassification.from_pretrained(MODEL)
class_mapping = model.config.id2label
text = "It is great to see athletes promoting awareness for climate change."
tokens = tokenizer(text, return_tensors='pt')
output = model(**tokens)
scores = output[0][0].detach().numpy()
scores = expit(scores)
predictions = (scores >= 0.5) * 1# TF#tf_model = TFAutoModelForSequenceClassification.from_pretrained(MODEL)#class_mapping = tf_model.config.id2label#text = "It is great to see athletes promoting awareness for climate change."#tokens = tokenizer(text, return_tensors='tf')#output = tf_model(**tokens)#scores = output[0][0]#scores = expit(scores)#predictions = (scores >= 0.5) * 1# Map to classesfor i inrange(len(predictions)):
if predictions[i]:
print(class_mapping[i])
Output:
news_&_social_concern
sports
Runs of cardiffnlp tweet-topic-19-multi on huggingface.co
16
Total runs
-1
24-hour runs
0
3-day runs
0
7-day runs
8
30-day runs
More Information About tweet-topic-19-multi huggingface.co Model
tweet-topic-19-multi huggingface.co
tweet-topic-19-multi huggingface.co is an AI model on huggingface.co that provides tweet-topic-19-multi's model effect (), which can be used instantly with this cardiffnlp tweet-topic-19-multi model. huggingface.co supports a free trial of the tweet-topic-19-multi model, and also provides paid use of the tweet-topic-19-multi. Support call tweet-topic-19-multi model through api, including Node.js, Python, http.
tweet-topic-19-multi huggingface.co is an online trial and call api platform, which integrates tweet-topic-19-multi's modeling effects, including api services, and provides a free online trial of tweet-topic-19-multi, you can try tweet-topic-19-multi online for free by clicking the link below.
cardiffnlp tweet-topic-19-multi online free url in huggingface.co:
tweet-topic-19-multi is an open source model from GitHub that offers a free installation service, and any user can find tweet-topic-19-multi on GitHub to install. At the same time, huggingface.co provides the effect of tweet-topic-19-multi install, users can directly use tweet-topic-19-multi installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
tweet-topic-19-multi install url in huggingface.co: