How to use mlx-community/CodeLlama-7b-Python-mlx with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("mlx-community/CodeLlama-7b-Python-mlx") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True)
How to use mlx-community/CodeLlama-7b-Python-mlx with MLX LM:
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "mlx-community/CodeLlama-7b-Python-mlx" --prompt "Once upon a time"
394930b fc02430 394930b
1
2
3
4
5
6
7
8
9
10
11
{ "dim": 4096, "n_layers": 32, "n_heads": 32, "multiple_of": 256, "ffn_dim_multiplier": 1.0, "norm_eps": 1e-5, "rope_theta": 1000000, "model_type": "llama" }