Update README.md
Browse files
README.md
CHANGED
@@ -1,9 +1,74 @@
|
|
1 |
---
|
2 |
-
library_name:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
4 |
-
## Training procedure
|
5 |
|
6 |
-
### Framework versions
|
7 |
|
|
|
8 |
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
library_name: transformers
|
3 |
+
license: mit
|
4 |
+
datasets:
|
5 |
+
- shibing624/nli-zh-all
|
6 |
+
- shibing624/nli_zh
|
7 |
+
language:
|
8 |
+
- en
|
9 |
+
metrics:
|
10 |
+
- spearmanr
|
11 |
---
|
|
|
12 |
|
|
|
13 |
|
14 |
+
# AnglE📐: Angle-optimized Text Embeddings
|
15 |
|
16 |
+
> It is Angle 📐, not Angel 👼.
|
17 |
+
|
18 |
+
🔥 A New SOTA Model for Semantic Textual Similarity!
|
19 |
+
|
20 |
+
Github: https://github.com/SeanLee97/AnglE
|
21 |
+
|
22 |
+
<a href="https://arxiv.org/abs/2309.12871">
|
23 |
+
<img src="https://img.shields.io/badge/Arxiv-2306.06843-yellow.svg?style=flat-square" alt="https://arxiv.org/abs/2309.12871" />
|
24 |
+
</a>
|
25 |
+
|
26 |
+
[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/angle-optimized-text-embeddings/semantic-textual-similarity-on-sick-r-1)](https://paperswithcode.com/sota/semantic-textual-similarity-on-sick-r-1?p=angle-optimized-text-embeddings)
|
27 |
+
[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/angle-optimized-text-embeddings/semantic-textual-similarity-on-sts16)](https://paperswithcode.com/sota/semantic-textual-similarity-on-sts16?p=angle-optimized-text-embeddings)
|
28 |
+
[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/angle-optimized-text-embeddings/semantic-textual-similarity-on-sts15)](https://paperswithcode.com/sota/semantic-textual-similarity-on-sts15?p=angle-optimized-text-embeddings)
|
29 |
+
[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/angle-optimized-text-embeddings/semantic-textual-similarity-on-sts14)](https://paperswithcode.com/sota/semantic-textual-similarity-on-sts14?p=angle-optimized-text-embeddings)
|
30 |
+
[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/angle-optimized-text-embeddings/semantic-textual-similarity-on-sts13)](https://paperswithcode.com/sota/semantic-textual-similarity-on-sts13?p=angle-optimized-text-embeddings)
|
31 |
+
[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/angle-optimized-text-embeddings/semantic-textual-similarity-on-sts12)](https://paperswithcode.com/sota/semantic-textual-similarity-on-sts12?p=angle-optimized-text-embeddings)
|
32 |
+
[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/angle-optimized-text-embeddings/semantic-textual-similarity-on-sts-benchmark)](https://paperswithcode.com/sota/semantic-textual-similarity-on-sts-benchmark?p=angle-optimized-text-embeddings)
|
33 |
+
|
34 |
+
|
35 |
+
**STS Results**
|
36 |
+
|
37 |
+
|
38 |
+
| Model | ATEC | BQ | LCQMC | PAWSX | STS-B | SOHU-dd | SOHU-dc | Avg. |
|
39 |
+
| ------- |-------|-------|-------|-------|-------|--------------|-----------------|-------|
|
40 |
+
| ^[shibing624/text2vec-bge-large-chinese](https://huggingface.co/shibing624/text2vec-bge-large-chinese) | 38.41 | 61.34 | 71.72 | 35.15 | 76.44 | 71.81 | 63.15 | 59.72 |
|
41 |
+
| ^[shibing624/text2vec-base-chinese-paraphrase](https://huggingface.co/shibing624/text2vec-base-chinese-paraphrase) | 44.89 | 63.58 | 74.24 | 40.90 | 78.93 | 76.70 | 63.30 | 63.08 |
|
42 |
+
| [SeanLee97/angle-roberta-wwm-base-zhnli-v1](https://huggingface.co/SeanLee97/angle-roberta-wwm-base-zhnli-v1) | 49.49 | 72.47 | 78.33 | 59.13 | 77.14 | 72.36 | 60.53 | **67.06** |
|
43 |
+
| [SeanLee97/angle-llama-7b-zhnli-v1](https://huggingface.co/SeanLee97/angle-llama-7b-zhnli-v1) | 50.44 | 71.95 | 78.90 | 56.57 | 81.11 | 68.11 | 52.02 | 65.59 |
|
44 |
+
|
45 |
+
^ denotes baselines, their results are retrieved from https://github.com/shibing624/text2vec
|
46 |
+
|
47 |
+
## Usage
|
48 |
+
|
49 |
+
```python
|
50 |
+
from angle_emb import AnglE, Prompts
|
51 |
+
|
52 |
+
angle = AnglE.from_pretrained('NousResearch/Llama-2-7b-hf', pretrained_lora_path='SeanLee97/angle-llama-7b-zhnli-v1')
|
53 |
+
# 请选择对应的 prompt,此模型对应 Prompts.B
|
54 |
+
print('All predefined prompts:', Prompts.list_prompts())
|
55 |
+
angle.set_prompt(prompt=Prompts.B)
|
56 |
+
print('prompt:', angle.prompt)
|
57 |
+
vec = angle.encode({'text': '你好世界'}, to_numpy=True)
|
58 |
+
print(vec)
|
59 |
+
vecs = angle.encode([{'text': '你好世界1'}, {'text': '你好世界2'}], to_numpy=True)
|
60 |
+
print(vecs)
|
61 |
+
```
|
62 |
+
|
63 |
+
## Citation
|
64 |
+
|
65 |
+
You are welcome to use our code and pre-trained models. If you use our code and pre-trained models, please support us by citing our work as follows:
|
66 |
+
|
67 |
+
```bibtex
|
68 |
+
@article{li2023angle,
|
69 |
+
title={AnglE-Optimized Text Embeddings},
|
70 |
+
author={Li, Xianming and Li, Jing},
|
71 |
+
journal={arXiv preprint arXiv:2309.12871},
|
72 |
+
year={2023}
|
73 |
+
}
|
74 |
+
```
|