morit commited on
Commit
e8a7410
·
1 Parent(s): 87135cf

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +63 -0
README.md CHANGED
@@ -1,3 +1,66 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ datasets:
4
+ - xnli
5
+ language:
6
+ - es
7
+ metrics:
8
+ - accuracy
9
+ pipeline_tag: zero-shot-classification
10
  ---
11
+
12
+ # XLM-ROBERTA-BASE-XNLI_FR
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 french 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 spanish as it was finetuned on data in saild languages. 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/spanish_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
+ sequence_to_classify = "Je pense que Marcon va gagner les elections?"
34
+
35
+
36
+ # we can specify candidate labels and hypothesis:
37
+ candidate_labels = ["politique", "sport"]
38
+ hypothesis_template = "Cet example est {}"
39
+
40
+ # classify using the information provided
41
+ classifier(sequence_to_classify, candidate_labels, hypothesis_template=hypothesis_template)
42
+
43
+
44
+ # Output
45
+ #{'sequence': 'Je pense que Marcon va gagner les elections?',
46
+ #'labels': ['politique', 'sport'],
47
+ #'scores': [0.8195879459381104, 0.18041200935840607]}
48
+
49
+ ```
50
+
51
+
52
+ ## Training
53
+ 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 french which is a machine translated version of the MNLI dataset. It was trained on 3 epochs and the following specifications
54
+ - learning rate: 5e-5
55
+ - batch size: 32
56
+ - max sequence: length 128
57
+
58
+ on one GPU (NVIDIA GeForce RTX 3090) resulting in a training time of 1h 47 mins.
59
+
60
+
61
+ ## Evaluation
62
+ 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.
63
+ Using the test set the model reached an accuracy of
64
+ ```
65
+ predict_accuracy = 77.72 %
66
+ ```