Sentence Similarity
sentence-transformers
PyTorch
ONNX
Safetensors
Transformers
Transformers.js
English
nomic_bert
feature-extraction
mteb
custom_code
Eval Results (legacy)
text-embeddings-inference
Instructions to use inesaltemir/MNLP_M2_document_encoder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use inesaltemir/MNLP_M2_document_encoder with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("inesaltemir/MNLP_M2_document_encoder", 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] - Transformers
How to use inesaltemir/MNLP_M2_document_encoder with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("inesaltemir/MNLP_M2_document_encoder", trust_remote_code=True) model = AutoModel.from_pretrained("inesaltemir/MNLP_M2_document_encoder", trust_remote_code=True) - Transformers.js
How to use inesaltemir/MNLP_M2_document_encoder with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('sentence-similarity', 'inesaltemir/MNLP_M2_document_encoder'); - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -2661,9 +2661,16 @@ Training data to train the models is released in its entirety. For more details,
|
|
| 2661 |
|
| 2662 |
## Usage
|
| 2663 |
|
| 2664 |
-
Note `nomic-embed-text` requires prefixes! We support the prefixes `[search_query, search_document, classification, clustering]`.
|
| 2665 |
For retrieval applications, you should prepend `search_document` for all your documents and `search_query` for your queries.
|
| 2666 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2667 |
### Sentence Transformers
|
| 2668 |
```python
|
| 2669 |
from sentence_transformers import SentenceTransformer
|
|
|
|
| 2661 |
|
| 2662 |
## Usage
|
| 2663 |
|
| 2664 |
+
Note `nomic-embed-text` *requires* prefixes! We support the prefixes `[search_query, search_document, classification, clustering]`.
|
| 2665 |
For retrieval applications, you should prepend `search_document` for all your documents and `search_query` for your queries.
|
| 2666 |
|
| 2667 |
+
For example, you are building a RAG application over the top of Wikipedia. You would embed all Wikipedia articles with the prefix `search_document`
|
| 2668 |
+
and any questions you ask with `search_query`. For example:
|
| 2669 |
+
```python
|
| 2670 |
+
queries = ["search_query: who is the first president of the united states?", "search_query: when was babe ruth born?"]
|
| 2671 |
+
documents = ["search_document: <article about US Presidents>", "search_document: <article about Babe Ruth>"]
|
| 2672 |
+
```
|
| 2673 |
+
|
| 2674 |
### Sentence Transformers
|
| 2675 |
```python
|
| 2676 |
from sentence_transformers import SentenceTransformer
|