Views
No views yet
learning rate 2e-5,
batch size 8,
num_train_epochs=8,| Epoch | Training Loss | Validation Loss | Accuracy | F1 |
|---|---|---|---|---|
| 8 | 0.468200 | 0.458632 | 0.904762 | 0.899756 |
1from transformers import pipeline
2nlp = pipeline(task='text-classification',
3 model='nickwong64/bert-base-uncased-poems-sentiment')
4p1 = "No man is an island, Entire of itself, Every man is a piece of the continent, A part of the main."
5p2 = "Ten years, dead and living dim and draw apart. I don’t try to remember, But forgetting is hard."
6p3 = "My mind to me a kingdom is; Such present joys therein I find,That it excels all other bliss"
7print(nlp(p1))
8print(nlp(p2))
9print(nlp(p3))
10"""
11output:
12[{'label': 'no_impact', 'score': 0.9982421398162842}]
13[{'label': 'negative', 'score': 0.9856176972389221}]
14[{'label': 'positive', 'score': 0.9931322932243347}]
15"""{0: 'negative', 1: 'positive', 2: 'no_impact', 3: 'mixed'}{'test_loss': 0.4359096586704254,
'test_accuracy': 0.9142857142857143,
'test_f1': 0.9120554830816401,
'test_runtime': 0.5689,
'test_samples_per_second': 184.582,
'test_steps_per_second': 24.611}