mjwong commited on
Commit
827a342
1 Parent(s): 3e61839

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +78 -0
README.md CHANGED
@@ -1,3 +1,81 @@
1
  ---
 
 
 
 
 
 
 
 
2
  license: mit
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ datasets:
3
+ - glue
4
+ model-index:
5
+ - name: contriever-mnli
6
+ results: []
7
+ pipeline_tag: zero-shot-classification
8
+ language:
9
+ - en
10
  license: mit
11
  ---
12
+
13
+ # contriever-mnli
14
+
15
+ This model is a fine-tuned version of [facebook/contriever](https://huggingface.co/facebook/contriever) on the glue dataset.
16
+
17
+ ## Model description
18
+
19
+ [Unsupervised Dense Information Retrieval with Contrastive Learning](https://arxiv.org/abs/2112.09118).
20
+ Gautier Izacard, Mathilde Caron, Lucas Hosseini, Sebastian Riedel, Piotr Bojanowski, Armand Joulin, Edouard Grave, arXiv 2021
21
+
22
+ ## How to use the model
23
+
24
+ The model can be loaded with the `zero-shot-classification` pipeline like so:
25
+
26
+ ```python
27
+ from transformers import pipeline
28
+ classifier = pipeline("zero-shot-classification",
29
+ model="mjwong/contriever-mnli")
30
+ ```
31
+
32
+ You can then use this pipeline to classify sequences into any of the class names you specify.
33
+
34
+ ```python
35
+ sequence_to_classify = "one day I will see the world"
36
+ candidate_labels = ['travel', 'cooking', 'dancing']
37
+ classifier(sequence_to_classify, candidate_labels)
38
+ #{'sequence': 'one day I will see the world',
39
+ # 'labels': ['travel', 'cooking', 'dancing'],
40
+ # 'scores': [0.7728410363197327, 0.13207288086414337, 0.09508601576089859]}
41
+ ```
42
+
43
+ If more than one candidate label can be correct, pass `multi_class=True` to calculate each class independently:
44
+
45
+ ```python
46
+ candidate_labels = ['travel', 'cooking', 'dancing', 'exploration']
47
+ classifier(sequence_to_classify, candidate_labels, multi_class=True)
48
+ #{'sequence': 'one day I will see the world',
49
+ # 'labels': ['exploration', 'travel', 'cooking', 'dancing'],
50
+ # 'scores': [0.9920766353607178,
51
+ # 0.7247188091278076,
52
+ # 0.08411424607038498,
53
+ 3 0.03875880688428879]}
54
+ ```
55
+
56
+ ### Eval results
57
+ The model was evaluated using the dev sets for MultiNLI and test sets for ANLI. The metric used is accuracy.
58
+
59
+ |Datasets|mnli_dev_m|mnli_dev_mm|anli_test_r1|anli_test_r2|anli_test_r3|
60
+ | :---: | :---: | :---: | :---: | :---: | :---: |
61
+ |[contriever-mnli](https://huggingface.co/mjwong/contriever-mnli)|0.821|0.822|0.247|0.281|0.312|
62
+ |[contriever-msmarco-mnli](https://huggingface.co/mjwong/contriever-msmarco-mnli)|0.820|0.819|0.244|0.296|0.306|
63
+
64
+ ### Training hyperparameters
65
+
66
+ The following hyperparameters were used during training:
67
+
68
+ - learning_rate: 2e-05
69
+ - train_batch_size: 16
70
+ - eval_batch_size: 16
71
+ - seed: 42
72
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
73
+ - lr_scheduler_type: linear
74
+ - lr_scheduler_warmup_ratio: 0.1
75
+ - num_epochs: 5
76
+
77
+ ### Framework versions
78
+ - Transformers 4.28.1
79
+ - Pytorch 1.12.1+cu116
80
+ - Datasets 2.11.0
81
+ - Tokenizers 0.12.1