Views
No views yet
augmented and the original split as an external validation set.aedupuga/food-description-text (splits: augmented, original)| Training Loss | Epoch | Step | Validation Loss | Accuracy | Precision | Recall | F1 |
|---|---|---|---|---|---|---|---|
| 0.1081 | 1.0 | 80 | 0.0947 | 0.975 | 0.9788 | 0.975 | 0.9698 |
| 0.0182 | 2.0 | 160 | 0.0139 | 1.0 | 1.0 | 1.0 | 1.0 |
| 0.0118 | 3.0 | 240 | 0.0077 | 1.0 | 1.0 | 1.0 | 1.0 |
| 0.0085 | 4.0 | 320 | 0.0059 | 1.0 | 1.0 | 1.0 | 1.0 |
| 0.0068 | 5.0 | 400 | 0.0054 | 1.0 | 1.0 | 1.0 | 1.0 |
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch, numpy as np
3
4model_id = "{cfg.HUB_REPO_ID}"
5tok = AutoTokenizer.from_pretrained(model_id)
6mdl = AutoModelForSequenceClassification.from_pretrained(model_id)
7mdl.eval()
8
9text = "Orange juice is made by squeezing oranges."
10inputs = tok(text, return_tensors="pt", truncation=True)
11with torch.no_grad():
12 logits = mdl(**inputs).logits
13probs = torch.softmax(logits, dim=-1)[0].detach().numpy()
14pred = int(np.argmax(probs))
15print(pred, mdl.config.id2label[pred], probs[pred])