ophelielacroix
commited on
Commit
•
19fdf61
1
Parent(s):
8d09d29
initial commit
Browse files- README.md +43 -0
- config.json +41 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- tf_model.h5 +3 -0
- tokenizer_config.json +1 -0
- vocab.txt +0 -0
README.md
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- da
|
4 |
+
tags:
|
5 |
+
- bert
|
6 |
+
- pytorch
|
7 |
+
- hatespeech
|
8 |
+
license: cc-by-sa-4.0
|
9 |
+
datasets:
|
10 |
+
- social media
|
11 |
+
metrics:
|
12 |
+
- f1
|
13 |
+
widget:
|
14 |
+
- text: "Senile gamle idiot"
|
15 |
+
---
|
16 |
+
|
17 |
+
# Danish BERT for hate speech classification
|
18 |
+
|
19 |
+
The BERT HateSpeech model classifies offensive Danish text into 4 categories:
|
20 |
+
* `Særlig opmærksomhed` (special attention, e.g. threat)
|
21 |
+
* `Personangreb` (personal attack)
|
22 |
+
* `Sprogbrug` (offensive language)
|
23 |
+
* `Spam & indhold` (spam)
|
24 |
+
This model is intended to be used after the [BERT HateSpeech detection model](https://huggingface.co/DaNLP/da-bert-hatespeech-detection).
|
25 |
+
|
26 |
+
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.
|
27 |
+
|
28 |
+
See the [DaNLP documentation](https://danlp-alexandra.readthedocs.io/en/latest/docs/tasks/hatespeech.html#bertdr) for more details.
|
29 |
+
|
30 |
+
|
31 |
+
Here is how to use the model:
|
32 |
+
|
33 |
+
```python
|
34 |
+
from transformers import BertTokenizer, BertForSequenceClassification
|
35 |
+
|
36 |
+
model = BertForSequenceClassification.from_pretrained("DaNLP/da-bert-hatespeech-classification")
|
37 |
+
tokenizer = BertTokenizer.from_pretrained("DaNLP/da-bert-hatespeech-classification")
|
38 |
+
```
|
39 |
+
|
40 |
+
## Training data
|
41 |
+
|
42 |
+
The data used for training has not been made publicly available. It consists of social media data manually annotated in collaboration with Danmarks Radio.
|
43 |
+
|
config.json
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": ".",
|
3 |
+
"architectures": [
|
4 |
+
"BertForSequenceClassification"
|
5 |
+
],
|
6 |
+
"attention_probs_dropout_prob": 0.1,
|
7 |
+
"directionality": "bidi",
|
8 |
+
"gradient_checkpointing": false,
|
9 |
+
"hidden_act": "gelu",
|
10 |
+
"hidden_dropout_prob": 0.1,
|
11 |
+
"hidden_size": 768,
|
12 |
+
"id2label": {
|
13 |
+
"0": "S\u00e6rlig opm\u00e6rksomhed",
|
14 |
+
"1": "Personangreb",
|
15 |
+
"2": "Sprogbrug",
|
16 |
+
"3": "Spam & indhold"
|
17 |
+
},
|
18 |
+
"initializer_range": 0.02,
|
19 |
+
"intermediate_size": 3072,
|
20 |
+
"label2id": {
|
21 |
+
"Personangreb": 1,
|
22 |
+
"Spam & indhold": 3,
|
23 |
+
"Sprogbrug": 2,
|
24 |
+
"S\u00e6rlig opm\u00e6rksomhed": 0
|
25 |
+
},
|
26 |
+
"layer_norm_eps": 1e-12,
|
27 |
+
"max_position_embeddings": 512,
|
28 |
+
"model_type": "bert",
|
29 |
+
"num_attention_heads": 12,
|
30 |
+
"num_hidden_layers": 12,
|
31 |
+
"pad_token_id": 0,
|
32 |
+
"pooler_fc_size": 768,
|
33 |
+
"pooler_num_attention_heads": 12,
|
34 |
+
"pooler_num_fc_layers": 3,
|
35 |
+
"pooler_size_per_head": 128,
|
36 |
+
"pooler_type": "first_token_transform",
|
37 |
+
"position_embedding_type": "absolute",
|
38 |
+
"transformers_version": "4.5.0",
|
39 |
+
"type_vocab_size": 2,
|
40 |
+
"vocab_size": 32000
|
41 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4be6d9c4d55163a755e7c98c0498423b311f38d78a80bbfda600a31680c7e044
|
3 |
+
size 442568201
|
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:7d6882a73fbb569b938ac3896050b7679a00158bc01984cd7d7b67ce7e1024fe
|
3 |
+
size 442752368
|
tokenizer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"do_lower_case": true, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": false, "model_max_length": 512, "special_tokens_map_file": null, "name_or_path": "Maltehb/danish-bert-botxo", "do_basic_tokenize": true, "never_split": null}
|
vocab.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|