Views
No views yet
distilbert-base-uncased) – a lightweight transformer architecture distilled from BERT, optimized for efficiency while maintaining strong performance in NLP tasks.padding=True (dynamic batch padding)truncation=True (truncate sequences longer than the model max length, 512 tokens)distilbert-base-uncased)negative, neutral, positive)padding=True (dynamic padding) and truncation=True1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4tokenizer = AutoTokenizer.from_pretrained("Dugerij/news_sentiment_classifier")
5model = AutoModelForSequenceClassification.from_pretrained("Dugerij/news_sentiment_classifier")
6
7text = ["Stocks plunge after weak earnings report"]
8inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
9outputs = model(**inputs)
10predictions = torch.argmax(outputs.logits, dim=-1)
11print(predictions) # 0=Negative, 1=Neutral, 2=Positive| Training Loss | Epoch | Step | Validation Loss | Accuracy | F1 |
|---|---|---|---|---|---|
| 0.9813 | 1.0 | 85 | 0.8793 | 0.5929 | 0.4414 |
| 0.8166 | 2.0 | 170 | 0.7464 | 0.6799 | 0.6059 |
| 0.6847 | 3.0 | 255 | 0.6330 | 0.7581 | 0.7392 |
| 0.5672 | 4.0 | 340 | 0.5483 | 0.7935 | 0.7884 |
| 0.4823 | 5.0 | 425 | 0.5025 | 0.7994 | 0.7963 |
| 0.4187 | 6.0 | 510 | 0.4817 | 0.8024 | 0.7996 |
| 0.3761 | 7.0 | 595 | 0.4661 | 0.8024 | 0.8022 |
| 0.3453 | 8.0 | 680 | 0.4580 | 0.8097 | 0.8088 |
| 0.32 | 9.0 | 765 | 0.4561 | 0.8097 | 0.8093 |
| 0.2931 | 10.0 | 850 | 0.4512 | 0.8142 | 0.8136 |
| 0.2757 | 11.0 | 935 | 0.4498 | 0.8156 | 0.8152 |
| 0.2646 | 12.0 | 1020 | 0.4542 | 0.8127 | 0.8133 |
| 0.2483 | 13.0 | 1105 | 0.4548 | 0.8201 | 0.8205 |
| 0.2355 | 14.0 | 1190 | 0.4557 | 0.8156 | 0.8159 |
| 0.2192 | 15.0 | 1275 | 0.4599 | 0.8156 | 0.8156 |