This is an
MLX-compatible version of the
mamba2-130m model. It uses the
EleutherAI/gpt-neox-20b tokenizer.
For more details, see our
blog post.
Installation requires Xcode, which can be downloaded from
https://developer.apple.com/xcode/. Accept the license agreement with:
1pip install nanobind@git+https://github.com/wjakob/nanobind.git@2f04eac452a6d9142dedb957701bdb20125561e4
2pip install git+https://github.com/cartesia-ai/edge.git#subdirectory=cartesia-metal
3pip install cartesia-mlx
Note: This package has been tested on macOS Sonoma 14.1 with the M3 chip.
1import mlx.core as mx
2import cartesia_mlx as cmx
3
4model = cmx.from_pretrained("cartesia-ai/mamba2-130m-mlx")
5model.set_dtype(mx.float32)
6
7prompt = "Rene Descartes was"
8
9print(prompt, end="", flush=True)
10for text in model.generate(
11 prompt,
12 max_tokens=500,
13 eval_every_n=5,
14 verbose=True,
15 top_p=0.99,
16 temperature=0.85,
17):
18 print(text, end="", flush=True)
At
Cartesia, we're building real-time multimodal intelligence for every device.