Views
No views yet
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2
3tokenizer = AutoTokenizer.from_pretrained("LumiOpen/llama-hpltv2-edu-classifier-xlm-roberta-large-tat-Cyrl")
4model = AutoModelForSequenceClassification.from_pretrained("LumiOpen/llama-hpltv2-edu-classifier-xlm-roberta-large-tat-Cyrl")
5text = "I'm non-educational web page containing nothing useful"
6inputs = tokenizer(text, return_tensors="pt", padding="longest", truncation=True)
7outputs = model(**inputs)
8logits = outputs.logits.squeeze(-1).float().detach().numpy()
9score = logits.item()
10result = {
11 "text": text,
12 "score": score,
13 "int_score": int(round(max(0, min(score, 5)))),
14}
15print(result)
16#results from a model trained with Welsh annotations
17#{'text': "I'm non-educational web page containing nothing useful", 'score': 0.8145455718040466, 'int_score': 1}
18#{'text': 'what are most common animals found in farm? there are cows, sheeps', 'score': 1.6858888864517212, 'int_score': 2}
precision recall f1-score support
0 0.70 0.45 0.54 7676
1 0.55 0.73 0.63 10516
2 0.44 0.47 0.45 4315
3 0.34 0.27 0.30 1540
4 0.57 0.17 0.26 825
5 0.60 0.23 0.33 128
accuracy 0.55 25000
macro avg 0.53 0.39 0.42 25000
weighted avg 0.56 0.55 0.54 25000
@misc {llama_hplt_edu_classifiers_2025,
author = { Tarkka, Otto, Reunamo, Akseli, Vitiugin, Fedor and Pyysalo, Sampo }
title = { Llama-HPLT-edu classifiers },
year = 2025,
url = {https://huggingface.co/collections/LumiOpen/hplt-edu-classifiers-68a85a78f9710426320e7cbb},
publisher = { Hugging Face }
}