mlx-lm handles text models on Apple Silicon, but a model that can look at a picture needs its sibling package, mlx-vlm. It loads a vision-language model — one that takes an image and a text prompt and produces text — and runs it entirely on your Mac. The smallest useful start is a 2B Qwen2-VL model, which a third-party MLX course describes as under about 5 GB on disk.
Install mlx-vlm
Install the package with pip, as the project’s own README shows:
pip install -U mlx-vlm
mlx-vlm is built on MLX, so it runs on Apple Silicon Macs — that is the platform the README is written for.
Ask about an image
Use the command-line tool with a model, an image, a prompt, and a token limit. This is the README’s own image example, with a local practice image in place of its sample URL:
mlx_vlm.generate --model mlx-community/Qwen2-VL-2B-Instruct-4bit --max-tokens 100 --temperature 0.0 --image practice-lighthouse.jpg --prompt "What is in this image? Be concise."
The same call works in Python, where load returns the model and processor, apply_chat_template formats the prompt with the image placeholder, and generate returns the answer as .text:
from mlx_vlm import load, generate
from mlx_vlm.prompt_utils import apply_chat_template
from mlx_vlm.utils import load_config
model_path = "mlx-community/Qwen2-VL-2B-Instruct-4bit"
model, processor = load(model_path)
config = load_config(model_path)
image = ["practice-lighthouse.jpg"]
prompt = "What is in this image? Be concise."
formatted_prompt = apply_chat_template(processor, config, prompt, num_images=len(image))
output = generate(model, processor, formatted_prompt, image, max_tokens=120, verbose=False)
print(output.text)
| Check | What you should see | If you do not see it |
|---|---|---|
| Installed | pip install -U mlx-vlm finishes without error |
You are not on an Apple Silicon Mac — mlx-vlm is built for MLX |
| Model | The Qwen2-VL-2B model downloads on first use | Check the model name — it must be a vision-language model, not a text-only one |
| Image | The command accepts --image practice-lighthouse.jpg |
The file path is wrong — use the full path to your image |
| Answer | A short description of what is in the image | The prompt was unclear — ask one specific question |
Expected result. We checked mlx-vlm’s own README for the install and the generate command, and a third-party MLX course for the Python form. We did not run mlx-vlm.
Limits
The model name above is the README’s and the course’s own example; a text-only model cannot answer about an image, so the model must be a vision-language one. The “under about 5 GB” size is the course’s description of that small model, not a measurement made here. Always feed images through the processor — the course warns that pre-processing them yourself is the mistake most tutorials get wrong on the first try. We did not run mlx-vlm, so no answer here is a recorded result.
