Views
No views yet
torch.optim.AdamWf1-score| 1 | 2 | 3 | 4 | 5 | |
|---|---|---|---|---|---|
| 1 | 16652 | 646 | 15 | 0 | 0 |
| 2 | 637 | 673 | 123 | 6 | 0 |
| 3 | 112 | 347 | 263 | 41 | 0 |
| 4 | 21 | 47 | 110 | 110 | 32 |
| 5 | 4 | 8 | 10 | 22 | 121 |
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/portuguese-bertimbau-toxicity-classifier")
7model = AutoModelForSequenceClassification.from_pretrained("Polygl0t/portuguese-bertimbau-toxicity-classifier")
8model.to(device)
9
10text = "Coloque aqui o seu texto ..."
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.
18score = [x + 1 for x in logits.tolist()][0]
19
20print({
21 "text": text,
22 "score": score,
23 "int_score": [int(round(max(0, min(score, 4)))) + 1 for score in logits][0],
24})1@misc{correa2026tucano2cool,
2 title={{Tucano 2 Cool: Better Open Source LLMs for Portuguese}},
3 author={Nicholas Kluge Corr{\^e}a and Aniket Sen and Shiza Fatimah and Sophia Falk and Lennard Landgraf and Julia Kastner and Lucie Flek},
4 year={2026},
5 eprint={2603.03543},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2603.03543},
9}