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