Emotion classifier for English translations of Bulgarian reality-TV lines, made in a BUas ADSAI student project
(Year 2 Block A, group 1) for the Content Intelligence Agency (CIA). FacebookAI/roberta-large, fully fine-tuned.
Earlier lines:\n<earlier lines>\nLine: <line>
(just Line: <line> for the first line), at most 256 tokens. Long inputs lose their oldest context first
(the tokenizer truncates on the left).Full model card (data, evaluation, limitations, ethics): task11/model_card.md
import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
repo = "Shadowiee/emotion-classifier-bg-en"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForSequenceClassification.from_pretrained(repo, dtype=torch.float32).eval()
text = "Earlier lines:\nYou have been nominated.\nLine: What? No way!"
with torch.no_grad():
logits = model(**tokenizer(text, return_tensors="pt", truncation=True, max_length=256)).logits
probs = torch.softmax(logits, -1)[0]
print(model.config.id2label[int(probs.argmax())], round(float(probs.max()), 3))
Pass dtype=torch.float32: Transformers 5 otherwise keeps the dtype a checkpoint was saved in.
FacebookAI/roberta-large