HuggingFace镜像/UAE-Large-V1
模型介绍文件和版本分析
下载使用量0

通用 AnglE 嵌入

📢 WhereIsAI/UAE-Large-V1 遵循MIT许可证。在任何场景下均可自由使用。 如果您在学术论文中使用,可以通过 👉 引用信息 引用我们。

🤝 关注我们:

  • GitHub:https://github.com/SeanLee97/AnglE。
  • 预印本论文:AnglE优化的文本嵌入
  • 会议论文:AoE:面向语义文本相似度的Angle优化嵌入 (ACL24)
  • 📘 文档:https://angle.readthedocs.io/en/latest/index.html

欢迎使用AnglE进行句子嵌入的训练和推理。

🏆 成就

  • 📅 2024年5月16日 | AnglE的论文被ACL 2024主会议接受
  • 📅 2024年12月4日 | 🔥 我们通用的英语句子嵌入 WhereIsAI/UAE-Large-V1 在MTEB排行榜上取得最先进性能,平均得分为64.64!

image/jpeg

🧑‍🤝‍🧑 兄弟版本:

  • WhereIsAI/UAE-Code-Large-V1:此模型可用于代码或GitHub问题相似度测量。

使用方法

1. angle_emb


```bash
python -m pip install -U angle-emb

非检索任务

无需指定任何提示。

from angle_emb import AnglE
from angle_emb.utils import cosine_similarity

angle = AnglE.from_pretrained('WhereIsAI/UAE-Large-V1', pooling_strategy='cls').cuda()
doc_vecs = angle.encode([
    'The weather is great!',
    'The weather is very good!',
    'i am going to bed'
], normalize_embedding=True)

for i, dv1 in enumerate(doc_vecs):
    for dv2 in doc_vecs[i+1:]:
        print(cosine_similarity(dv1, dv2))
  1. 检索任务

为了检索目的,请在查询时使用提示 Prompts.C(不用于文档)。

from angle_emb import AnglE, Prompts
from angle_emb.utils import cosine_similarity

angle = AnglE.from_pretrained('WhereIsAI/UAE-Large-V1', pooling_strategy='cls').cuda()
qv = angle.encode(Prompts.C.format(text='what is the weather?'))
doc_vecs = angle.encode([
    'The weather is great!',
    'it is rainy today.',
    'i am going to bed'
])

for dv in doc_vecs:
    print(cosine_similarity(qv[0], dv))

2. 句子转换器

from angle_emb import Prompts
from sentence_transformers import SentenceTransformer

model = SentenceTransformer("WhereIsAI/UAE-Large-V1").cuda()

qv = model.encode(Prompts.C.format(text='what is the weather?'))
doc_vecs = model.encode([
    'The weather is great!',
    'it is rainy today.',
    'i am going to bed'
])

for dv in doc_vecs:
    print(1 - spatial.distance.cosine(qv, dv))

3. 无穷大

无穷大 是一个遵循 MIT 许可的、适用于 OpenAI 兼容部署的服务器。

docker run --gpus all -v $PWD/data:/app/.cache -p "7997":"7997" \
michaelf34/infinity:latest \
v2 --model-id WhereIsAI/UAE-Large-V1 --revision "369c368f70f16a613f19f5598d4f12d9f44235d4" --dtype float16 --batch-size 32 --device cuda --engine torch --port 7997

引用

如果您使用了我们的预训练模型,欢迎通过引用我们的工作来支持我们:

@article{li2023angle,
  title={AnglE-optimized Text Embeddings},
  author={Li, Xianming and Li, Jing},
  journal={arXiv preprint arXiv:2309.12871},
  year={2023}
}

当然可以,不过我需要您提供原始文本以便进行翻译。请提供您希望翻译成中文的英文文本内容。