mjwong commited on
Commit
9541224
1 Parent(s): 37af080

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +97 -0
README.md CHANGED
@@ -1,3 +1,100 @@
1
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: mit
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ datasets:
3
+ - xnli
4
+ model-index:
5
+ - name: multilingual-e5-base-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-base-xnli
31
+
32
+ This model is a fine-tuned version of [intfloat/multilingual-e5-base](https://huggingface.co/intfloat/multilingual-e5-base) 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-base-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': ['environment', 'entertainment', 'economy', 'politics'],
57
+ # 'scores': [0.32117515802383423,
58
+ # 0.29328057169914246,
59
+ # 0.27646392583847046,
60
+ # 0.10908035188913345]}
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': ['economy', 'politics', 'environment', 'entertainment'],
70
+ # 'scores': [0.7499949932098389,
71
+ # 0.710322380065918,
72
+ # 0.5980390310287476,
73
+ # 0.5272448658943176]}
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.835|0.758|0.792|0.788|0.788|0.803|0.795|0.773|0.719|0.754|0.757|0.696|0.779|0.778|
82
+
83
+ ### Training hyperparameters
84
+
85
+ The following hyperparameters were used during training:
86
+
87
+ - learning_rate: 2e-05
88
+ - train_batch_size: 16
89
+ - eval_batch_size: 16
90
+ - seed: 42
91
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
92
+ - lr_scheduler_type: linear
93
+ - lr_scheduler_warmup_ratio: 0.1
94
+ - num_epochs: 2
95
+ -
96
+ ### Framework versions
97
+ - Transformers 4.28.1
98
+ - Pytorch 1.12.1+cu116
99
+ - Datasets 2.11.0
100
+ - Tokenizers 0.12.1