larskjeldgaard commited on
Commit
c18f31b
1 Parent(s): 2b0422e

first release

Browse files
README.md ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: da
3
+ tags:
4
+ - danish
5
+ - bert
6
+ - sentiment
7
+ - analytical
8
+ license: cc-by-4.0
9
+ widget:
10
+ - text: "Jeg synes, det er en elendig film"
11
+ ---
12
+ # Danish BERT fine-tuned for Detecting 'Analytical'
13
+
14
+ This model detects if a Danish text is 'subjective' or 'objective'.
15
+
16
+ It is trained and tested on Tweets and texts transcribed from the European Parliament annotated by [Alexandra Institute](https://github.com/alexandrainst). The model is trained with the [`senda`](https://github.com/ebanalyse/senda) package.
17
+
18
+ Here is an example of how to load the model in PyTorch using the [🤗Transformers](https://github.com/huggingface/transformers) library:
19
+
20
+ ```python
21
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
22
+ tokenizer = AutoTokenizer.from_pretrained("pin/analytical")
23
+ model = AutoModelForSequenceClassification.from_pretrained("pin/analytical")
24
+
25
+ # create 'senda' sentiment analysis pipeline
26
+ analytical_pipeline = pipeline('sentiment-analysis', model=model, tokenizer=tokenizer)
27
+
28
+ text = "Jeg synes, det er en elendig film"
29
+ # in English: 'I think, it is a terrible movie'
30
+ analytical_pipeline(text)
31
+ ```
32
+
33
+ ## Performance
34
+ The `senda` model achieves an accuracy of 0.89 and a macro-averaged F1-score of 0.78 on a small test data set, that [Alexandra Institute](https://github.com/alexandrainst/danlp/blob/master/docs/docs/datasets.md#twitter-sentiment) provides. The model can most certainly be improved, and we encourage all NLP-enthusiasts to give it their best shot - you can use the [`senda`](https://github.com/ebanalyse/senda) package to do this.
35
+
36
+ #### Contact
37
+ Feel free to contact author Lars Kjeldgaard on [lars.kjeldgaard@eb.dk](mailto:lars.kjeldgaard@eb.dk).
38
+
39
+
config.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "./results/checkpoint-500",
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": "subjektivt",
14
+ "1": "objektivt"
15
+ },
16
+ "initializer_range": 0.02,
17
+ "intermediate_size": 3072,
18
+ "label2id": {
19
+ "objektivt": 1,
20
+ "subjektivt": 0
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.1",
35
+ "type_vocab_size": 2,
36
+ "use_cache": true,
37
+ "vocab_size": 32000
38
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:84ac824c7517d24ed4d3876ff5f8eb6ea05665fb393731ebd74b93325e254e77
3
+ size 442563297
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
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": null, "special_tokens_map_file": null, "name_or_path": "Maltehb/danish-bert-botxo", "do_basic_tokenize": true, "never_split": null}
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ec4c661f53a945e42c1dc4229d640ebe9d1c36b27566854d419a6100054d3623
3
+ size 2351
vocab.txt ADDED
The diff for this file is too large to render. See raw diff