inference-serving
Guides future agents through MiniMind inference, OpenAI-compatible serving, tool-call parsing, thinking output handling, and model artifact conversion.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- inference-serving
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Guides future agents through MiniMind inference, OpenAI-compatible serving, tool-call parsing, thinking output handling, and model artifact conversion.
- disable-model-invocation
- true
02 资源文件 7
- 参考文档references/api-and-serving.md10.0 KB
- 参考文档references/cli-reference.md12.3 KB
- 参考文档references/troubleshooting.md10.4 KB
- 参考文档references/workflows.md10.2 KB
- 脚本scripts/check_model_artifacts.py19.3 KB
- 脚本scripts/openai_chat_once.py10.9 KB
- 脚本scripts/toolcall_smoke.py15.1 KB
03 SKILL.md 正文
MiniMind Inference & Serving Router
Use this sub-skill when the task is about using an already-trained MiniMind model for inference, local serving, API probing, tool-call parsing, thinking-output handling, WebUI constraints, or artifact conversion/export for third-party inference engines.
Fast routing
- Identify the artifact format first:
- Transformers-format directory: portable serving path; expected to contain
config.json, tokenizer files, and.safetensorsor.binweights. Prefer this for OpenAI-compatible serving and third-party engines. - Raw MiniMind PyTorch weight: a
.pthcheckpoint named by weight stage, hidden size, and optional MoE suffix. It also needs the MiniMind model Python modules and tokenizer at runtime, so convert/export it when portability matters. - Raw base + LoRA weight: useful for local raw inference; merge LoRA into a full raw checkpoint before portable Transformers export or third-party serving.
- Transformers-format directory: portable serving path; expected to contain
- Choose the reference:
- workflows.md: end-to-end decisions for CLI inference, serving, tool loops, WebUI, conversion, and third-party engines.
- cli-reference.md: artifact checks, local inference parameters, raw-vs-Transformers loading rules, LoRA decisions, and conversion command templates.
- api-and-serving.md:
/v1/chat/completionsrequest/response fields, streaming behavior, thinking fields, tool-call schema, and one-shot client usage. - troubleshooting.md: diagnosis matrix for missing artifacts, dependency gaps, device errors, malformed tool JSON, chat-template mismatches, and thinking/tool instability.
- Use bundled helpers instead of reopening source scripts:
- scripts/check_model_artifacts.py: classify and validate raw/Transformers model artifacts and print safe conversion plans.
- scripts/toolcall_smoke.py: parse MiniMind
<think>and<tool_call>text, normalize OpenAI-style tool calls, and execute deterministic mock tools. - scripts/openai_chat_once.py: send one non-interactive OpenAI-compatible chat request, with optional streaming, thinking, and tools.
Scope boundaries
This sub-skill covers inference and serving only. Route tokenizer training, pretraining, SFT, LoRA training data/setup, and training-time tokenizer template work to training-basics. Route DPO, PPO, GRPO, CISPO, Agentic RL training, rollout engines, and reward design to rlhf-agentic.
It may mention LoRA only to decide whether to stack a LoRA at raw inference time or merge/export it for serving. It does not explain how to train a LoRA.
Minimum safe procedure
For any serving or conversion task:
- Run the artifact checker in dry-inspection mode against the user-provided model path.
- Prefer a Transformers-format directory for serving. If only raw
.pthweights exist, plan a conversion before using vLLM, llama.cpp, Ollama, or similar engines. - Verify the tokenizer has a chat template with
<think>,<tool_call>, and<tool_response>behavior before enabling thinking or tools. - Probe the API with the bundled one-shot client before wiring a UI or external orchestrator.
- Use the bundled tool-call smoke helper to debug parser behavior before blaming the model.
Verification candidates for later
Do not treat these as already run by this sub-skill draft. Recommended later checks are:
- Parse and execute deterministic mock tool calls with
scripts/toolcall_smoke.py, including malformed JSON and multiple tool calls. - Smoke the serving parser behavior on text containing complete
<think>...</think>, dangling</think>, valid<tool_call>, and invalid<tool_call>JSON. - Import Qwen3/Qwen3MoE classes from Transformers before Qwen3-compatible export.
- Run a tiny local generate or API completion only when real model weights are available and the backend/device is explicitly selected.
04 同仓库更多 Skills
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.
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.
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.
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.
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.
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).