Sentence Similarity
sentence-transformers
Safetensors
multilingual
neomme
multimodal
document-retrieval
dense-retrieval
Instructions to use Hcompany/NeoMME-800M-Retriever-ST-dense with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Hcompany/NeoMME-800M-Retriever-ST-dense with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Hcompany/NeoMME-800M-Retriever-ST-dense") 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] - Notebooks
- Google Colab
- Kaggle
Download chat_template.jinja from Hcompany/NeoMME-800M-Retriever-ST-dense: direct link, hf CLI and curl.
- Browser
- Download file 3.49 kB
-
https://huggingface.co/Hcompany/NeoMME-800M-Retriever-ST-dense/resolve/main/chat_template.jinja
- Command line
-
hf download hf://Hcompany/NeoMME-800M-Retriever-ST-dense/chat_template.jinja
-
curl -L -o chat_template.jinja https://huggingface.co/Hcompany/NeoMME-800M-Retriever-ST-dense/resolve/main/chat_template.jinja
3.49 kB
| {#- | |
| NeoMME retrieval prompt template. Not a conversation format: NeoMME is an encoder and has no chat turns. | |
| `task` selects the retrieval side. A sentence-transformers v6 `MultiVectorEncoder` routes | |
| `task="query"` / `task="document"` here when the template declares the variable. | |
| task="query" -> <query> … N x <mask> ColBERT-style learned query expansion. <mask> is the | |
| masked-diffusion fill token. The exporter sets N from the | |
| checkpoint. | |
| task="document" -> <doc> … Text passages. Image pages take the same <doc> prefix | |
| followed by one image token placeholder, which the processor | |
| expands after it knows the patch grid. | |
| -#} | |
| {%- if task is not defined -%} | |
| {{- raise_exception("NeoMME chat templates require task='query' or task='document'.") -}} | |
| {%- endif -%} | |
| {%- if task not in ['query', 'document'] -%} | |
| {{- raise_exception("task=" ~ task ~ " is not supported: expected 'query' or 'document'.") -}} | |
| {%- endif -%} | |
| {%- if messages is not defined or not messages -%} | |
| {{- raise_exception("NeoMME chat conversations must contain at least one message.") -}} | |
| {%- endif -%} | |
| {# Collect content and validate one retrieval item without imposing batch-level policy. #} | |
| {%- set state = namespace(text='', has_text=false, image_count=0) -%} | |
| {%- for message in messages -%} | |
| {%- set content = message.content -%} | |
| {%- set items = [{'type': 'text', 'text': content}] if content is string else content -%} | |
| {%- for item in items -%} | |
| {%- if item.type == 'text' -%} | |
| {%- if image_token in item.text -%} | |
| {{- raise_exception(image_token ~ " is reserved for image documents.") -}} | |
| {%- endif -%} | |
| {%- set state.has_text = true -%} | |
| {%- set state.text = state.text + item.text -%} | |
| {%- elif item.type == 'image' -%} | |
| {%- if item.image is not defined or item.image is none or item.image == '' -%} | |
| {{- raise_exception("NeoMME image content must provide an image source.") -}} | |
| {%- endif -%} | |
| {%- set state.image_count = state.image_count + 1 -%} | |
| {%- elif item.type == 'image_url' -%} | |
| {%- if item.image_url is not defined or not item.image_url -%} | |
| {{- raise_exception("NeoMME image_url content must provide an image source.") -}} | |
| {%- endif -%} | |
| {%- set state.image_count = state.image_count + 1 -%} | |
| {%- else -%} | |
| {{- raise_exception("NeoMME chat templates do not support content type " ~ item.type ~ ".") -}} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- endfor -%} | |
| {%- if state.image_count and state.has_text -%} | |
| {{- raise_exception("NeoMME cannot encode text and images in the same conversation.") -}} | |
| {%- endif -%} | |
| {%- if state.image_count > 1 -%} | |
| {{- raise_exception("NeoMME accepts one image document per conversation.") -}} | |
| {%- endif -%} | |
| {%- if state.image_count and task != 'document' -%} | |
| {{- raise_exception("NeoMME image content must use task='document'.") -}} | |
| {%- endif -%} | |
| {%- set content = image_token if state.image_count else state.text -%} | |
| {%- if task == 'query' -%} | |
| {{- query_token + content + mask_token * 10 -}} | |
| {%- else -%} | |
| {{- document_token + content -}} | |
| {%- endif -%} | |