Sentence Similarity
sentence-transformers
Safetensors
gemma4
feature-extraction
dense
Eval Results (legacy)
Instructions to use shadowlilac/omniembed-merged with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use shadowlilac/omniembed-merged with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("shadowlilac/omniembed-merged") 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
| tags: | |
| - sentence-transformers | |
| - sentence-similarity | |
| - feature-extraction | |
| - dense | |
| pipeline_tag: sentence-similarity | |
| library_name: sentence-transformers | |
| metrics: | |
| - cosine_accuracy@1 | |
| - cosine_accuracy@3 | |
| - cosine_accuracy@5 | |
| - cosine_accuracy@10 | |
| - cosine_precision@1 | |
| - cosine_precision@3 | |
| - cosine_precision@5 | |
| - cosine_precision@10 | |
| - cosine_recall@1 | |
| - cosine_recall@3 | |
| - cosine_recall@5 | |
| - cosine_recall@10 | |
| - cosine_ndcg@10 | |
| - cosine_mrr@10 | |
| - cosine_map@100 | |
| model-index: | |
| - name: SentenceTransformer | |
| results: | |
| - task: | |
| type: information-retrieval | |
| name: Information Retrieval | |
| dataset: | |
| name: Unknown | |
| type: unknown | |
| metrics: | |
| - type: cosine_accuracy@1 | |
| value: 0.7602405110860578 | |
| name: Cosine Accuracy@1 | |
| - type: cosine_accuracy@3 | |
| value: 0.8357760240511086 | |
| name: Cosine Accuracy@3 | |
| - type: cosine_accuracy@5 | |
| value: 0.8485531754979331 | |
| name: Cosine Accuracy@5 | |
| - type: cosine_accuracy@10 | |
| value: 0.859075535512965 | |
| name: Cosine Accuracy@10 | |
| - type: cosine_precision@1 | |
| value: 0.7602405110860578 | |
| name: Cosine Precision@1 | |
| - type: cosine_precision@3 | |
| value: 0.2785920080170362 | |
| name: Cosine Precision@3 | |
| - type: cosine_precision@5 | |
| value: 0.1697106350995866 | |
| name: Cosine Precision@5 | |
| - type: cosine_precision@10 | |
| value: 0.08590755355129649 | |
| name: Cosine Precision@10 | |
| - type: cosine_recall@1 | |
| value: 0.7602405110860578 | |
| name: Cosine Recall@1 | |
| - type: cosine_recall@3 | |
| value: 0.8357760240511086 | |
| name: Cosine Recall@3 | |
| - type: cosine_recall@5 | |
| value: 0.8485531754979331 | |
| name: Cosine Recall@5 | |
| - type: cosine_recall@10 | |
| value: 0.859075535512965 | |
| name: Cosine Recall@10 | |
| - type: cosine_ndcg@10 | |
| value: 0.8143497069526588 | |
| name: Cosine Ndcg@10 | |
| - type: cosine_mrr@10 | |
| value: 0.7995083302016781 | |
| name: Cosine Mrr@10 | |
| - type: cosine_map@100 | |
| value: 0.8018586288255459 | |
| name: Cosine Map@100 | |
| # SentenceTransformer | |
| This is a [sentence-transformers](https://www.SBERT.net) model trained. It maps sentences & paragraphs to a 1536-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, classification, clustering, and more. | |
| ## Model Details | |
| ### Model Description | |
| - **Model Type:** Sentence Transformer | |
| <!-- - **Base model:** [Unknown](https://huggingface.co/unknown) --> | |
| - **Maximum Sequence Length:** 1000000000000000019884624838656 tokens | |
| - **Output Dimensionality:** 1536 dimensions | |
| - **Similarity Function:** Cosine Similarity | |
| - **Supported Modalities:** Text, Image, Audio, Video, Message | |
| <!-- - **Training Dataset:** Unknown --> | |
| <!-- - **Language:** Unknown --> | |
| <!-- - **License:** Unknown --> | |
| ### Model Sources | |
| - **Documentation:** [Sentence Transformers Documentation](https://sbert.net) | |
| - **Repository:** [Sentence Transformers on GitHub](https://github.com/huggingface/sentence-transformers) | |
| - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers) | |
| ### Full Model Architecture | |
| ``` | |
| SentenceTransformer( | |
| (0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}, 'image': {'method': 'forward', 'method_output_name': 'last_hidden_state'}, 'audio': {'method': 'forward', 'method_output_name': 'last_hidden_state'}, 'video': {'method': 'forward', 'method_output_name': 'last_hidden_state'}, 'message': {'method': 'forward', 'method_output_name': 'last_hidden_state', 'format': 'structured'}}, 'module_output_name': 'token_embeddings', 'architecture': 'Gemma4Model'}) | |
| (1): MultiheadAttentionPooling({'hidden_size': 1536, 'num_attention_heads': 16, 'intermediate_size': 6144, 'layer_norm_eps': 1e-06}) | |
| (2): Normalize({}) | |
| ) | |
| ``` | |
| ## Usage | |
| ### Direct Usage (Sentence Transformers) | |
| First install the Sentence Transformers library: | |
| ```bash | |
| pip install -U sentence-transformers | |
| ``` | |
| Then you can load this model and run inference. | |
| ```python | |
| from sentence_transformers import SentenceTransformer | |
| # Download from the 🤗 Hub | |
| model = SentenceTransformer("shadowlilac/omniembed-merged") | |
| # Run inference | |
| queries = [ | |
| 'Which planet is known as the Red Planet?', | |
| ] | |
| documents = [ | |
| "Venus is often called Earth's twin because of its similar size and proximity.", | |
| 'Mars, known for its reddish appearance, is often referred to as the Red Planet.', | |
| 'Saturn, famous for its rings, is sometimes mistaken for the Red Planet.', | |
| ] | |
| query_embeddings = model.encode_query(queries) | |
| document_embeddings = model.encode_document(documents) | |
| print(query_embeddings.shape, document_embeddings.shape) | |
| # [1, 1536] [3, 1536] | |
| # Get the similarity scores for the embeddings | |
| similarities = model.similarity(query_embeddings, document_embeddings) | |
| print(similarities) | |
| # tensor([[0.3457, 0.8750, 0.6484]], dtype=torch.bfloat16) | |
| ``` | |
| <!-- | |
| ### Direct Usage (Transformers) | |
| <details><summary>Click to see the direct usage in Transformers</summary> | |
| </details> | |
| --> | |
| <!-- | |
| ### Downstream Usage (Sentence Transformers) | |
| You can finetune this model on your own dataset. | |
| <details><summary>Click to expand</summary> | |
| </details> | |
| --> | |
| <!-- | |
| ### Out-of-Scope Use | |
| *List how the model may foreseeably be misused and address what users ought not to do with the model.* | |
| --> | |
| ## Evaluation | |
| ### Metrics | |
| #### Information Retrieval | |
| * Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.sentence_transformer.evaluation.InformationRetrievalEvaluator) | |
| | Metric | Value | | |
| |:--------------------|:-----------| | |
| | cosine_accuracy@1 | 0.7602 | | |
| | cosine_accuracy@3 | 0.8358 | | |
| | cosine_accuracy@5 | 0.8486 | | |
| | cosine_accuracy@10 | 0.8591 | | |
| | cosine_precision@1 | 0.7602 | | |
| | cosine_precision@3 | 0.2786 | | |
| | cosine_precision@5 | 0.1697 | | |
| | cosine_precision@10 | 0.0859 | | |
| | cosine_recall@1 | 0.7602 | | |
| | cosine_recall@3 | 0.8358 | | |
| | cosine_recall@5 | 0.8486 | | |
| | cosine_recall@10 | 0.8591 | | |
| | **cosine_ndcg@10** | **0.8143** | | |
| | cosine_mrr@10 | 0.7995 | | |
| | cosine_map@100 | 0.8019 | | |
| <!-- | |
| ## Bias, Risks and Limitations | |
| *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.* | |
| --> | |
| <!-- | |
| ### Recommendations | |
| *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.* | |
| --> | |
| ## Training Details | |
| ### Training Logs | |
| | Epoch | Step | cosine_ndcg@10 | | |
| |:-----:|:----:|:--------------:| | |
| | -1 | -1 | 0.8143 | | |
| ### Framework Versions | |
| - Python: 3.12.13 | |
| - Sentence Transformers: 5.7.0 | |
| - Transformers: 5.14.1 | |
| - PyTorch: 2.13.0+cu130 | |
| - Accelerate: 1.14.0 | |
| - Datasets: 5.0.1 | |
| - Tokenizers: 0.22.2 | |
| ## Additional Resources | |
| - [Training and Finetuning Embedding Models with Sentence Transformers](https://huggingface.co/blog/train-sentence-transformers): the end-to-end guide for training or finetuning Sentence Transformer models. | |
| - [Introduction to Matryoshka Embedding Models](https://huggingface.co/blog/matryoshka): variable-size embeddings that can be truncated with minimal quality loss. | |
| - [Binary and Scalar Embedding Quantization for Significantly Faster & Cheaper Retrieval](https://huggingface.co/blog/embedding-quantization): post-training compression of embedding vectors. | |
| - [Multimodal Embedding & Reranker Models with Sentence Transformers](https://huggingface.co/blog/multimodal-sentence-transformers): use text, image, audio, and video models through the same API. | |
| - [Training and Finetuning Multimodal Embedding & Reranker Models with Sentence Transformers](https://huggingface.co/blog/train-multimodal-sentence-transformers): train multimodal embedding models, with a Visual Document Retrieval walkthrough. | |
| ## Citation | |
| ### BibTeX | |
| <!-- | |
| ## Glossary | |
| *Clearly define terms in order to be accessible across audiences.* | |
| --> | |
| <!-- | |
| ## Model Card Authors | |
| *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.* | |
| --> | |
| <!-- | |
| ## Model Card Contact | |
| *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.* | |
| --> |