Views
No views yet
torch.optim.AdamWf1-score| 1 | 2 | 3 | 4 | 5 | |
|---|---|---|---|---|---|
| 1 | 8607 | 1661 | 72 | 1 | 0 |
| 2 | 1834 | 4349 | 580 | 18 | 0 |
| 3 | 120 | 885 | 1207 | 102 | 0 |
| 4 | 7 | 52 | 300 | 202 | 0 |
| 5 | 0 | 0 | 1 | 2 | 0 |
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
5
6tokenizer = AutoTokenizer.from_pretrained("Polygl0t/hindi-roberta-edu-classifier")
7model = AutoModelForSequenceClassification.from_pretrained("Polygl0t/hindi-roberta-edu-classifier")
8model.to(device)
9
10
11text = "यह एक उदाहरण है।"
12encoded_input = tokenizer(text, return_tensors="pt", padding="longest", truncation=True).to(device)
13
14with torch.no_grad():
15 model_output = model(**encoded_input)
16 logits = model_output.logits.squeeze(-1).float().cpu().numpy()
17
18# scores are produced in the range [0, 4]. To convert to the range [1, 5], we can simply add 1 to the score.
19score = [x + 1 for x in logits.tolist()][0]
20
21print({
22 "text": text,
23 "score": score,
24 "int_score": [int(round(max(0, min(score, 4)))) + 1 for score in logits][0],
25})1@misc{shiza2026lilmoo,
2 title={{Raising Bars, Not Parameters: LilMoo Compact Language Model for Hindi}},
3 author={Shiza Fatimah and Aniket Sen and Sophia Falk and Florian Mai and Lucie Flek and Nicholas Kluge Corr{\^e}a},
4 year={2026},
5 eprint={2603.03508},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2603.03508},
9}