Views
No views yet
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2
3tokenizer = AutoTokenizer.from_pretrained("LumiOpen/llama-hpltv2-edu-classifier-xlm-roberta-large-mar-Deva")
4model = AutoModelForSequenceClassification.from_pretrained("LumiOpen/llama-hpltv2-edu-classifier-xlm-roberta-large-mar-Deva")
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.85 0.49 0.62 8377
1 0.58 0.69 0.63 9709
2 0.40 0.61 0.48 3738
3 0.39 0.49 0.43 1899
4 0.68 0.32 0.44 1241
5 0.12 0.17 0.14 36
accuracy 0.58 25000
macro avg 0.50 0.46 0.46 25000
weighted avg 0.63 0.58 0.58 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 }
}