Added model card
#1
by
Anush008
- opened
README.md
CHANGED
@@ -1,3 +1,37 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
pipeline_tag: sentence-similarity
|
6 |
+
---
|
7 |
+
ONNX port of [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) adjusted to return attention weights.
|
8 |
+
|
9 |
+
This model is intended to be used for [BM42 searches](https://qdrant.tech/articles/bm42/).
|
10 |
+
|
11 |
+
### Usage
|
12 |
+
|
13 |
+
Here's an example of performing inference using the model with [FastEmbed](https://github.com/qdrant/fastembed).
|
14 |
+
|
15 |
+
```py
|
16 |
+
from fastembed import SparseTextEmbedding
|
17 |
+
|
18 |
+
documents = [
|
19 |
+
"You should stay, study and sprint.",
|
20 |
+
"History can only prepare us to be surprised yet again.",
|
21 |
+
]
|
22 |
+
|
23 |
+
model = SparseTextEmbedding(model_name="Qdrant/bm42-all-minilm-l6-v2-attentions")
|
24 |
+
embeddings = list(model.embed(documents))
|
25 |
+
|
26 |
+
# [
|
27 |
+
# SparseEmbedding(values=array([0.26399775, 0.24662513, 0.47077307]),
|
28 |
+
# indices=array([1881538586, 150760872, 1932363795])),
|
29 |
+
# SparseEmbedding(values=array(
|
30 |
+
# [0.38320042, 0.25453135, 0.18017513, 0.30432631, 0.1373556]),
|
31 |
+
# indices=array([
|
32 |
+
# 733618285, 1849833631, 1008800696, 2090661150,
|
33 |
+
# 1117393019
|
34 |
+
# ]))
|
35 |
+
# ]
|
36 |
+
|
37 |
+
```
|