Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -21111,15 +21111,14 @@ model-index:
|
|
| 21111 |
model, tokenizer = load('mlx-community/modernbert-embed-base-8bit')
|
| 21112 |
|
| 21113 |
# For text embeddings
|
| 21114 |
-
output = generate(model, processor, texts=[
|
| 21115 |
-
|
| 21116 |
embeddings = output.text_embeds # Normalized embeddings
|
| 21117 |
|
| 21118 |
# Compute dot product between normalized embeddings
|
| 21119 |
similarity_matrix = mx.matmul(embeddings, embeddings.T)
|
| 21120 |
|
| 21121 |
-
print(
|
| 21122 |
-
Similarity matrix between texts:
|
| 21123 |
print(similarity_matrix)
|
| 21124 |
|
| 21125 |
|
|
|
|
| 21111 |
model, tokenizer = load('mlx-community/modernbert-embed-base-8bit')
|
| 21112 |
|
| 21113 |
# For text embeddings
|
| 21114 |
+
output = generate(model, processor, texts=["I like grapes", "I like fruits"])
|
|
|
|
| 21115 |
embeddings = output.text_embeds # Normalized embeddings
|
| 21116 |
|
| 21117 |
# Compute dot product between normalized embeddings
|
| 21118 |
similarity_matrix = mx.matmul(embeddings, embeddings.T)
|
| 21119 |
|
| 21120 |
+
print("
|
| 21121 |
+
Similarity matrix between texts:")
|
| 21122 |
print(similarity_matrix)
|
| 21123 |
|
| 21124 |
|