mjwong commited on
Commit
c587836
1 Parent(s): 874d1e3

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: mcontriever-msmarco-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
+ # mcontriever-msmarco-xnli
31
+
32
+ This model is a fine-tuned version of [facebook/mcontriever-msmarco](https://huggingface.co/facebook/mcontriever-msmarco) on the XNLI dataset.
33
+
34
+ ## Model description
35
+
36
+ [Unsupervised Dense Information Retrieval with Contrastive Learning](https://arxiv.org/abs/2112.09118).
37
+ Gautier Izacard, Mathilde Caron, Lucas Hosseini, Sebastian Riedel, Piotr Bojanowski, Armand Joulin, Edouard Grave, arXiv 2021
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/mcontriever-msmarco-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', 'environment', 'entertainment'],
57
+ # 'scores': [0.4656517505645752,
58
+ # 0.20842939615249634,
59
+ # 0.1871575266122818,
60
+ # 0.13876137137413025]}
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', 'environment', 'entertainment'],
70
+ # 'scores': [0.7586008906364441,
71
+ # 0.3599490225315094,
72
+ # 0.3004348874092102,
73
+ # 0.1562490165233612]}
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
+ |[mcontriever-xnli](https://huggingface.co/mjwong/mcontriever-xnli)|0.820|0.733|0.773|0.774|0.748|0.788|0.781|0.755|0.690|0.690|0.741|0.647|0.766|0.767|
82
+ |[mcontriever-msmarco-xnli](https://huggingface.co/mjwong/mcontriever-msmarco-xnli)|0.822|0.731|0.763|0.775|0.752|0.785|0.778|0.749|0.694|0.682|0.738|0.641|0.759|0.768|
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: 2
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