Views
No views yet
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2
3tokenizer = AutoTokenizer.from_pretrained("LumiOpen/llama-hpltv2-edu-classifier-xlm-roberta-large-tur-Latn")
4model = AutoModelForSequenceClassification.from_pretrained("LumiOpen/llama-hpltv2-edu-classifier-xlm-roberta-large-tur-Latn")
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.88 0.73 0.80 13064
1 0.55 0.72 0.63 7719
2 0.44 0.52 0.48 2564
3 0.36 0.30 0.33 1059
4 0.71 0.16 0.27 576
5 0.38 0.17 0.23 18
accuracy 0.68 25000
macro avg 0.56 0.44 0.46 25000
weighted avg 0.71 0.68 0.68 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 }
}