Sentence Similarity
sentence-transformers
Safetensors
English
Chinese
qwen2
mteb
retriever
text-embeddings-inference
custom_code
Instructions to use Kingsoft-LLM/QZhou-Embedding with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Kingsoft-LLM/QZhou-Embedding with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Kingsoft-LLM/QZhou-Embedding", trust_remote_code=True) sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
format code chunks in readme
#1
by KennethEnevoldsen - opened
README.md
CHANGED
|
@@ -89,7 +89,7 @@ attn_implementation='sdpa'<br>
|
|
| 89 |
Details can be found on our <a href="https://github.com/Kingsoft-LLM/QZhou-Embedding">GitHub</a>.
|
| 90 |
#### Evaluation code usage
|
| 91 |
Find our benchmark evaluation code on <a href="https://github.com/Kingsoft-LLM/QZhou-Embedding">GitHub</a>. The mteb benchmark script is **run_mteb_all_v2.py**, and the cmteb benchmark script is **run_cmteb_all.py**. Run the following command:
|
| 92 |
-
```
|
| 93 |
POOLING_MODE=mean
|
| 94 |
normalize=true
|
| 95 |
use_instruction=true
|
|
@@ -116,7 +116,7 @@ This is a general script that can be used to evaluate other huggingface embeddin
|
|
| 116 |
|
| 117 |
### Sentence-transformers
|
| 118 |
|
| 119 |
-
```
|
| 120 |
from sentence_transformers import SentenceTransformer
|
| 121 |
|
| 122 |
model = SentenceTransformer("Kingsoft-LLM/QZhou-Embedding")
|
|
@@ -145,7 +145,7 @@ similarity = model.similarity(query_embeddings, document_embeddings)
|
|
| 145 |
|
| 146 |
### Huggingface Transformers
|
| 147 |
|
| 148 |
-
```
|
| 149 |
import torch
|
| 150 |
import torch.nn.functional as F
|
| 151 |
|
|
|
|
| 89 |
Details can be found on our <a href="https://github.com/Kingsoft-LLM/QZhou-Embedding">GitHub</a>.
|
| 90 |
#### Evaluation code usage
|
| 91 |
Find our benchmark evaluation code on <a href="https://github.com/Kingsoft-LLM/QZhou-Embedding">GitHub</a>. The mteb benchmark script is **run_mteb_all_v2.py**, and the cmteb benchmark script is **run_cmteb_all.py**. Run the following command:
|
| 92 |
+
```bash
|
| 93 |
POOLING_MODE=mean
|
| 94 |
normalize=true
|
| 95 |
use_instruction=true
|
|
|
|
| 116 |
|
| 117 |
### Sentence-transformers
|
| 118 |
|
| 119 |
+
```py
|
| 120 |
from sentence_transformers import SentenceTransformer
|
| 121 |
|
| 122 |
model = SentenceTransformer("Kingsoft-LLM/QZhou-Embedding")
|
|
|
|
| 145 |
|
| 146 |
### Huggingface Transformers
|
| 147 |
|
| 148 |
+
```py
|
| 149 |
import torch
|
| 150 |
import torch.nn.functional as F
|
| 151 |
|