Views
No views yet
1from transformers import AutoTokenizer, pipeline
2
3tokenizer = AutoTokenizer.from_pretrained("xlm-roberta-large")
4pipe = pipeline(
5 model="poltextlab/xlm-roberta-large-i5-v6",
6 task="text-classification",
7 tokenizer=tokenizer,
8 use_fast=False,
9 token="<your_hf_read_only_token>"
10)
11
12text = "<text_to_classify>"
13pipe(text)| Label | Precision | Recall | F1-score | Support |
|---|---|---|---|---|
| (1301) Welfare chauvinism | 0.44 | 0.8 | 0.57 | 10 |
| (1302) Security hazard | 1 | 0.82 | 0.9 | 11 |
| (1303) Immorality | 0.39 | 0.61 | 0.48 | 18 |
| (1304) Economic burden | 0.09 | 0.08 | 0.09 | 12 |
| (1305) Economic determinism | 1 | 0.5 | 0.67 | 12 |
| (1306) Workfare | 0.55 | 0.38 | 0.44 | 16 |
| (1399) None of them | 0 | 0 | 0 | 9 |
sentencepiece tokenizer. In order to run the model before transformers==4.27 you need to install it manually.