Datasets:
Finalize card: drop MultiVectorEncoder from intro and the multi-vector/late-interaction tags, add SentenceTransformer usage example
Browse files
README.md
CHANGED
|
@@ -2,13 +2,11 @@
|
|
| 2 |
pretty_name: Example Documents
|
| 3 |
tags:
|
| 4 |
- sentence-transformers
|
| 5 |
-
- multi-vector
|
| 6 |
-
- late-interaction
|
| 7 |
---
|
| 8 |
|
| 9 |
# Example Documents
|
| 10 |
|
| 11 |
-
A small set of example documents across modalities (image, audio, video) for use in [Sentence Transformers](https://www.sbert.net/) retrieval snippets and documentation. These are the kinds of files you pass to `model.encode_document(...)`
|
| 12 |
|
| 13 |
## Contents
|
| 14 |
|
|
@@ -30,17 +28,36 @@ A small set of example documents across modalities (image, audio, video) for use
|
|
| 30 |
|
| 31 |
## Usage
|
| 32 |
|
| 33 |
-
Reference any file by its resolve URL
|
| 34 |
|
| 35 |
```python
|
| 36 |
from sentence_transformers import MultiVectorEncoder
|
| 37 |
|
| 38 |
model = MultiVectorEncoder("vidore/colqwen-omni-v0.1")
|
|
|
|
| 39 |
documents = [
|
| 40 |
-
"https://huggingface.co/datasets/sentence-transformers/example-documents/resolve/main/
|
| 41 |
"https://huggingface.co/datasets/sentence-transformers/example-documents/resolve/main/conversation3.mp3",
|
| 42 |
]
|
|
|
|
| 43 |
document_embeddings = model.encode_document(documents)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
```
|
| 45 |
|
| 46 |
## Credits
|
|
|
|
| 2 |
pretty_name: Example Documents
|
| 3 |
tags:
|
| 4 |
- sentence-transformers
|
|
|
|
|
|
|
| 5 |
---
|
| 6 |
|
| 7 |
# Example Documents
|
| 8 |
|
| 9 |
+
A small set of example documents across modalities (image, audio, video) for use in [Sentence Transformers](https://www.sbert.net/) retrieval snippets and documentation. These are the kinds of files you pass to `model.encode_document(...)`.
|
| 10 |
|
| 11 |
## Contents
|
| 12 |
|
|
|
|
| 28 |
|
| 29 |
## Usage
|
| 30 |
|
| 31 |
+
Reference any file by its resolve URL. These documents can be encoded with a multi-vector (late interaction) `MultiVectorEncoder`:
|
| 32 |
|
| 33 |
```python
|
| 34 |
from sentence_transformers import MultiVectorEncoder
|
| 35 |
|
| 36 |
model = MultiVectorEncoder("vidore/colqwen-omni-v0.1")
|
| 37 |
+
queries = ["What is the Llama 4 model?"]
|
| 38 |
documents = [
|
| 39 |
+
"https://huggingface.co/datasets/sentence-transformers/example-documents/resolve/main/llama4_hgf.png",
|
| 40 |
"https://huggingface.co/datasets/sentence-transformers/example-documents/resolve/main/conversation3.mp3",
|
| 41 |
]
|
| 42 |
+
query_embeddings = model.encode_query(queries)
|
| 43 |
document_embeddings = model.encode_document(documents)
|
| 44 |
+
print(model.similarity(query_embeddings, document_embeddings))
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
or with a single-vector `SentenceTransformer`:
|
| 48 |
+
|
| 49 |
+
```python
|
| 50 |
+
from sentence_transformers import SentenceTransformer
|
| 51 |
+
|
| 52 |
+
model = SentenceTransformer("LCO-Embedding/LCO-Embedding-Omni-3B-2605", trust_remote_code=True)
|
| 53 |
+
queries = ["What is the Llama 4 model?"]
|
| 54 |
+
documents = [
|
| 55 |
+
"https://huggingface.co/datasets/sentence-transformers/example-documents/resolve/main/llama4_hgf.png",
|
| 56 |
+
"https://huggingface.co/datasets/sentence-transformers/example-documents/resolve/main/conversation3.mp3",
|
| 57 |
+
]
|
| 58 |
+
query_embeddings = model.encode_query(queries)
|
| 59 |
+
document_embeddings = model.encode_document(documents)
|
| 60 |
+
print(model.similarity(query_embeddings, document_embeddings))
|
| 61 |
```
|
| 62 |
|
| 63 |
## Credits
|