Feature Extraction
sentence-transformers
ONNX
Safetensors
OpenVINO
Transformers
Transformers.js
English
bert
mteb
sentence_embedding
feature_extraction
Eval Results (legacy)
text-embeddings-inference
Instructions to use WhereIsAI/UAE-Large-V1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use WhereIsAI/UAE-Large-V1 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("WhereIsAI/UAE-Large-V1") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Transformers
How to use WhereIsAI/UAE-Large-V1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="WhereIsAI/UAE-Large-V1")# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("WhereIsAI/UAE-Large-V1") model = AutoModel.from_pretrained("WhereIsAI/UAE-Large-V1") - Transformers.js
How to use WhereIsAI/UAE-Large-V1 with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('feature-extraction', 'WhereIsAI/UAE-Large-V1'); - Notebooks
- Google Colab
- Kaggle
use cosine_similarity
Browse files
README.md
CHANGED
|
@@ -2614,7 +2614,7 @@ language:
|
|
| 2614 |
**🤝 Follow us on:**
|
| 2615 |
|
| 2616 |
- GitHub: https://github.com/SeanLee97/AnglE.
|
| 2617 |
-
- Arxiv: https://arxiv.org/abs/2309.12871
|
| 2618 |
- 📘 Document: https://angle.readthedocs.io/en/latest/index.html
|
| 2619 |
|
| 2620 |
Welcome to using AnglE to train and infer powerful sentence embeddings.
|
|
@@ -2645,18 +2645,18 @@ There is no need to specify any prompts.
|
|
| 2645 |
|
| 2646 |
```python
|
| 2647 |
from angle_emb import AnglE
|
| 2648 |
-
from
|
| 2649 |
|
| 2650 |
angle = AnglE.from_pretrained('WhereIsAI/UAE-Large-V1', pooling_strategy='cls').cuda()
|
| 2651 |
doc_vecs = angle.encode([
|
| 2652 |
'The weather is great!',
|
| 2653 |
'The weather is very good!',
|
| 2654 |
'i am going to bed'
|
| 2655 |
-
])
|
| 2656 |
|
| 2657 |
for i, dv1 in enumerate(doc_vecs):
|
| 2658 |
for dv2 in doc_vecs[i+1:]:
|
| 2659 |
-
print(
|
| 2660 |
```
|
| 2661 |
|
| 2662 |
2) Retrieval Tasks
|
|
@@ -2665,7 +2665,7 @@ For retrieval purposes, please use the prompt `Prompts.C` for query (not for doc
|
|
| 2665 |
|
| 2666 |
```python
|
| 2667 |
from angle_emb import AnglE, Prompts
|
| 2668 |
-
from
|
| 2669 |
|
| 2670 |
angle = AnglE.from_pretrained('WhereIsAI/UAE-Large-V1', pooling_strategy='cls').cuda()
|
| 2671 |
qv = angle.encode(Prompts.C.format(text='what is the weather?'))
|
|
@@ -2676,7 +2676,7 @@ doc_vecs = angle.encode([
|
|
| 2676 |
])
|
| 2677 |
|
| 2678 |
for dv in doc_vecs:
|
| 2679 |
-
print(
|
| 2680 |
```
|
| 2681 |
|
| 2682 |
## 2. sentence transformer
|
|
|
|
| 2614 |
**🤝 Follow us on:**
|
| 2615 |
|
| 2616 |
- GitHub: https://github.com/SeanLee97/AnglE.
|
| 2617 |
+
- Arxiv: https://arxiv.org/abs/2309.12871 (ACL24)
|
| 2618 |
- 📘 Document: https://angle.readthedocs.io/en/latest/index.html
|
| 2619 |
|
| 2620 |
Welcome to using AnglE to train and infer powerful sentence embeddings.
|
|
|
|
| 2645 |
|
| 2646 |
```python
|
| 2647 |
from angle_emb import AnglE
|
| 2648 |
+
from angle_emb.utils import cosine_similarity
|
| 2649 |
|
| 2650 |
angle = AnglE.from_pretrained('WhereIsAI/UAE-Large-V1', pooling_strategy='cls').cuda()
|
| 2651 |
doc_vecs = angle.encode([
|
| 2652 |
'The weather is great!',
|
| 2653 |
'The weather is very good!',
|
| 2654 |
'i am going to bed'
|
| 2655 |
+
], normalize_embedding=True)
|
| 2656 |
|
| 2657 |
for i, dv1 in enumerate(doc_vecs):
|
| 2658 |
for dv2 in doc_vecs[i+1:]:
|
| 2659 |
+
print(cosine_similarity(dv1, dv2))
|
| 2660 |
```
|
| 2661 |
|
| 2662 |
2) Retrieval Tasks
|
|
|
|
| 2665 |
|
| 2666 |
```python
|
| 2667 |
from angle_emb import AnglE, Prompts
|
| 2668 |
+
from angle_emb.utils import cosine_similarity
|
| 2669 |
|
| 2670 |
angle = AnglE.from_pretrained('WhereIsAI/UAE-Large-V1', pooling_strategy='cls').cuda()
|
| 2671 |
qv = angle.encode(Prompts.C.format(text='what is the weather?'))
|
|
|
|
| 2676 |
])
|
| 2677 |
|
| 2678 |
for dv in doc_vecs:
|
| 2679 |
+
print(cosine_similarity(qv[0], dv))
|
| 2680 |
```
|
| 2681 |
|
| 2682 |
## 2. sentence transformer
|