Linna j-hartmann commited on
Commit
02a4d55
0 Parent(s):

Duplicate from j-hartmann/emotion-english-distilroberta-base

Browse files

Co-authored-by: Hartmann <j-hartmann@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
2
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.h5 filter=lfs diff=lfs merge=lfs -text
5
+ *.tflite filter=lfs diff=lfs merge=lfs -text
6
+ *.tar.gz filter=lfs diff=lfs merge=lfs -text
7
+ *.ot filter=lfs diff=lfs merge=lfs -text
8
+ *.onnx filter=lfs diff=lfs merge=lfs -text
9
+ *.arrow filter=lfs diff=lfs merge=lfs -text
10
+ *.ftz filter=lfs diff=lfs merge=lfs -text
11
+ *.joblib filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.pb filter=lfs diff=lfs merge=lfs -text
15
+ *.pt filter=lfs diff=lfs merge=lfs -text
16
+ *.pth filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ tags:
4
+ - distilroberta
5
+ - sentiment
6
+ - emotion
7
+ - twitter
8
+ - reddit
9
+ widget:
10
+ - text: Oh wow. I didn't know that.
11
+ - text: This movie always makes me cry..
12
+ - text: Oh Happy Day
13
+ duplicated_from: j-hartmann/emotion-english-distilroberta-base
14
+ ---
15
+
16
+ # Emotion English DistilRoBERTa-base
17
+
18
+ # Description ℹ
19
+
20
+ With this model, you can classify emotions in English text data. The model was trained on 6 diverse datasets (see Appendix below) and predicts Ekman's 6 basic emotions, plus a neutral class:
21
+
22
+ 1) anger 🤬
23
+ 2) disgust 🤢
24
+ 3) fear 😨
25
+ 4) joy 😀
26
+ 5) neutral 😐
27
+ 6) sadness 😭
28
+ 7) surprise 😲
29
+
30
+ The model is a fine-tuned checkpoint of [DistilRoBERTa-base](https://huggingface.co/distilroberta-base). For a 'non-distilled' emotion model, please refer to the model card of the [RoBERTa-large](https://huggingface.co/j-hartmann/emotion-english-roberta-large) version.
31
+
32
+ # Application 🚀
33
+
34
+ a) Run emotion model with 3 lines of code on single text example using Hugging Face's pipeline command on Google Colab:
35
+
36
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/j-hartmann/emotion-english-distilroberta-base/blob/main/simple_emotion_pipeline.ipynb)
37
+
38
+ ```python
39
+ from transformers import pipeline
40
+ classifier = pipeline("text-classification", model="j-hartmann/emotion-english-distilroberta-base", return_all_scores=True)
41
+ classifier("I love this!")
42
+ ```
43
+
44
+ ```python
45
+ Output:
46
+ [[{'label': 'anger', 'score': 0.004419783595949411},
47
+ {'label': 'disgust', 'score': 0.0016119900392368436},
48
+ {'label': 'fear', 'score': 0.0004138521908316761},
49
+ {'label': 'joy', 'score': 0.9771687984466553},
50
+ {'label': 'neutral', 'score': 0.005764586851000786},
51
+ {'label': 'sadness', 'score': 0.002092392183840275},
52
+ {'label': 'surprise', 'score': 0.008528684265911579}]]
53
+ ```
54
+
55
+ b) Run emotion model on multiple examples and full datasets (e.g., .csv files) on Google Colab:
56
+
57
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/j-hartmann/emotion-english-distilroberta-base/blob/main/emotion_prediction_example.ipynb)
58
+
59
+ # Contact 💻
60
+
61
+ Please reach out to [jochen.hartmann@tum.de](mailto:jochen.hartmann@tum.de) if you have any questions or feedback.
62
+
63
+ Thanks to Samuel Domdey and [chrsiebert](https://huggingface.co/siebert) for their support in making this model available.
64
+
65
+ # Reference ✅
66
+
67
+ For attribution, please cite the following reference if you use this model. A working paper will be available soon.
68
+
69
+ ```
70
+ Jochen Hartmann, "Emotion English DistilRoBERTa-base". https://huggingface.co/j-hartmann/emotion-english-distilroberta-base/, 2022.
71
+ ```
72
+
73
+ BibTex citation:
74
+
75
+ ```
76
+ @misc{hartmann2022emotionenglish,
77
+ author={Hartmann, Jochen},
78
+ title={Emotion English DistilRoBERTa-base},
79
+ year={2022},
80
+ howpublished = {\url{https://huggingface.co/j-hartmann/emotion-english-distilroberta-base/}},
81
+ }
82
+ ```
83
+
84
+ # Appendix 📚
85
+
86
+ Please find an overview of the datasets used for training below. All datasets contain English text. The table summarizes which emotions are available in each of the datasets. The datasets represent a diverse collection of text types. Specifically, they contain emotion labels for texts from Twitter, Reddit, student self-reports, and utterances from TV dialogues. As MELD (Multimodal EmotionLines Dataset) extends the popular EmotionLines dataset, EmotionLines itself is not included here.
87
+
88
+ |Name|anger|disgust|fear|joy|neutral|sadness|surprise|
89
+ |---|---|---|---|---|---|---|---|
90
+ |Crowdflower (2016)|Yes|-|-|Yes|Yes|Yes|Yes|
91
+ |Emotion Dataset, Elvis et al. (2018)|Yes|-|Yes|Yes|-|Yes|Yes|
92
+ |GoEmotions, Demszky et al. (2020)|Yes|Yes|Yes|Yes|Yes|Yes|Yes|
93
+ |ISEAR, Vikash (2018)|Yes|Yes|Yes|Yes|-|Yes|-|
94
+ |MELD, Poria et al. (2019)|Yes|Yes|Yes|Yes|Yes|Yes|Yes|
95
+ |SemEval-2018, EI-reg, Mohammad et al. (2018) |Yes|-|Yes|Yes|-|Yes|-|
96
+
97
+ The model is trained on a balanced subset from the datasets listed above (2,811 observations per emotion, i.e., nearly 20k observations in total). 80% of this balanced subset is used for training and 20% for evaluation. The evaluation accuracy is 66% (vs. the random-chance baseline of 1/7 = 14%).
98
+
99
+ # Scientific Applications 📖
100
+
101
+ Below you can find a list of papers using "Emotion English DistilRoBERTa-base". If you would like your paper to be added to the list, please send me an email.
102
+
103
+ - Butt, S., Sharma, S., Sharma, R., Sidorov, G., & Gelbukh, A. (2022). What goes on inside rumour and non-rumour tweets and their reactions: A Psycholinguistic Analyses. Computers in Human Behavior, 107345.
104
+ - Kuang, Z., Zong, S., Zhang, J., Chen, J., & Liu, H. (2022). Music-to-Text Synaesthesia: Generating Descriptive Text from Music Recordings. arXiv preprint arXiv:2210.00434.
105
+ - Rozado, D., Hughes, R., & Halberstadt, J. (2022). Longitudinal analysis of sentiment and emotion in news media headlines using automated labelling with Transformer language models. Plos one, 17(10), e0276367.
config.json ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "distilroberta-base",
3
+ "architectures": [
4
+ "RobertaForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 0,
8
+ "eos_token_id": 2,
9
+ "gradient_checkpointing": false,
10
+ "hidden_act": "gelu",
11
+ "hidden_dropout_prob": 0.1,
12
+ "hidden_size": 768,
13
+ "id2label": {
14
+ "0": "anger",
15
+ "1": "disgust",
16
+ "2": "fear",
17
+ "3": "joy",
18
+ "4": "neutral",
19
+ "5": "sadness",
20
+ "6": "surprise"
21
+ },
22
+ "initializer_range": 0.02,
23
+ "intermediate_size": 3072,
24
+ "label2id": {
25
+ "anger": 0,
26
+ "disgust": 1,
27
+ "fear": 2,
28
+ "joy": 3,
29
+ "neutral": 4,
30
+ "sadness": 5,
31
+ "surprise": 6
32
+ },
33
+ "layer_norm_eps": 1e-05,
34
+ "max_position_embeddings": 514,
35
+ "model_type": "roberta",
36
+ "num_attention_heads": 12,
37
+ "num_hidden_layers": 6,
38
+ "pad_token_id": 1,
39
+ "position_embedding_type": "absolute",
40
+ "problem_type": "single_label_classification",
41
+ "transformers_version": "4.6.1",
42
+ "type_vocab_size": 1,
43
+ "use_cache": true,
44
+ "vocab_size": 50265
45
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dde1eadd81741344dd707d1c482a3293810eb895c873053213ccdb2b57ca9e95
3
+ size 328544361
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"bos_token": "<s>", "eos_token": "</s>", "unk_token": "<unk>", "sep_token": "</s>", "pad_token": "<pad>", "cls_token": "<s>", "mask_token": {"content": "<mask>", "single_word": false, "lstrip": true, "rstrip": false, "normalized": false}}
tf_model.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c063ba3427b92183bb04bbff65f89e06838058606ae9fed8095594cd740af0ae
3
+ size 328644696
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"unk_token": "<unk>", "bos_token": "<s>", "eos_token": "</s>", "add_prefix_space": false, "errors": "replace", "sep_token": "</s>", "cls_token": "<s>", "pad_token": "<pad>", "mask_token": "<mask>", "model_max_length": 512, "special_tokens_map_file": null, "name_or_path": "distilroberta-base"}
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4ed7a68d54395ab0be21726d6fcf25f942ed459b16387bbf9cf251051986766f
3
+ size 2415
vocab.json ADDED
The diff for this file is too large to render. See raw diff