mjwong commited on
Commit
fde7023
1 Parent(s): b4de5f7

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +73 -0
README.md CHANGED
@@ -1,3 +1,76 @@
1
  ---
 
 
 
 
 
 
 
 
2
  license: mit
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ datasets:
3
+ - glue
4
+ model-index:
5
+ - name: e5-large-mnli
6
+ results: []
7
+ pipeline_tag: zero-shot-classification
8
+ language:
9
+ - en
10
  license: mit
11
  ---
12
+
13
+ <!-- This model card has been generated automatically according to the information the Trainer had access to. You
14
+ should probably proofread and complete it, then remove this comment. -->
15
+
16
+ # e5-large-mnli
17
+
18
+ This model is a fine-tuned version of [intfloat/e5-large](https://huggingface.co/intfloat/e5-large) on the glue dataset.
19
+
20
+ ## Model description
21
+
22
+ [Text Embeddings by Weakly-Supervised Contrastive Pre-training](https://arxiv.org/pdf/2212.03533.pdf).
23
+ Liang Wang, Nan Yang, Xiaolong Huang, Binxing Jiao, Linjun Yang, Daxin Jiang, Rangan Majumder, Furu Wei, arXiv 2022
24
+
25
+ ## How to use the model
26
+
27
+ The model can be loaded with the `zero-shot-classification` pipeline like so:
28
+
29
+ ```python
30
+ from transformers import pipeline
31
+ classifier = pipeline("zero-shot-classification",
32
+ model="mjwong/e5-large-mnli")
33
+ ```
34
+
35
+ You can then use this pipeline to classify sequences into any of the class names you specify.
36
+
37
+ ```python
38
+ sequence_to_classify = "one day I will see the world"
39
+ candidate_labels = ['travel', 'cooking', 'dancing']
40
+ classifier(sequence_to_classify, candidate_labels)
41
+ #{'sequence': 'one day I will see the world',
42
+ # 'labels': ['travel', 'dancing', 'cooking'],
43
+ # 'scores': [0.9494319558143616, 0.044598229229450226, 0.00596982054412365]}
44
+ ```
45
+
46
+ If more than one candidate label can be correct, pass `multi_class=True` to calculate each class independently:
47
+
48
+ ```python
49
+ candidate_labels = ['travel', 'cooking', 'dancing', 'exploration']
50
+ classifier(sequence_to_classify, candidate_labels, multi_class=True)
51
+ #{'sequence': 'one day I will see the world',
52
+ # 'labels': ['exploration', 'travel', 'dancing', 'cooking'],
53
+ # 'scores': [0.9918234944343567,
54
+ # 0.9867327213287354,
55
+ # 0.40335655212402344,
56
+ # 0.0020157278049737215]}
57
+ ```
58
+
59
+ ### Training hyperparameters
60
+
61
+ The following hyperparameters were used during training:
62
+
63
+ - learning_rate: 2e-05
64
+ - train_batch_size: 16
65
+ - eval_batch_size: 16
66
+ - seed: 42
67
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
68
+ - lr_scheduler_type: linear
69
+ - lr_scheduler_warmup_ratio: 0.1
70
+ - num_epochs: 2
71
+
72
+ ### Framework versions
73
+ - Transformers 4.28.1
74
+ - Pytorch 1.12.1+cu116
75
+ - Datasets 2.11.0
76
+ - Tokenizers 0.12.1