mlx-vlm
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "mlx-vlm" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-2ce3bb8486d9d7651a5620de743fe1cdd28f00f5189e95ffe4cd0d6ecc73d650. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
MLX-VLM local Visual Language Model on Apple Silicon: run visual language models locally on Apple Silicon Macs using the MLX framework (image + text → response). Use cases include installing mlx‑vlm, running VLM inference, fine‑tuning visual models on custom datasets, local batch image processing, comparing local VLMs with cloud vision APIs (e.g., GPT‑4V, Claude Vision), and using models such as LLaVA, Phi‑3‑Vision, Qwen2‑VL, Pixtral, and Llama‑3.2‑Vision on Mac.
Introduction source: third_party · TerminalSkills · 1.0.0 Reference
SkillPi interpretation
- Testing
- Not tested
Browse files
Frontmatter
name: mlx-vlm
description: >-
Run Vision Language Models locally on Apple Silicon Macs using MLX. Use when:
installing mlx-vlm, running VLM inference (image + text → response), fine-tuning
vision models on custom datasets, batch processing images with local AI,
comparing local VLM to cloud APIs (GPT-4V, Claude Vision), or working with
LLaVA, Phi-3-Vision, Qwen2-VL, Pixtral, Llama-3.2-Vision on Mac.
license: Apache-2.0
compatibility: "macOS 14+, Apple Silicon, Python 3.10+"
metadata:
author: terminal-skills
version: "1.0.0"
category: data-ai
tags: ["mlx", "vision", "apple-silicon"]MLX-VLM — Vision Language Models on Apple Silicon
Overview
mlx-vlm runs vision-language models natively on Apple Silicon using the MLX framework. It supports inference and fine-tuning with unified memory — no GPU server needed.
Repo: Blaizzy/mlx-vlm
Requirements: macOS 14+, Apple Silicon (M1/M2/M3/M4), Python 3.10+
Installation
# Create virtual environment (recommended)
python3 -m venv ~/.venvs/mlx-vlm
source ~/.venvs/mlx-vlm/bin/activate
# Install
pip install mlx-vlm
For development:
git clone https://github.com/Blaizzy/mlx-vlm.git
cd mlx-vlm && pip install -e .
Supported Models
| Model | HuggingFace ID | Best For |
|---|---|---|
| Pixtral | mistral-community/pixtral-12b-240910 |
General vision, multi-image |
| Qwen2-VL | Qwen/Qwen2-VL-7B-Instruct |
OCR, document understanding |
| Phi-3-Vision | microsoft/Phi-3.5-vision-instruct |
Lightweight, fast inference |
| LLaVA-1.6 | llava-hf/llava-v1.6-mistral-7b-hf |
Conversation about images |
| Llama-3.2-Vision | meta-llama/Llama-3.2-11B-Vision-Instruct |
Strong general reasoning |
Inference
CLI
# Single image analysis
python -m mlx_vlm.generate \
--model mlx-community/pixtral-12b-240910-4bit \
--image path/to/image.jpg \
--prompt "Describe this image in detail" \
--max-tokens 512
# Multi-image comparison
python -m mlx_vlm.generate \
--model mlx-community/pixtral-12b-240910-4bit \
--image img1.jpg img2.jpg \
--prompt "Compare these two images"
Python API
from mlx_vlm import load, generate
from mlx_vlm.prompt_utils import apply_chat_template
model_path = "mlx-community/pixtral-12b-240910-4bit"
model, processor = load(model_path)
prompt = apply_chat_template(
processor,
config=model.config,
prompt="What objects are in this image?",
images=["product.jpg"],
)
output = generate(
model, processor, prompt,
images=["product.jpg"],
max_tokens=512,
temperature=0.7,
)
print(output)
Batch Processing
import os, csv
from mlx_vlm import load, generate
from mlx_vlm.prompt_utils import apply_chat_template
model, processor = load("mlx-community/pixtral-12b-240910-4bit")
image_dir = "images/"
results = []
for filename in os.listdir(image_dir):
if not filename.lower().endswith((".jpg", ".png", ".webp")):
continue
path = os.path.join(image_dir, filename)
prompt = apply_chat_template(
processor, config=model.config,
prompt="Describe this product photo. Include: category, color, condition, key features.",
images=[path],
)
desc = generate(model, processor, prompt, images=[path], max_tokens=256)
results.append({"file": filename, "description": desc})
with open("descriptions.csv", "w", newline="") as f:
writer = csv.DictWriter(f, fieldnames=["file", "description"])
writer.writeheader()
writer.writerows(results)
Fine-Tuning
Prepare Dataset
Create JSONL with image paths and conversations:
{"image": "train/001.jpg", "conversations": [{"role": "user", "content": "Classify this product"}, {"role": "assistant", "content": "Category: Electronics, Subcategory: Headphones, Condition: New"}]}
{"image": "train/002.jpg", "conversations": [{"role": "user", "content": "Classify this product"}, {"role": "assistant", "content": "Category: Clothing, Subcategory: T-Shirt, Condition: Used - Good"}]}
Run Fine-Tuning (LoRA)
python -m mlx_vlm.lora \
--model mlx-community/pixtral-12b-240910-4bit \
--data ./dataset \
--train-file train.jsonl \
--valid-file val.jsonl \
--num-layers 8 \
--batch-size 1 \
--epochs 3 \
--lr 1e-5 \
--adapter-path ./adapters
Inference with Fine-Tuned Adapter
python -m mlx_vlm.generate \
--model mlx-community/pixtral-12b-240910-4bit \
--adapter-path ./adapters \
--image test.jpg \
--prompt "Classify this product"
Cloud API Comparison
| Factor | mlx-vlm (Local) | Cloud APIs (GPT-4V, Claude) |
|---|---|---|
| Cost | $0 after hardware | $0.01-0.04 per image |
| Privacy | Data stays local | Data sent to provider |
| Speed | ~2-8s per image (M3 Max) | ~1-3s per image |
| Offline | Yes | No |
| Custom models | LoRA fine-tuning | Limited / expensive |
| Quality | Good (7-12B models) | Excellent (frontier models) |
Performance Tips
- Use 4-bit quantized models (
4bitin name) for 2-3x speedup with minimal quality loss - M3 Max / M4 Pro with 36GB+ RAM can run 12B models comfortably
- For M1/M2 with 16GB, stick to 7B 4-bit models
- Set
MLX_METAL_JIT=1for potential speedup on first run - Close memory-heavy apps before inference — unified memory is shared with system
Current listing version
1.0.0
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供完整的本地 VLM 解决方案,涵盖安装、推理、微调、批量处理等端到端工作流
- 解决用户隐私、成本、离线使用等核心痛点,具有高实用价值
Highlights
- 触发词精准完整,覆盖安装、推理、微调、批量处理、云 API 对比等多种场景
- 边界清晰,用户能准确判断是否需要使用该 Skill
Highlights
- 文档结构清晰,包含完整的章节划分和详细的端到端示例
- frontmatter 完整,单文件长度适中,符合规范要求
Highlights
- 工具来源明确,参数正确,覆盖主要异常情况
- 提供了性能优化建议和硬件配置指导,提升执行成功率
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Save or modify files
Confirm the output directory and whether existing files will be replaced. Back up important files and prefer a new output directory.
Mentioned in main document · lines 121 -
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 35, 41
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- github.com
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.