mlx-vlm
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "mlx-vlm":https://skillpi.com/zh/skills/deepskill-2ce3bb8486d9d7651a5620de743fe1cdd28f00f5189e95ffe4cd0d6ecc73d650。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
MLX-VLM 在 Apple Silicon 本地运行视觉语言模型:在 Apple Silicon Mac 上使用 MLX 框架本地运行视觉语言模型(图像+文本→响应)。适用场景包括安装 mlx-vlm、运行 VLM 推理、在自定义数据集上微调视觉模型、本地批量图像处理、将本地 VLM 与云端视觉 API(如 GPT‑4V、Claude Vision)对比,以及在 Mac 上使用 LLaVA、Phi‑3‑Vision、Qwen2‑VL、Pixtral、Llama‑3.2‑Vision 等模型。
介绍来源: third_party · TerminalSkills · 1.0.0 参考来源
SkillPi 解读
- 实测状态
- 未测试
文件浏览
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
当前收录版本
1.0.0
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供完整的本地 VLM 解决方案,涵盖安装、推理、微调、批量处理等端到端工作流
- 解决用户隐私、成本、离线使用等核心痛点,具有高实用价值
亮点
- 触发词精准完整,覆盖安装、推理、微调、批量处理、云 API 对比等多种场景
- 边界清晰,用户能准确判断是否需要使用该 Skill
亮点
- 文档结构清晰,包含完整的章节划分和详细的端到端示例
- frontmatter 完整,单文件长度适中,符合规范要求
亮点
- 工具来源明确,参数正确,覆盖主要异常情况
- 提供了性能优化建议和硬件配置指导,提升执行成功率
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
-
保存或修改文件
先确认输出目录和同名文件是否会被覆盖;重要文件保留备份,优先写入新的输出目录。
主文档提及 · 第 121 行 -
安装或获取外部依赖
使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。
主文档提及 · 第 35, 41 行
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- github.com
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。