morit commited on
Commit
f55564c
·
1 Parent(s): ee360b0

add model card

Browse files
Files changed (1) hide show
  1. README.md +62 -0
README.md CHANGED
@@ -1,3 +1,65 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ datasets:
4
+ - xnli
5
+ language:
6
+ - en
7
+ metrics:
8
+ - accuracy
9
+ pipeline_tag: zero-shot-classification
10
  ---
11
+
12
+ # XLM-ROBERTA-BASE-XNLI-DE
13
+
14
+ ## Model description
15
+ This model takes the XLM-Roberta-base model which has been continued to pre-traine on a large corpus of Twitter in multiple languages.
16
+ It was developed following a similar strategy as introduced as part of the [Tweet Eval](https://github.com/cardiffnlp/tweeteval) framework.
17
+ The model is further finetuned on the german part of the XNLI training dataset.
18
+
19
+ ## Intended Usage
20
+
21
+ This model was developed to do Zero-Shot Text Classification in the realm of Hate Speech Detection. It is focused on the language of german as it was finetuned on data in said language. Since the base model was pre-trained on 100 different languages it has shown some effectiveness in other languages. Please refer to the list of languages in the [XLM Roberta paper](https://arxiv.org/abs/1911.02116)
22
+
23
+ ### Usage with Zero-Shot Classification pipeline
24
+ ```python
25
+ from transformers import pipeline
26
+ classifier = pipeline("zero-shot-classification",
27
+ model="morit/german_xlm_xnli")
28
+ ```
29
+
30
+ After loading the model you can classify sequences in the languages mentioned above. You can specify your sequences and a matching hypothesis to be able to classify your proposed candidate labels.
31
+
32
+ ```python
33
+ equence_to_classify = "Ich glaube Olaf Scholz wird sich im Bundestag durchsetzen."
34
+
35
+
36
+ # we can specify candidate labels and hypothesis:
37
+ candidate_labels = ["Politik", "Sport"]
38
+ hypothesis_template = "Dieses Beispiel ist {}"
39
+
40
+ # classify using the information provided
41
+ classifier(sequence_to_classify, candidate_labels, hypothesis_template=hypothesis_template)
42
+
43
+
44
+ # Output
45
+ # {'sequence': 'Ich glaube Olaf Scholz wird sich im Bundestag durchsetzen.',
46
+ # 'labels': ['Politik', 'Sport'],
47
+ # 'scores': [0.6338292956352234, 0.3661706745624542]}
48
+ ```
49
+
50
+
51
+ ## Training
52
+ This model was pre-trained on a set of 100 languages and follwed further training on 198M multilingual tweets as described in the original [paper](https://arxiv.org/abs/2104.12250). Further it was trained on the training set of XNLI dataset in german which is a machine translated version of the MNLI dataset. It was trained on 3 epochs and the following specifications
53
+ - learning rate: 5e-5
54
+ - batch size: 32
55
+ - max sequence: length 128
56
+
57
+ on one GPU (NVIDIA GeForce RTX 3090) resulting in a training time of 1h 47 mins.
58
+
59
+
60
+ ## Evaluation
61
+ The model was evaluated after each epoch on the eval set of the XNLI Corpus and at the end of training on the Test set of the XNLI corpus.
62
+ Using the test set the model reached an accuracy of
63
+ ```
64
+ predict_accuracy = 76.81 %
65
+ ```