Sentence Similarity
sentence-transformers
Safetensors
MLX
English
modernbert
feature-extraction
Generated from Trainer
dataset_size:6661966
loss:MultipleNegativesRankingLoss
loss:CachedMultipleNegativesRankingLoss
loss:SoftmaxLoss
loss:AnglELoss
loss:CoSENTLoss
loss:CosineSimilarityLoss
text-embeddings-inference
Instructions to use mlx-community/tasksource-ModernBERT-base-embed-6bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use mlx-community/tasksource-ModernBERT-base-embed-6bit with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("mlx-community/tasksource-ModernBERT-base-embed-6bit") sentences = [ "Daniel went to the kitchen. Sandra went back to the kitchen. Daniel moved to the garden. Sandra grabbed the apple. Sandra went back to the office. Sandra dropped the apple. Sandra went to the garden. Sandra went back to the bedroom. Sandra went back to the office. Mary went back to the office. Daniel moved to the bathroom. Sandra grabbed the apple. Sandra travelled to the garden. Sandra put down the apple there. Mary went back to the bathroom. Daniel travelled to the garden. Mary took the milk. Sandra grabbed the apple. Mary left the milk there. Sandra journeyed to the bedroom. John travelled to the office. John went back to the garden. Sandra journeyed to the garden. Mary grabbed the milk. Mary left the milk. Mary grabbed the milk. Mary went to the hallway. John moved to the hallway. Mary picked up the football. Sandra journeyed to the kitchen. Sandra left the apple. Mary discarded the milk. John journeyed to the garden. Mary dropped the football. Daniel moved to the bathroom. Daniel journeyed to the kitchen. Mary travelled to the bathroom. Daniel went to the bedroom. Mary went to the hallway. Sandra got the apple. Sandra went back to the hallway. Mary moved to the kitchen. Sandra dropped the apple there. Sandra grabbed the milk. Sandra journeyed to the bathroom. John went back to the kitchen. Sandra went to the kitchen. Sandra travelled to the bathroom. Daniel went to the garden. Daniel moved to the kitchen. Sandra dropped the milk. Sandra got the milk. Sandra put down the milk. John journeyed to the garden. Sandra went back to the hallway. Sandra picked up the apple. Sandra got the football. Sandra moved to the garden. Daniel moved to the bathroom. Daniel travelled to the garden. Sandra went back to the bathroom. Sandra discarded the football.", "In the adulthood stage, it can jump, walk, run", "The chocolate is bigger than the container.", "The football before the bathroom was in the garden." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - MLX
How to use mlx-community/tasksource-ModernBERT-base-embed-6bit with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir tasksource-ModernBERT-base-embed-6bit mlx-community/tasksource-ModernBERT-base-embed-6bit
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- LM Studio
| language: | |
| - en | |
| tags: | |
| - sentence-transformers | |
| - sentence-similarity | |
| - feature-extraction | |
| - generated_from_trainer | |
| - dataset_size:6661966 | |
| - loss:MultipleNegativesRankingLoss | |
| - loss:CachedMultipleNegativesRankingLoss | |
| - loss:SoftmaxLoss | |
| - loss:AnglELoss | |
| - loss:CoSENTLoss | |
| - loss:CosineSimilarityLoss | |
| - mlx | |
| base_model: answerdotai/ModernBERT-base | |
| widget: | |
| - source_sentence: Daniel went to the kitchen. Sandra went back to the kitchen. Daniel | |
| moved to the garden. Sandra grabbed the apple. Sandra went back to the office. | |
| Sandra dropped the apple. Sandra went to the garden. Sandra went back to the bedroom. | |
| Sandra went back to the office. Mary went back to the office. Daniel moved to | |
| the bathroom. Sandra grabbed the apple. Sandra travelled to the garden. Sandra | |
| put down the apple there. Mary went back to the bathroom. Daniel travelled to | |
| the garden. Mary took the milk. Sandra grabbed the apple. Mary left the milk there. | |
| Sandra journeyed to the bedroom. John travelled to the office. John went back | |
| to the garden. Sandra journeyed to the garden. Mary grabbed the milk. Mary left | |
| the milk. Mary grabbed the milk. Mary went to the hallway. John moved to the hallway. | |
| Mary picked up the football. Sandra journeyed to the kitchen. Sandra left the | |
| apple. Mary discarded the milk. John journeyed to the garden. Mary dropped the | |
| football. Daniel moved to the bathroom. Daniel journeyed to the kitchen. Mary | |
| travelled to the bathroom. Daniel went to the bedroom. Mary went to the hallway. | |
| Sandra got the apple. Sandra went back to the hallway. Mary moved to the kitchen. | |
| Sandra dropped the apple there. Sandra grabbed the milk. Sandra journeyed to the | |
| bathroom. John went back to the kitchen. Sandra went to the kitchen. Sandra travelled | |
| to the bathroom. Daniel went to the garden. Daniel moved to the kitchen. Sandra | |
| dropped the milk. Sandra got the milk. Sandra put down the milk. John journeyed | |
| to the garden. Sandra went back to the hallway. Sandra picked up the apple. Sandra | |
| got the football. Sandra moved to the garden. Daniel moved to the bathroom. Daniel | |
| travelled to the garden. Sandra went back to the bathroom. Sandra discarded the | |
| football. | |
| sentences: | |
| - In the adulthood stage, it can jump, walk, run | |
| - The chocolate is bigger than the container. | |
| - The football before the bathroom was in the garden. | |
| - source_sentence: Almost everywhere the series converges then . | |
| sentences: | |
| - The series then converges almost everywhere . | |
| - Scrivener dated the manuscript to the 12th century , C. R. Gregory to the 13th | |
| century . Currently the manuscript is dated by the INTF to the 12th century . | |
| - Both daughters died before he did , Tosca in 1976 and Janear in 1981 . | |
| - source_sentence: how are you i'm doing good thank you you im not good having cough | |
| and colg | |
| sentences: | |
| - 'This example tweet expresses the emotion: happiness' | |
| - This example utterance is about cooking recipies. | |
| - This example text from a US presidential speech is about macroeconomics | |
| - source_sentence: A man is doing pull-ups | |
| sentences: | |
| - The man is doing exercises in a gym | |
| - A black and white dog with a large branch is running in the field | |
| - There is no man drawing | |
| - source_sentence: A chef is preparing some food | |
| sentences: | |
| - The man is lifting weights | |
| - A chef is preparing a meal | |
| - A dog is in a sandy area with the sand that is being stirred up into the air and | |
| several plants are in the background | |
| datasets: | |
| - tomaarsen/natural-questions-hard-negatives | |
| - tomaarsen/gooaq-hard-negatives | |
| - bclavie/msmarco-500k-triplets | |
| - sentence-transformers/all-nli | |
| - sentence-transformers/msmarco-co-condenser-margin-mse-sym-mnrl-mean-v1 | |
| - sentence-transformers/gooaq | |
| - sentence-transformers/natural-questions | |
| - tasksource/merged-2l-nli | |
| - tasksource/merged-3l-nli | |
| - tasksource/zero-shot-label-nli | |
| - MoritzLaurer/dataset_train_nli | |
| - google-research-datasets/paws | |
| - nyu-mll/glue | |
| - mwong/fever-evidence-related | |
| - tasksource/sts-companion | |
| pipeline_tag: sentence-similarity | |
| library_name: sentence-transformers | |
| # mlx-community/tasksource-ModernBERT-base-embed-6bit | |
| The Model [mlx-community/tasksource-ModernBERT-base-embed-6bit](https://huggingface.co/mlx-community/tasksource-ModernBERT-base-embed-6bit) was converted to MLX format from [tasksource/ModernBERT-base-embed](https://huggingface.co/tasksource/ModernBERT-base-embed) using mlx-lm version **0.0.3**. | |
| ## Use with mlx | |
| ```bash | |
| pip install mlx-embeddings | |
| ``` | |
| ```python | |
| from mlx_embeddings import load, generate | |
| import mlx.core as mx | |
| model, tokenizer = load("mlx-community/tasksource-ModernBERT-base-embed-6bit") | |
| # For text embeddings | |
| output = generate(model, processor, texts=["I like grapes", "I like fruits"]) | |
| embeddings = output.text_embeds # Normalized embeddings | |
| # Compute dot product between normalized embeddings | |
| similarity_matrix = mx.matmul(embeddings, embeddings.T) | |
| print("Similarity matrix between texts:") | |
| print(similarity_matrix) | |
| ``` | |