ophelielacroix
commited on
Commit
•
d25b552
1
Parent(s):
c561b98
First version of the da-bert-emotion-classification model and tokenizer
Browse files- README.md +47 -0
- added_tokens.json +1 -0
- config.json +49 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- tf_model.h5 +3 -0
- tokenizer_config.json +1 -0
- training_args.bin +3 -0
- vocab.txt +0 -0
README.md
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- da
|
4 |
+
tags:
|
5 |
+
- bert
|
6 |
+
- pytorch
|
7 |
+
- emotion
|
8 |
+
license: CC-BY_4.0
|
9 |
+
datasets:
|
10 |
+
- social media
|
11 |
+
metrics:
|
12 |
+
- f1
|
13 |
+
widget:
|
14 |
+
- text: "Jeg ejer en rød bil og det er en god bil."
|
15 |
+
---
|
16 |
+
|
17 |
+
# Danish BERT for emotion classification
|
18 |
+
|
19 |
+
The BERT Emotion model classifies a Danish text in one of the following class:
|
20 |
+
* Glæde/Sindsro
|
21 |
+
* Tillid/Accept
|
22 |
+
* Forventning/Interrese
|
23 |
+
* Overasket/Målløs
|
24 |
+
* Vrede/Irritation
|
25 |
+
* Foragt/Modvilje
|
26 |
+
* Sorg/trist
|
27 |
+
* Frygt/Bekymret
|
28 |
+
|
29 |
+
It is based on the pretrained [Danish BERT](https://github.com/certainlyio/nordic_bert) model by BotXO which has been fine-tuned on social media data.
|
30 |
+
|
31 |
+
This model should be used after detecting whether the text contains emotion or not, using the binary [BERT Emotion model](https://huggingface.co/DaNLP/da-bert-emotion-binary).
|
32 |
+
|
33 |
+
See the [DaNLP documentation](https://danlp-alexandra.readthedocs.io/en/latest/docs/tasks/sentiment_analysis.html#bert-emotion) for more details.
|
34 |
+
|
35 |
+
Here is how to use the model:
|
36 |
+
|
37 |
+
```python
|
38 |
+
from transformers import BertTokenizer, BertForSequenceClassification
|
39 |
+
|
40 |
+
model = BertForSequenceClassification.from_pretrained("DaNLP/da-bert-emotion-classification")
|
41 |
+
tokenizer = BertTokenizer.from_pretrained("DaNLP/da-bert-emotion-classification")
|
42 |
+
```
|
43 |
+
|
44 |
+
## Training data
|
45 |
+
|
46 |
+
The data used for training has not been made publicly available. It consists of social media data manually annotated in collaboration with Danmarks Radio.
|
47 |
+
|
added_tokens.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{}
|
config.json
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": ".",
|
3 |
+
"architectures": [
|
4 |
+
"BertForSequenceClassification"
|
5 |
+
],
|
6 |
+
"attention_probs_dropout_prob": 0.1,
|
7 |
+
"directionality": "bidi",
|
8 |
+
"finetuning_task": "emo",
|
9 |
+
"gradient_checkpointing": false,
|
10 |
+
"hidden_act": "gelu",
|
11 |
+
"hidden_dropout_prob": 0.1,
|
12 |
+
"hidden_size": 768,
|
13 |
+
"id2label": {
|
14 |
+
"0": "Gl\u00e6de/Sindsro",
|
15 |
+
"1": "Tillid/Accept",
|
16 |
+
"2": "Forventning/Interrese",
|
17 |
+
"3": "Overasket/M\u00e5ll\u00f8s",
|
18 |
+
"4": "Vrede/Irritation",
|
19 |
+
"5": "Foragt/Modvilje",
|
20 |
+
"6": "Sorg/trist",
|
21 |
+
"7": "Frygt/Bekymret"
|
22 |
+
},
|
23 |
+
"initializer_range": 0.02,
|
24 |
+
"intermediate_size": 3072,
|
25 |
+
"label2id": {
|
26 |
+
"Foragt/Modvilje": "5",
|
27 |
+
"Forventning/Interrese": "2",
|
28 |
+
"Frygt/Bekymret": "7",
|
29 |
+
"Gl\u00e6de/Sindsro": "0",
|
30 |
+
"Overasket/M\u00e5ll\u00f8s": "3",
|
31 |
+
"Sorg/trist": "6",
|
32 |
+
"Tillid/Accept": "1",
|
33 |
+
"Vrede/Irritation": "4"
|
34 |
+
},
|
35 |
+
"layer_norm_eps": 1e-12,
|
36 |
+
"max_position_embeddings": 512,
|
37 |
+
"model_type": "bert",
|
38 |
+
"num_attention_heads": 12,
|
39 |
+
"num_hidden_layers": 12,
|
40 |
+
"output_past": true,
|
41 |
+
"pad_token_id": 0,
|
42 |
+
"pooler_fc_size": 768,
|
43 |
+
"pooler_num_attention_heads": 12,
|
44 |
+
"pooler_num_fc_layers": 3,
|
45 |
+
"pooler_size_per_head": 128,
|
46 |
+
"pooler_type": "first_token_transform",
|
47 |
+
"type_vocab_size": 2,
|
48 |
+
"vocab_size": 32000
|
49 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1913b1dd404d8358e9b42444fb83339be802af550fa749a2cb82f73702941a8f
|
3 |
+
size 442580489
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
|
tf_model.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:473a893298f80a1f7573d57d4df6ae0f78128c8205fb10ab3c85ad5792293619
|
3 |
+
size 442764672
|
tokenizer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"do_lower_case": true, "init_inputs": []}
|
training_args.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8914ed596080bcc449b7e1ec71dc4cf483350fc108917ec2d757b826c72bdfcd
|
3 |
+
size 1257
|
vocab.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|