Views
No views yet
config_1M.json for hot-swapping to enable YaRN (Yet another RoPE extensioN) for ultra-long context processing up to 1M tokens, and config_default.json to switch back. The main config.json ships with the default 256K context configuration. Per Qwen's guidance, static YaRN can impact performance on shorter texts, so only swap to config_1M.json when long-context processing is required. For details on using YaRN with this model, see https://huggingface.co/Qwen/Qwen3.8-27Bpreserve_thinking: False.toggle_mtp tool with these instructions so it can dynamically switch between the appropriate weights for maximum performance for both prefill and decode.config_1M.json (YaRN)1# Option 1: pip install
2pip install https://github.com/ml-explore/mlx-lm/archive/refs/pull/990/head.zip
3
4# Option 2: uv run (no virtual env needed)
5uv run --with https://github.com/ml-explore/mlx-lm/archive/refs/pull/990/head.zip python example.py1import mlx_lm
2from mlx_lm.sample_utils import make_sampler
3
4model_path = "petergilani/Qwen3.8-27B-MTP-4bit"
5model, tokenizer = mlx_lm.load(model_path)
6
7sampler = make_sampler(temp=1.0, top_p=0.95, top_k=20)
8
9prompt = "Explain multi-token prediction in language models."
10response = mlx_lm.generate(
11 model,
12 tokenizer,
13 prompt=prompt,
14 sampler=sampler,
15 max_tokens=512,
16 mtp=True # Enable Multi-Token Prediction for faster generation
17)
18print(response)