cardiffnlp / tweet-topic-21-single

huggingface.co
Total runs: 40
24-hour runs: -8
7-day runs: -19
30-day runs: -3
Model's Last Updated: October 25 2022
text-classification

Introduction of tweet-topic-21-single

Model Details of tweet-topic-21-single

tweet-topic-21-single

This is a RoBERTa-base model trained on ~124M tweets from January 2018 to December 2021 (see here ), and finetuned for single-label topic classification on a corpus of 6,997 tweets . The original roBERTa-base model can be found here and the original reference paper is TweetEval . This model is suitable for English.

Labels :

  • 0 -> arts_&_culture;
  • 1 -> business_&_entrepreneurs;
  • 2 -> pop_culture;
  • 3 -> daily_life;
  • 4 -> sports_&_gaming;
  • 5 -> science_&_technology
Full classification example
from transformers import AutoModelForSequenceClassification, TFAutoModelForSequenceClassification
from transformers import AutoTokenizer
import numpy as np
from scipy.special import softmax

    
MODEL = f"cardiffnlp/tweet-topic-21-single"
tokenizer = AutoTokenizer.from_pretrained(MODEL)

# PT
model = AutoModelForSequenceClassification.from_pretrained(MODEL)
class_mapping = model.config.id2label

text = "Tesla stock is on the rise!"
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)

scores = output[0][0].detach().numpy()
scores = softmax(scores)

# TF
#model = TFAutoModelForSequenceClassification.from_pretrained(MODEL)
#class_mapping = model.config.id2label
#text = "Tesla stock is on the rise!"
#encoded_input = tokenizer(text, return_tensors='tf')
#output = model(**encoded_input)
#scores = output[0][0]
#scores = softmax(scores)


ranking = np.argsort(scores)
ranking = ranking[::-1]
for i in range(scores.shape[0]):
    l = class_mapping[ranking[i]]
    s = scores[ranking[i]]
    print(f"{i+1}) {l} {np.round(float(s), 4)}")

Output:

1) business_&_entrepreneurs 0.8361
2) science_&_technology 0.0904
3) pop_culture 0.0288
4) daily_life 0.0178
5) arts_&_culture 0.0137
6) sports_&_gaming 0.0133

Runs of cardiffnlp tweet-topic-21-single on huggingface.co

40
Total runs
-8
24-hour runs
1
3-day runs
-19
7-day runs
-3
30-day runs

More Information About tweet-topic-21-single huggingface.co Model

tweet-topic-21-single huggingface.co

tweet-topic-21-single huggingface.co is an AI model on huggingface.co that provides tweet-topic-21-single's model effect (), which can be used instantly with this cardiffnlp tweet-topic-21-single model. huggingface.co supports a free trial of the tweet-topic-21-single model, and also provides paid use of the tweet-topic-21-single. Support call tweet-topic-21-single model through api, including Node.js, Python, http.

tweet-topic-21-single huggingface.co Url

https://huggingface.co/cardiffnlp/tweet-topic-21-single

cardiffnlp tweet-topic-21-single online free

tweet-topic-21-single huggingface.co is an online trial and call api platform, which integrates tweet-topic-21-single's modeling effects, including api services, and provides a free online trial of tweet-topic-21-single, you can try tweet-topic-21-single online for free by clicking the link below.

cardiffnlp tweet-topic-21-single online free url in huggingface.co:

https://huggingface.co/cardiffnlp/tweet-topic-21-single

tweet-topic-21-single install

tweet-topic-21-single is an open source model from GitHub that offers a free installation service, and any user can find tweet-topic-21-single on GitHub to install. At the same time, huggingface.co provides the effect of tweet-topic-21-single install, users can directly use tweet-topic-21-single installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

tweet-topic-21-single install url in huggingface.co:

https://huggingface.co/cardiffnlp/tweet-topic-21-single

Url of tweet-topic-21-single

tweet-topic-21-single huggingface.co Url

Provider of tweet-topic-21-single huggingface.co

cardiffnlp
ORGANIZATIONS

Other API from cardiffnlp