mjwong commited on
Commit
1c42c10
1 Parent(s): e5c2111

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +98 -0
README.md CHANGED
@@ -1,3 +1,101 @@
1
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: mit
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ datasets:
3
+ - xnli
4
+ model-index:
5
+ - name: multilingual-e5-large-xnli
6
+ results: []
7
+ pipeline_tag: zero-shot-classification
8
+ language:
9
+ - multilingual
10
+ - en
11
+ - ar
12
+ - bg
13
+ - de
14
+ - el
15
+ - es
16
+ - fr
17
+ - ru
18
+ - sw
19
+ - th
20
+ - tr
21
+ - ur
22
+ - vi
23
+ - zh
24
  license: mit
25
+ widget:
26
+ - text: "Angela Merkel ist eine Politikerin in Deutschland und Vorsitzende der CDU"
27
+ candidate_labels: "politics, economy, entertainment, environment"
28
  ---
29
+
30
+ # multilingual-e5-large-xnli
31
+
32
+ This model is a fine-tuned version of [intfloat/multilingual-e5-large](https://huggingface.co/intfloat/multilingual-e5-large) on the XNLI dataset.
33
+
34
+ ## Model description
35
+
36
+ [Text Embeddings by Weakly-Supervised Contrastive Pre-training](https://arxiv.org/pdf/2212.03533.pdf).
37
+ Liang Wang, Nan Yang, Xiaolong Huang, Binxing Jiao, Linjun Yang, Daxin Jiang, Rangan Majumder, Furu Wei, arXiv 2022
38
+
39
+ ## How to use the model
40
+
41
+ The model can be loaded with the `zero-shot-classification` pipeline like so:
42
+
43
+ ```python
44
+ from transformers import pipeline
45
+ classifier = pipeline("zero-shot-classification",
46
+ model="mjwong/multilingual-e5-large-xnli")
47
+ ```
48
+
49
+ You can then use this pipeline to classify sequences into any of the class names you specify.
50
+
51
+ ```python
52
+ sequence_to_classify = "Angela Merkel ist eine Politikerin in Deutschland und Vorsitzende der CDU"
53
+ candidate_labels = ["politics", "economy", "entertainment", "environment"]
54
+ classifier(sequence_to_classify, candidate_labels)
55
+ #{'sequence': 'Angela Merkel ist eine Politikerin in Deutschland und Vorsitzende der CDU',
56
+ # 'labels': ['politics', 'economy', 'entertainment', 'environment'],
57
+ # 'scores': [0.6869393587112427,
58
+ # 0.18112628161907196,
59
+ # 0.07022464275360107,
60
+ # 0.06170979142189026]}
61
+ ```
62
+
63
+ If more than one candidate label can be correct, pass `multi_class=True` to calculate each class independently:
64
+
65
+ ```python
66
+ candidate_labels = ["politics", "economy", "entertainment", "environment"]
67
+ classifier(sequence_to_classify, candidate_labels, multi_label=True)
68
+ #{'sequence': 'Angela Merkel ist eine Politikerin in Deutschland und Vorsitzende der CDU',
69
+ # 'labels': ['politics', 'economy', 'entertainment', 'environment'],
70
+ # 'scores': [0.9068101644515991,
71
+ # 0.2646591067314148,
72
+ # 0.00299322628416121,
73
+ # 0.0016029390972107649]}
74
+ ```
75
+
76
+ ### Eval results
77
+ The model was evaluated using the XNLI test sets on 14 languages: English (en), Arabic (ar), Bulgarian (bg), German (de), Greek (el), Spanish (es), French (fr), Russian (ru), Swahili (sw), Thai (th), Turkish (tr), Urdu (ur), Vietnam (vi) and Chinese (zh). The metric used is accuracy.
78
+
79
+ |Datasets|en|ar|bg|de|el|es|fr|ru|sw|th|tr|ur|vi|zh|
80
+ | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
81
+ |[multilingual-e5-base-xnli](https://huggingface.co/mjwong/multilingual-e5-base-xnli)|0.849|0.771|0.800|0.796|0.795|0.812|0.801|0.783|0.731|0.767|0.771|0.710|0.789|0.786|
82
+ |[multilingual-e5-large-xnli](https://huggingface.co/mjwong/multilingual-e5-large-xnli)|0.867|0.798|0.829|0.821|0.820|0.838|0.828|0.810|0.752|0.787|0.794|0.726|0.804|0.810|
83
+
84
+ ### Training hyperparameters
85
+
86
+ The following hyperparameters were used during training:
87
+
88
+ - learning_rate: 2e-05
89
+ - train_batch_size: 16
90
+ - eval_batch_size: 16
91
+ - seed: 42
92
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
93
+ - lr_scheduler_type: linear
94
+ - lr_scheduler_warmup_ratio: 0.1
95
+ - num_epochs: 1
96
+
97
+ ### Framework versions
98
+ - Transformers 4.28.1
99
+ - Pytorch 1.12.1+cu116
100
+ - Datasets 2.11.0
101
+ - Tokenizers 0.12.1