Views
No views yet
This article is under development. Please use the model for retraining on your data, not a "ready to use" solution.
1import torch
2from transformers import AutoTokenizer, AutoModelForSequenceClassification
3
4tokenizer = AutoTokenizer.from_pretrained("amedvedev/bert-tiny-cognitive-bias")
5model = AutoModelForSequenceClassification.from_pretrained("amedvedev/bert-tiny-cognitive-bias")
6
7inputs = tokenizer("He must never disappoint anyone.", return_tensors="pt")
8with torch.no_grad():
9 logits = model(**inputs).logits
10
11predicted_class_id = logits.argmax().item()
12model.config.id2label[predicted_class_id]| Precision | Recall | F1 | |
|---|---|---|---|
| No Distortion | 0.84 | 0.74 | 0.79 |
| Personalization | 0.86 | 0.89 | 0.87 |
| Emotional Reasoning | 0.88 | 0.96 | 0.92 |
| Overgeneralizing | 0.80 | 0.88 | 0.84 |
| Labeling | 0.84 | 0.80 | 0.82 |
| Should Statements | 0.88 | 0.95 | 0.91 |
| Catastrophizing | 0.88 | 0.86 | 0.87 |
| Reward Fallacy | 0.87 | 0.95 | 0.91 |
| Accuracy | Top-3 Accuracy | Top-5 Accuracy | Precision | Recall | F1 |
|---|---|---|---|---|---|
| 0.86 ± 0.04 | 0.99 ± 0.01 | 0.99 ± 0.01 | 0.86 ± 0.04 | 0.85 ± 0.04 | 0.85 ± 0.04 |