metadata
license: gemma
pipeline_tag: sentence-similarity
library_name: sentence-transformers
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- mlx
extra_gated_heading: Access EmbeddingGemma on Hugging Face
extra_gated_prompt: >-
To access EmbeddingGemma on Hugging Face, you’re required to review and agree
to Google’s usage license. To do this, please ensure you’re logged in to
Hugging Face and click below. Requests are processed immediately.
extra_gated_button_content: Acknowledge license
mlx-community/embeddinggemma-300m-8bit
The Model mlx-community/embeddinggemma-300m-8bit was converted to MLX format from google/embeddinggemma-300m-qat-q8_0-unquantized using mlx-lm version 0.0.4.
Use with mlx
pip install mlx-embeddings
from mlx_embeddings import load, generate
import mlx.core as mx
model, tokenizer = load("mlx-community/embeddinggemma-300m-8bit")
# 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)