cli-inference
它能做什么
这项技能教智能体如何在终端中运行 MLX-VLM 视觉与语言模型,涵盖文本、图像和音频输入,并帮助解决加载或处理方面的错误。
适用场景
- ✓当用户想在 Mac 上通过命令行运行视觉或语言模型的时候。
- ✓当 MLX-VLM 命令报告模型、提示或权重缺失等错误的时候。
- ✓当用户想要一条可重复使用的命令,用图像或音频文件测试模型的时候。
技能链接
https://github.com/Blaizzy/mlx-vlm/blob/main/skills/skills/cli-inference/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请给出命令,用我本地的 MLX-VLM 模型描述这张图片,并让回答简短一些。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会检查模型、提示和媒体文件,然后阅读命令的帮助输出,以获取当前参数。它会构建一条符合任务要求的命令。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
CLI Inference
Use this workflow for uv run mlx_vlm.generate and related command-line inference tasks.
First Checks
- Identify the model ID or local path, modality, prompt, media files, and expected output.
- Prefer an existing local model path or cached Hugging Face model when reproducing. Do not download a large model unless the user asks.
- Check model-specific docs first when the family has a README under
mlx_vlm/models/<family>/README.md. - Use
uv run mlx_vlm.generate --helpto verify current flags before giving a final command.
Command Patterns
Text:
uv run mlx_vlm.generate \
--model <model-or-path> \
--prompt "Write a short answer." \
--max-tokens 128
Image:
uv run mlx_vlm.generate \
--model <model-or-path> \
--image /path/to/image.jpg \
--prompt "Describe this image." \
--max-tokens 128
Audio or multimodal:
uv run mlx_vlm.generate \
--model <model-or-path> \
--image /path/to/image.jpg \
--audio /path/to/audio.wav \
--prompt "Describe what you see and hear." \
--max-tokens 128
More Flags & Modalities
uv run mlx_vlm.generate --help is the source of truth (the CLI lives in the mlx_vlm/generate/ package). Beyond --model/--prompt/--image/--audio/--max-tokens, common flags:
--chat— interactive multi-turn session.--adapter-path— apply a LoRA adapter.--eos-tokensand sampling flags — use greedy/low-temp when debugging quality.--trust-remote-code— needed for some custom processors.--kv-bits/--kv-quant-scheme/--max-kv-size— quantized/bounded KV cache.--draft-model/--draft-kind— speculative decoding.- Image generation/editing:
--output-modality image,--output <file>, and the--diffusion-*flags drive diffusion image models — not just text-out VLMs.
Reproducibility Rules
- Include the exact command, model ID/path, media file type and size, Python version, package version or git commit, and full error.
- Use low-temperature or greedy settings when debugging quality or regressions.
- Bound output with
--max-tokens. - Preserve shell quoting exactly, especially prompts with JSON, XML-like thinking tokens, or newlines.
- If the failure depends on an image/audio/video file, record dimensions, duration, codec, and whether a small synthetic input reproduces it.
Common Failure Routing
model_typeunsupported: inspectconfig.jsonand current folders undermlx_vlm/models/.- Missing weights: check for
.safetensorsormodel.safetensors.index.json. - Processor/chat template errors: inspect
processing_*.py,prompt_utils.py, and model-specific README examples. - Media shape errors: test one image/audio/video item first, then multi-input cases.
- If the user needs an issue report rather than a fix, switch to
Skill("mlx-vlm-skills:reproducible-github-issues").
Validation
- Run the smallest command that exercises the requested modality.
- For code changes touching CLI parsing, run
uv run pytest mlx_vlm/tests/test_cli.py -q. - For generation behavior, prefer focused tests such as
test_generate.py,test_processors.py, or a model-specific test file before broad suites.
常见问题
这会下载大型模型吗?
这项技能说明,除非用户要求,否则不应下载大型模型。
它能处理音频和视频吗?
能。这项技能涵盖图像、音频和视频输入。
应该先在哪里查看参数?
这项技能说明,命令的帮助输出是以其为准的依据。
详情
作者的原始描述
Use this skill when the user wants to run or debug MLX-VLM inference from the command line, including uv run mlx_vlm.generate, image/audio/video inputs, local model paths, Hugging Face model IDs, deterministic repro commands, and CLI errors around processors, prompts, model loading, or missing weights.
repo: Blaizzy/mlx-vlm
热度
- GitHub 星标
- 5.7k
- 排名
- #14748
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
convert-quantize
5.7k帮你的智能体把 Hugging Face 模型转换为 MLX 格式,并通过量化使其变小,同时为本地设备选择位宽、模式和校准方式。
hf-cache-models
5.7k帮你的智能体通过模型发现接口,列出正在运行的 MLX-VLM 服务器可以看到的模型,包括缓存模型、自定义模型和已加载的模型。
reproducible-github-issues
5.7k帮你的智能体为 MLX-VLM 撰写清晰、可复现的 GitHub 问题报告,附上环境信息、准确命令和一个小示例,用于反馈缺陷或速度变慢的问题。
server-inference
5.7k帮你的智能体运行并调试 MLX-VLM API 服务器,涵盖健康检查、聊天和 responses 请求、流式输出以及常见的请求错误。