nickwong64 commited on
Commit
2d54069
1 Parent(s): 68fb121

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +69 -0
README.md ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ thumbnail: https://cdn.theatlantic.com/thumbor/lx3Vy9ojT2A0mHVooAUARLRpUEc=/0x215:3500x2184/976x549/media/img/mt/2018/03/RTR4F51Y/original.jpg
5
+ tags:
6
+ - text-classification
7
+ - sentiment-analysis
8
+ - poem-sentiment-detection
9
+ - poem-sentiment
10
+ license: apache-2.0
11
+ datasets:
12
+ - poem_sentment
13
+ metrics:
14
+ - Accuracy, F1 score
15
+
16
+ ---
17
+ ## nickwong64/bert-base-uncased-poems-sentiment
18
+ Bert is a Transformer Bidirectional Encoder based Architecture trained on MLM(Mask Language Modeling) objective.
19
+ [bert-base-uncased](https://huggingface.co/bert-base-uncased) finetuned on the [poem_sentiment](https://huggingface.co/datasets/poem_sentiment) dataset using HuggingFace Trainer with below training parameters.
20
+ ```
21
+ learning rate 2e-5,
22
+ batch size 8,
23
+ num_train_epochs=8,
24
+ ```
25
+
26
+ ## Model Performance
27
+ | Epoch | Training Loss | Validation Loss | Accuracy | F1 |
28
+ | --- | --- | --- | --- | --- |
29
+ | 8 | 0.468200 | 0.458632 | 0.904762 | 0.899756 |
30
+
31
+
32
+
33
+ ## How to Use the Model
34
+ ```python
35
+ from transformers import pipeline
36
+ nlp = pipeline(task='text-classification',
37
+ model='nickwong64/bert-base-uncased-poems-sentiment')
38
+ p1 = "No man is an island, Entire of itself, Every man is a piece of the continent, A part of the main."
39
+ p2 = "Ten years, dead and living dim and draw apart. I don’t try to remember, But forgetting is hard."
40
+ p3 = "My mind to me a kingdom is; Such present joys therein I find,That it excels all other bliss"
41
+ print(nlp(p1))
42
+ print(nlp(p2))
43
+ print(nlp(p3))
44
+ """
45
+ output:
46
+ [{'label': 'no_impact', 'score': 0.9982421398162842}]
47
+ [{'label': 'negative', 'score': 0.9856176972389221}]
48
+ [{'label': 'positive', 'score': 0.9931322932243347}]
49
+ """
50
+ ```
51
+
52
+ ## Dataset
53
+ [poem_sentiment](https://huggingface.co/datasets/poem_sentiment)
54
+
55
+ ## Labels
56
+ ```
57
+ {0: 'negative', 1: 'positive', 2: 'no_impact', 3: 'mixed'}
58
+ ```
59
+
60
+ ## Evaluation
61
+ ```
62
+ {'test_loss': 0.4359096586704254,
63
+ 'test_accuracy': 0.9142857142857143,
64
+ 'test_f1': 0.9120554830816401,
65
+ 'test_runtime': 0.5689,
66
+ 'test_samples_per_second': 184.582,
67
+ 'test_steps_per_second': 24.611}
68
+ ```
69
+