Views
No views yet
torch.optim.AdamWf1-score| 1 | 2 | 3 | 4 | 5 | |
|---|---|---|---|---|---|
| 1 | 5901 | 1586 | 34 | 0 | 0 |
| 2 | 1121 | 6597 | 818 | 13 | 0 |
| 3 | 12 | 902 | 1916 | 200 | 0 |
| 4 | 1 | 18 | 392 | 483 | 5 |
| 5 | 0 | 0 | 1 | 0 | 0 |
transformers library: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/bengali-banglabert-edu-classifier")
7model = AutoModelForSequenceClassification.from_pretrained("Polygl0t/bengali-banglabert-edu-classifier")
8model.to(device)
9
10text = "এটি একটি নমুনা গ্রন্থ।"
11encoded_input = tokenizer(text, return_tensors="pt", padding="longest", truncation=True).to(device)
12
13with torch.no_grad():
14 model_output = model(**encoded_input)
15 logits = model_output.logits.squeeze(-1).float().cpu().numpy()
16
17# scores are produced in the range [0, 4]. To convert to the range [1, 5], we can simply add 1 to the score.
18float_score = [x + 1 for x in logits.tolist()][0]
19
20print({
21 "text": text,
22 "score": float_score,
23 "int_score": [int(round(max(0, min(score, 4)))) + 1 for score in logits][0],
24})1@misc{fatimah2026liltii,
2 title={{LilTii: A 0.6B Bengali Language Model that Outperforms Qwen}},
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 howpublished={\url{https://hf.co/blog/Polygl0t/liltii}}
6}