Instructions to use Mishtar4/persuasion-detector-xlm-roberta with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Mishtar4/persuasion-detector-xlm-roberta with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Mishtar4/persuasion-detector-xlm-roberta")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("Mishtar4/persuasion-detector-xlm-roberta") model = AutoModelForSequenceClassification.from_pretrained("Mishtar4/persuasion-detector-xlm-roberta", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Persuasion Technique Detector โ XLM-RoBERTa-large
Fine-tuned XLM-RoBERTa-large for multi-label detection of 23 persuasion techniques at paragraph level.
Model Details
- Base model: xlm-roberta-large
- Task: Multi-label text classification (23 classes)
- Training data: SemEval 2023 Task 3 (~19,900 train / ~6,500 val paragraphs, 6 languages)
- Best micro-F1: ~0.45 on Polish dev set
- Languages: Optimized for Polish, supports 100+ languages
Usage
from transformers import AutoTokenizer, AutoModelForSequenceClassification
from huggingface_hub import hf_hub_download
import torch
import numpy as np
model_id = "Mishtar4/persuasion-detector-xlm-roberta"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id).eval()
thresholds = np.load(hf_hub_download(model_id, "thresholds.npy"))
labels = open(hf_hub_download(model_id, "labels.txt")).read().splitlines()
text = "Your paragraph here"
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=256)
with torch.no_grad():
probs = torch.sigmoid(model(**inputs).logits)[0].numpy()
detected = [(labels[i], float(probs[i])) for i in range(len(labels)) if probs[i] >= thresholds[i]]
print(detected)
Classes
23 persuasion techniques from SemEval 2023 Task 3:
Appeal_to_Authority, Appeal_to_Popularity, Appeal_to_Values, Appeal_to_Fear-Prejudice, Flag_Waving, Causal_Oversimplification, False_Dilemma-No_Choice, Consequential_Oversimplification, Straw_Man, Red_Herring, Whataboutism, Slogans, Appeal_to_Time, Conversation_Killer, Loaded_Language, Repetition, Exaggeration-Minimisation, Obfuscation-Vagueness-Confusion, Name_Calling-Labeling, Doubt, Guilt_by_Association, Appeal_to_Hypocrisy, Questioning_the_Reputation
Deployment
Used in a bilingual Telegram bot (EN/PL/UA): github.com/Mishtar4/persuasion-bot
- Downloads last month
- 322
Model tree for Mishtar4/persuasion-detector-xlm-roberta
Base model
FacebookAI/xlm-roberta-largeEvaluation results
- Micro-F1 (Polish dev) on SemEval 2023 Task 3self-reported0.450