MLX conversion of XHToken/Spark-X2.6-4B for Apple Silicon.
model_type: spark2_5spark2_5 is not part of mlx-lm yet, so this repo ships its own implementation
(spark2_5_mlx.py) and points to it from config.json via model_file.
No patched mlx-lm is required — stock mlx-lm loads it directly.
pip install -U mlx-lm
from mlx_lm import load, generate
model, tokenizer = load("0x36/Spark-X2.6-4B-mlx-bf16")
prompt = tokenizer.apply_chat_template(
[{"role": "user", "content": "Write a Python function that reverses a linked list."}],
add_generation_prompt=True,
tokenize=False,
enable_thinking=False, # True for reasoning / thinking mode
)
print(generate(model, tokenizer, prompt=prompt, max_tokens=512))
CLI:
mlx_lm.generate --model 0x36/Spark-X2.6-4B-mlx-bf16 \
--prompt "What is the capital of Anhui Province?" --max-tokens 256
RotatingKVCache on the sliding layers.generation_config.json: temperature=1.0, top_p=0.95.lm_head).mlx_lm.convert --hf-path XHToken/Spark-X2.6-4B --mlx-path ./bf16 --dtype bfloat16
model-00001-of-00002.safetensors 5.0 GiBmodel-00002-of-00002.safetensors 2.7 GiB