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
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}]]
- Downloads last month
- 10