File size: 1,562 Bytes
61003b9 547f201 61003b9 ad4d0e8 61003b9 ad4d0e8 61003b9 ad4d0e8 61003b9 ad4d0e8 9bd3227 ad4d0e8 9bd3227 ad4d0e8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
---
language: uk
datasets: Yehor/ual-topics
license: cc-by-nc-sa-4.0
---
## Metrics
- Epochs: 25 (batch size: 128)
- Train loss: 0.13934
- Validation loss: 1.61486
- Test accuracy: 0.64375
- F1 (MACRO): 0.42084
## How to use
```python
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
tokenizer = AutoTokenizer.from_pretrained("Yehor/ual-topics-classifier")
model = AutoModelForSequenceClassification.from_pretrained("Yehor/ual-topics-classifier")
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
topic_classifier = pipeline(task='text-classification', model=model, tokenizer=tokenizer, device=device, top_k=5)
question = """
Що мені робити на ВЛК
"""
print(topic_classifier(question))
question = """
Які мої дії для отримання аліментів на дитину
"""
print(topic_classifier(question))
```
Results:
```
[[{'label': 'viiskovie_pravo', 'score': 0.9837057590484619}, {'label': 'inshe', 'score': 0.006433702539652586}, {'label': 'pratsevlashtuvvannya', 'score': 0.0026765114162117243}, {'label': 'sotsialnyj_zakhist', 'score': 0.0007523931562900543}, {'label': 'tsivilne_pravo', 'score': 0.000704631267581135}]]
[[{'label': 'simejne_pravo', 'score': 0.9449325799942017}, {'label': 'sotsialnyj_zakhist', 'score': 0.03451702371239662}, {'label': 'sudova_praktika', 'score': 0.0030595543794333935}, {'label': 'kriminalnie_pravo', 'score': 0.0024321323726326227}, {'label': 'viiskovie_pravo', 'score': 0.0022115600295364857}]]
```
|