HobbyLM-Embed-140M (MLX, float16)

MLX version of harims95/hobbylm-embed-140m for Apple Silicon: the same weights in float16 (the expert router and its selection bias stay float32), producing 512-d, L2-normalised embeddings.

File Content
model.safetensors float16 weights (280 MB)
quant.json {"bits": null, "dtype": "float16"}
hobbylm_mlx.py the MLX model and encoder (Apache-2.0)
config.json, tokenizer.json, tokenizer_config.json, sentence_bert_config.json, config_sentence_transformers.json from the main model repo

Usage

pip install mlx tokenizers numpy huggingface_hub

Tested versions: mlx 0.32.4, tokenizers 0.23.3, numpy 2.5.5, huggingface_hub 2.4.0.

import sys
from huggingface_hub import snapshot_download

path = snapshot_download("harims95/hobbylm-embed-140m-mlx")
sys.path.insert(0, path)
from hobbylm_mlx import Encoder

enc = Encoder(path, quant_dir=path)
q = enc.encode(["what is the capital of france"], prompt_name="query")
p = enc.encode(["Paris is the capital and largest city of France."], prompt_name="passage")
print(q @ p.T)   # vectors are L2-normalised: this is cosine similarity

Prompts. For search and RAG, encode queries with prompt_name="query" (adds query: ) and documents with prompt_name="passage" (adds passage: ). For similarity, clustering and classification, use plain text (no prompt_name).

Input length. 512 tokens by default (read from sentence_bert_config.json), which is what MTEB(eng, v2) was measured at. For long documents (up to 2,048 tokens):

enc = Encoder(path, quant_dir=path, max_seq_length=2048)

Tested

Tested on Apple M4 (macOS 15.5, mlx 0.32.4): float32 matches Sentence Transformers exactly (cosine 1.00000000); float16 lowest cosine 0.99965.

Licence

Apache-2.0 (LICENSE).

Team

Hariharan M. S., Prabhurajhan R.

Downloads last month
-
Safetensors
Model size
0.1B params
Tensor type
F32
ยท
F16
ยท
MLX
Hardware compatibility
Log In to add your hardware

Quantized

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for harims95/hobbylm-embed-140m-mlx

Finetuned
(1)
this model