Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,86 @@
|
|
1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
license: mit
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
datasets:
|
3 |
+
- glue
|
4 |
+
model-index:
|
5 |
+
- name: e5-large-v2-mnli
|
6 |
+
results: []
|
7 |
+
pipeline_tag: zero-shot-classification
|
8 |
+
language:
|
9 |
+
- en
|
10 |
license: mit
|
11 |
---
|
12 |
+
|
13 |
+
# e5-large-v2-mnli
|
14 |
+
|
15 |
+
This model is a fine-tuned version of [intfloat/e5-large-v2](https://huggingface.co/intfloat/e5-large-v2) on the glue dataset.
|
16 |
+
|
17 |
+
## Model description
|
18 |
+
|
19 |
+
[Text Embeddings by Weakly-Supervised Contrastive Pre-training](https://arxiv.org/pdf/2212.03533.pdf).
|
20 |
+
Liang Wang, Nan Yang, Xiaolong Huang, Binxing Jiao, Linjun Yang, Daxin Jiang, Rangan Majumder, Furu Wei, arXiv 2022
|
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/e5-large-v2-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', 'dancing', 'cooking'],
|
40 |
+
# 'scores': [0.7971774339675903, 0.12801812589168549, 0.07480447739362717]}
|
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': ['travel', 'exploration', 'dancing', 'cooking'],
|
50 |
+
# 'scores': [0.8738091588020325,
|
51 |
+
# 0.8598912954330444,
|
52 |
+
# 0.12812669575214386,
|
53 |
+
# 0.01454145833849907]}
|
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 |
+
|[e5-base-mnli](https://huggingface.co/mjwong/e5-base-mnli)|0.840|0.839|0.231|0.285|0.309|
|
62 |
+
|[e5-base-v2-mnli](https://huggingface.co/mjwong/e5-base-v2-mnli)|0.844|0.838|0.253|0.288|0.301|
|
63 |
+
|[e5-large-mnli](https://huggingface.co/mjwong/e5-large-mnli)|0.868|0.869|0.301|0.296|0.294|
|
64 |
+
|[e5-large-v2-mnli](https://huggingface.co/mjwong/e5-large-v2-mnli)|0.875|0.876|0.354|0.298|0.313|
|
65 |
+
|[e5-large-unsupervised-mnli](https://huggingface.co/mjwong/e5-large-unsupervised-mnli)|0.865|0.867|0.314|0.285|0.303|
|
66 |
+
|[e5-large-mnli-anli](https://huggingface.co/mjwong/e5-large-mnli-anli)|0.843|0.848|0.646|0.484|0.458|
|
67 |
+
|[e5-large-unsupervised-mnli-anli](https://huggingface.co/mjwong/e5-large-unsupervised-mnli-anli)|0.836|0.842|0.634|0.481|0.478|
|
68 |
+
|
69 |
+
### Training hyperparameters
|
70 |
+
|
71 |
+
The following hyperparameters were used during training:
|
72 |
+
|
73 |
+
- learning_rate: 2e-05
|
74 |
+
- train_batch_size: 16
|
75 |
+
- eval_batch_size: 16
|
76 |
+
- seed: 42
|
77 |
+
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
78 |
+
- lr_scheduler_type: linear
|
79 |
+
- lr_scheduler_warmup_ratio: 0.1
|
80 |
+
- num_epochs: 2
|
81 |
+
|
82 |
+
### Framework versions
|
83 |
+
- Transformers 4.28.1
|
84 |
+
- Pytorch 1.12.1+cu116
|
85 |
+
- Datasets 2.11.0
|
86 |
+
- Tokenizers 0.12.1
|