Views
No views yet
1from transformers import AutoModelForSequenceClassification, AutoTokenizer
2import torch
3import torch.nn.functional as F
4
5# Load the model and tokenizer
6model = AutoModelForSequenceClassification.from_pretrained("mempooltx/bert-base-fallacy-detection")
7tokenizer = AutoTokenizer.from_pretrained("mempooltx/bert-base-fallacy-detection")
8
9# Prepare the text
10text = "the sky is blue because the sky is blue"
11inputs = tokenizer(text, padding=True, truncation=True, return_tensors="pt")
12
13# Get predictions
14model.eval()
15with torch.no_grad():
16 outputs = model(**inputs)
17
18# Convert logits to probabilities
19probabilities = F.softmax(outputs.logits, dim=1)| Label | Description |
|---|---|
| 0 | false causality |
| 1 | circular reasoning |
| 2 | fallacy of relevance |
| 3 | intentional |
| 4 | fallacy of credibility |
| 5 | faulty generalization |
| 6 | equivocation |
| 7 | ad hominem |
| 8 | appeal to emotion |
| 9 | fallacy of extension |
| 10 | false dilemma |
| 11 | fallacy of logic |
| 12 | ad populum |