Upload 7 files
Browse files- README.md +65 -0
- config.json +82 -0
- merges.txt +0 -0
- special_tokens_map.json +1 -0
- tf_model.h5 +3 -0
- tokenizer_config.json +1 -0
- vocab.json +0 -0
README.md
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: en
|
3 |
+
tags:
|
4 |
+
- text-classification
|
5 |
+
- tensorflow
|
6 |
+
- roberta
|
7 |
+
datasets:
|
8 |
+
- go_emotions
|
9 |
+
license: mit
|
10 |
+
---
|
11 |
+
|
12 |
+
Connect me on LinkedIn
|
13 |
+
- [linkedin.com/in/arpanghoshal](https://www.linkedin.com/in/arpanghoshal)
|
14 |
+
|
15 |
+
|
16 |
+
## What is GoEmotions
|
17 |
+
|
18 |
+
Dataset labelled 58000 Reddit comments with 28 emotions
|
19 |
+
|
20 |
+
- admiration, amusement, anger, annoyance, approval, caring, confusion, curiosity, desire, disappointment, disapproval, disgust, embarrassment, excitement, fear, gratitude, grief, joy, love, nervousness, optimism, pride, realization, relief, remorse, sadness, surprise + neutral
|
21 |
+
|
22 |
+
|
23 |
+
## What is RoBERTa
|
24 |
+
|
25 |
+
RoBERTa builds on BERT’s language masking strategy and modifies key hyperparameters in BERT, including removing BERT’s next-sentence pretraining objective, and training with much larger mini-batches and learning rates. RoBERTa was also trained on an order of magnitude more data than BERT, for a longer amount of time. This allows RoBERTa representations to generalize even better to downstream tasks compared to BERT.
|
26 |
+
|
27 |
+
|
28 |
+
## Hyperparameters
|
29 |
+
|
30 |
+
| Parameter | |
|
31 |
+
| ----------------- | :---: |
|
32 |
+
| Learning rate | 5e-5 |
|
33 |
+
| Epochs | 10 |
|
34 |
+
| Max Seq Length | 50 |
|
35 |
+
| Batch size | 16 |
|
36 |
+
| Warmup Proportion | 0.1 |
|
37 |
+
| Epsilon | 1e-8 |
|
38 |
+
|
39 |
+
|
40 |
+
## Results
|
41 |
+
|
42 |
+
Best Result of `Macro F1` - 49.30%
|
43 |
+
|
44 |
+
## Usage
|
45 |
+
|
46 |
+
```python
|
47 |
+
|
48 |
+
from transformers import RobertaTokenizerFast, TFRobertaForSequenceClassification, pipeline
|
49 |
+
|
50 |
+
tokenizer = RobertaTokenizerFast.from_pretrained("arpanghoshal/EmoRoBERTa")
|
51 |
+
model = TFRobertaForSequenceClassification.from_pretrained("arpanghoshal/EmoRoBERTa")
|
52 |
+
|
53 |
+
emotion = pipeline('sentiment-analysis',
|
54 |
+
model='arpanghoshal/EmoRoBERTa')
|
55 |
+
|
56 |
+
emotion_labels = emotion("Thanks for using it.")
|
57 |
+
print(emotion_labels)
|
58 |
+
|
59 |
+
```
|
60 |
+
Output
|
61 |
+
|
62 |
+
```
|
63 |
+
[{'label': 'gratitude', 'score': 0.9964383244514465}]
|
64 |
+
```
|
65 |
+
|
config.json
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"RobertaForSequenceClassification"
|
4 |
+
],
|
5 |
+
"attention_probs_dropout_prob": 0.1,
|
6 |
+
"bos_token_id": 0,
|
7 |
+
"eos_token_id": 2,
|
8 |
+
"gradient_checkpointing": false,
|
9 |
+
"hidden_act": "gelu",
|
10 |
+
"hidden_dropout_prob": 0.1,
|
11 |
+
"hidden_size": 768,
|
12 |
+
"id2label": {
|
13 |
+
"0": "admiration",
|
14 |
+
"1": "amusement",
|
15 |
+
"2": "anger",
|
16 |
+
"3": "annoyance",
|
17 |
+
"4": "approval",
|
18 |
+
"5": "caring",
|
19 |
+
"6": "confusion",
|
20 |
+
"7": "curiosity",
|
21 |
+
"8": "desire",
|
22 |
+
"9": "disappointment",
|
23 |
+
"10": "disapproval",
|
24 |
+
"11": "disgust",
|
25 |
+
"12": "embarrassment",
|
26 |
+
"13": "excitement",
|
27 |
+
"14": "fear",
|
28 |
+
"15": "gratitude",
|
29 |
+
"16": "grief",
|
30 |
+
"17": "joy",
|
31 |
+
"18": "love",
|
32 |
+
"19": "nervousness",
|
33 |
+
"20": "optimism",
|
34 |
+
"21": "pride",
|
35 |
+
"22": "realization",
|
36 |
+
"23": "relief",
|
37 |
+
"24": "remorse",
|
38 |
+
"25": "sadness",
|
39 |
+
"26": "surprise",
|
40 |
+
"27": "neutral"
|
41 |
+
},
|
42 |
+
"initializer_range": 0.02,
|
43 |
+
"intermediate_size": 3072,
|
44 |
+
"label2id": {
|
45 |
+
"admiration": 0,
|
46 |
+
"amusement": 1,
|
47 |
+
"anger": 2,
|
48 |
+
"annoyance": 3,
|
49 |
+
"approval": 4,
|
50 |
+
"caring": 5,
|
51 |
+
"confusion": 6,
|
52 |
+
"curiosity": 7,
|
53 |
+
"desire": 8,
|
54 |
+
"disappointment": 9,
|
55 |
+
"disapproval": 10,
|
56 |
+
"disgust": 11,
|
57 |
+
"embarrassment": 12,
|
58 |
+
"excitement": 13,
|
59 |
+
"fear": 14,
|
60 |
+
"gratitude": 15,
|
61 |
+
"grief": 16,
|
62 |
+
"joy": 17,
|
63 |
+
"love": 18,
|
64 |
+
"nervousness": 19,
|
65 |
+
"neutral": 27,
|
66 |
+
"optimism": 20,
|
67 |
+
"pride": 21,
|
68 |
+
"realization": 22,
|
69 |
+
"relief": 23,
|
70 |
+
"remorse": 24,
|
71 |
+
"sadness": 25,
|
72 |
+
"surprise": 26
|
73 |
+
},
|
74 |
+
"layer_norm_eps": 1e-05,
|
75 |
+
"max_position_embeddings": 514,
|
76 |
+
"model_type": "roberta",
|
77 |
+
"num_attention_heads": 12,
|
78 |
+
"num_hidden_layers": 12,
|
79 |
+
"pad_token_id": 1,
|
80 |
+
"type_vocab_size": 1,
|
81 |
+
"vocab_size": 50265
|
82 |
+
}
|
merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
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:d74be3d7830c42515c963e702f4f3ce883092d738645be9625725831d7bb81a1
|
3 |
+
size 501322656
|
tokenizer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"model_max_length": 512}
|
vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|