ophelielacroix
commited on
Commit
•
5d8d9f5
1
Parent(s):
30c675a
initial commit
Browse files- README.md +37 -0
- config.json +37 -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,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- da
|
4 |
+
tags:
|
5 |
+
- bert
|
6 |
+
- pytorch
|
7 |
+
- hatespeech
|
8 |
+
license: CC-BY_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 (offensive language) detection
|
18 |
+
|
19 |
+
The BERT HateSpeech model detects whether a Danish text is offensive or not.
|
20 |
+
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.
|
21 |
+
|
22 |
+
See the [DaNLP documentation](https://danlp-alexandra.readthedocs.io/en/latest/docs/tasks/hatespeech.html#bertdr) for more details.
|
23 |
+
|
24 |
+
|
25 |
+
Here is how to use the model:
|
26 |
+
|
27 |
+
```python
|
28 |
+
from transformers import BertTokenizer, BertForSequenceClassification
|
29 |
+
|
30 |
+
model = BertForSequenceClassification.from_pretrained("DaNLP/da-bert-hatespeech-detection")
|
31 |
+
tokenizer = BertTokenizer.from_pretrained("DaNLP/da-bert-hatespeech-detection")
|
32 |
+
```
|
33 |
+
|
34 |
+
## Training data
|
35 |
+
|
36 |
+
The data used for training has not been made publicly available. It consists of social media data manually annotated in collaboration with Danmarks Radio.
|
37 |
+
|
config.json
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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": "not offensive",
|
14 |
+
"1": "offensive"
|
15 |
+
},
|
16 |
+
"initializer_range": 0.02,
|
17 |
+
"intermediate_size": 3072,
|
18 |
+
"label2id": {
|
19 |
+
"not offensive": 0,
|
20 |
+
"offensive": 1
|
21 |
+
},
|
22 |
+
"layer_norm_eps": 1e-12,
|
23 |
+
"max_position_embeddings": 512,
|
24 |
+
"model_type": "bert",
|
25 |
+
"num_attention_heads": 12,
|
26 |
+
"num_hidden_layers": 12,
|
27 |
+
"pad_token_id": 0,
|
28 |
+
"pooler_fc_size": 768,
|
29 |
+
"pooler_num_attention_heads": 12,
|
30 |
+
"pooler_num_fc_layers": 3,
|
31 |
+
"pooler_size_per_head": 128,
|
32 |
+
"pooler_type": "first_token_transform",
|
33 |
+
"position_embedding_type": "absolute",
|
34 |
+
"transformers_version": "4.5.0",
|
35 |
+
"type_vocab_size": 2,
|
36 |
+
"vocab_size": 32000
|
37 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:44bee74323a0c63ed93a83250030b4d0af844d5332fe2ce896c7f6916a32d97f
|
3 |
+
size 442562910
|
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:9010a5fb24a059fb3cd011a244da783adcc79e3792685e938b63d880d06b480d
|
3 |
+
size 442746216
|
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
|
|