Views
No views yet
train_2020 split and validated on test_2021 split of tweet_topic.
Fine-tuning script can be found here. It achieves the following results on the test_2021 set:1import math
2import torch
3from transformers import AutoModelForSequenceClassification, AutoTokenizer
4
5def sigmoid(x):
6 return 1 / (1 + math.exp(-x))
7
8tokenizer = AutoTokenizer.from_pretrained("cardiffnlp/roberta-large-tweet-topic-multi-2020")
9model = AutoModelForSequenceClassification.from_pretrained("cardiffnlp/roberta-large-tweet-topic-multi-2020", problem_type="multi_label_classification")
10model.eval()
11class_mapping = model.config.id2label
12
13with torch.no_grad():
14 text = #NewVideo Cray Dollas- Water- Ft. Charlie Rose- (Official Music Video)- {{URL}} via {@YouTube@} #watchandlearn {{USERNAME}}
15 tokens = tokenizer(text, return_tensors='pt')
16 output = model(**tokens)
17 flags = [sigmoid(s) > 0.5 for s in output[0][0].detach().tolist()]
18 topic = [class_mapping[n] for n, i in enumerate(flags) if i]
19print(topic)
@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"
}