AGENT SKILL

lmdeploy

Use LMDeploy to run offline LLM/VLM inference, serve OpenAI-compatible APIs, quantize models, tune PyTorch/TurboMind backends, and extend model support.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
lmdeploy
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Use LMDeploy to run offline LLM/VLM inference, serve OpenAI-compatible APIs, quantize models, tune PyTorch/TurboMind backends, and extend model support.
disable-model-invocation
true

02 资源文件 5

03 SKILL.md 正文

LMDeploy Repo Skill

Use this skill when a task mentions LMDeploy, lmdeploy.pipeline, lmdeploy serve, lmdeploy lite, TurboMind, PyTorchEngine, VLM media prompts, OpenAI-compatible model serving, or adding support for a new LMDeploy model/backend.

Before You Start

  • Read references/repo-provenance.md when checking whether this skill matches a current LMDeploy checkout.
  • Read references/model-and-backend-overview.md when choosing between TurboMind, PyTorch, serving, VLM, quantization, or model-extension routes.
  • Read references/troubleshooting.md for install/import, CUDA/TurboMind, optional dependency, and runtime triage shared across workflows.
  • Run python scripts/check_lmdeploy_environment.py --include-cli for a no-model diagnostic of imports, package version, CLI help, torch/CUDA visibility, and optional dependency gaps.

Minimal Install and Import Check

For normal use, prefer a packaged install in an isolated Python environment:

pip install lmdeploy
python - <<'PY'
import lmdeploy
from lmdeploy import GenerationConfig, PytorchEngineConfig, TurbomindEngineConfig, pipeline
print(lmdeploy.__version__)
print(GenerationConfig(max_new_tokens=1))
print(PytorchEngineConfig.__name__, TurbomindEngineConfig.__name__, pipeline)
PY

For source checkouts, DISABLE_TURBOMIND=1 pip install -e . avoids compiling the TurboMind extension when the task only needs Python API inspection or PyTorch backend work. Full TurboMind source builds need CUDA/toolchain compatibility; see backend-extension and root troubleshooting before rebuilding.

Route Map

User task Read
Use lmdeploy.pipeline, Pipeline.infer, streaming, chat sessions, GenerationConfig, chat templates, LoRA adapters, lmdeploy chat sub-skills/pipeline-inference/SKILL.md
Launch lmdeploy serve api_server, proxy multiple servers, call OpenAI/Responses/Anthropic endpoints, configure Codex or Claude Code clients sub-skills/serving-apis/SKILL.md
Build VLM prompts with images/video/audio/time-series, load_image, OpenAI multimodal content blocks, VisionConfig, media URL/base64 checks sub-skills/vision-language/SKILL.md
Plan AWQ/GPTQ/SmoothQuant/KV quantization, lmdeploy lite commands, Qwen3 recipes, quantized artifact handoff sub-skills/quantization/SKILL.md
Tune PyTorch/TurboMind backend config, debug _turbomind/NCCL/CUDA issues, inspect module maps, add new PyTorch model support sub-skills/backend-extension/SKILL.md

Common Decisions

  • Backend: use TurboMind for optimized deployment when compatible wheels/extensions and GPU support are available; use PyTorch backend for Python-first development, new-model work, or features documented as PyTorch-only.
  • Memory: reduce cache_max_entry_count, session_len, batch size, or tensor parallel assumptions before treating OOM as a model bug.
  • Serving: set --model-name explicitly when downstream clients need a stable ID; use --api-keys and matching Authorization: Bearer ... headers when authentication is enabled.
  • VLM: keep media payload construction in vision-language; server/client transport still belongs to serving-apis.
  • Quantized models: create artifacts in quantization, then route offline loading to pipeline-inference or service loading to serving-apis.
  • Repo edits: follow the current checkout’s contributor/test guidance, then run focused tests before broad suites.

Safe Validation Ladder

  1. python scripts/check_lmdeploy_environment.py --include-cli for package and CLI sanity.
  2. The owning sub-skill helper, such as python sub-skills/quantization/scripts/plan_quantization_command.py --help.
  3. CLI --help for the exact workflow (lmdeploy chat --help, lmdeploy serve api_server --help, or lmdeploy lite auto_awq --help).
  4. A no-download API/config/media check from the owning sub-skill.
  5. Native tests or real model execution only when the user has the model weights, hardware, optional dependencies, network/credentials, and time budget.

Do Not

  • Do not tell future agents to run original repository scripts or docs as runtime dependencies; use this skill’s bundled references/scripts instead.
  • Do not start model downloads, long quantization, GPU benchmarks, server daemons, or native test suites unless the user has approved the resources and prerequisites.
  • Do not expose local environment prefixes, Python executable paths, API keys, tokens, or machine-specific cache paths in public guidance.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351