Views
No views yet
python -m pip install -U angle-emb1from angle_emb import AnglE
2
3angle = AnglE.from_pretrained('WhereIsAI/UAE-Large-V1', pooling_strategy='cls').cuda()
4vec = angle.encode('hello world', to_numpy=True)
5print(vec)
6vecs = angle.encode(['hello world1', 'hello world2'], to_numpy=True)
7print(vecs)Prompts.C.1from angle_emb import AnglE, Prompts
2
3angle = AnglE.from_pretrained('WhereIsAI/UAE-Large-V1', pooling_strategy='cls').cuda()
4angle.set_prompt(prompt=Prompts.C)
5vec = angle.encode({'text': 'hello world'}, to_numpy=True)
6print(vec)
7vecs = angle.encode([{'text': 'hello world1'}, {'text': 'hello world2'}], to_numpy=True)
8print(vecs)@article{li2023angle,
title={AnglE-optimized Text Embeddings},
author={Li, Xianming and Li, Jing},
journal={arXiv preprint arXiv:2309.12871},
year={2023}
}