跳到正文
Skillpedia
通用编程5.7k · #14748

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/Blaizzy/mlx-vlm/blob/main/skills/skills/cli-inference/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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

  1. Identify the model ID or local path, modality, prompt, media files, and expected output.
  2. Prefer an existing local model path or cached Hugging Face model when reproducing. Do not download a large model unless the user asks.
  3. Check model-specific docs first when the family has a README under mlx_vlm/models/<family>/README.md.
  4. Use uv run mlx_vlm.generate --help to 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-tokens and 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_type unsupported: inspect config.json and current folders under mlx_vlm/models/.
  • Missing weights: check for .safetensors or model.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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能