Views
No views yet
1from transformers import pipeline, BertTokenizer, BertForSequenceClassification
2
3tokenizer = BertTokenizer.from_pretrained("udit-k/HamSpamBERT")
4model = BertForSequenceClassification.from_pretrained("udit-k/HamSpamBERT")
5
6classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
7print(classifier("Call this number to win FREE IPL FINAL tickets!!!"))
8print(classifier("Call me when you reach home :)"))[{'label': 'LABEL_1', 'score': 0.9999189376831055}]
[{'label': 'LABEL_0', 'score': 0.9999370574951172}]| Training Loss | Epoch | Step | Validation Loss | Accuracy | Precision | Recall | F1 |
|---|---|---|---|---|---|---|---|
| No log | 1.0 | 279 | 0.0492 | 0.9901 | 1.0 | 0.9262 | 0.9617 |
| 0.0635 | 2.0 | 558 | 0.0117 | 0.9982 | 1.0 | 0.9866 | 0.9932 |
| 0.0635 | 3.0 | 837 | 0.0120 | 0.9982 | 0.9933 | 0.9933 | 0.9933 |
| 0.0138 | 4.0 | 1116 | 0.0072 | 0.9991 | 1.0 | 0.9933 | 0.9966 |
| 0.0138 | 5.0 | 1395 | 0.0086 | 0.9982 | 0.9933 | 0.9933 | 0.9933 |
| 0.0007 | 6.0 | 1674 | 0.0090 | 0.9982 | 0.9933 | 0.9933 | 0.9933 |
| 0.0007 | 7.0 | 1953 | 0.0091 | 0.9982 | 0.9933 | 0.9933 | 0.9933 |