inference-and-serving
Use this sub-skill for LlamaFactory inference, ChatModel usage, chat/webchat/api commands, OpenAI-compatible serving, backend selection, streaming, score evaluation, API auth, and batch vLLM prediction workflows.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- inference-and-serving
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use this sub-skill for LlamaFactory inference, ChatModel usage, chat/webchat/api commands, OpenAI-compatible serving, backend selection, streaming, score evaluation, API auth, and batch vLLM prediction workflows.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/backend-selection.md6.3 KB
- 参考文档references/chat-and-api.md6.5 KB
- 参考文档references/troubleshooting.md5.9 KB
- 脚本scripts/openai_api_smoke.py5.9 KB
- 脚本scripts/vllm_batch_infer.py7.1 KB
03 SKILL.md 正文
Inference and Serving
Use this sub-skill when an agent needs to run or debug LlamaFactory inference and serving flows for version 0.9.6.dev0 source behavior.
Route Here For
- Using
ChatModelfrom Python forchat,stream_chat,get_scores, and their async variants. - Launching
llamafactory-cli chat,lmf chat,llamafactory-cli webchat,llamafactory-cli api, orlmf api. - Calling the OpenAI-compatible FastAPI server endpoints
/v1/models,/v1/chat/completions, and/v1/score/evaluation. - Choosing
infer_backend: huggingface,infer_backend: vllm, orinfer_backend: sglangfor inference configs. - Diagnosing streaming SSE, API key, score-vs-chat endpoint, and missing backend package failures.
- Planning safe batch prediction with vLLM and optional BLEU/ROUGE-style metric output.
Boundaries
- Route model, tokenizer, quantization, adapter merge, and export failures to the
model-loading-and-exportsub-skill. - Route template, prompt formatting, multimodal placeholder, dataset, and preprocessing issues to
data-and-templatesunless the failure is specific to API request payload handling. - Route non-API LlamaBoard/Web UI install, browser, port, and operational issues to
webui-and-ops. - Keep runtime instructions self-contained; do not depend on repository checkout scripts or examples.
Fast Path
- Pick an inference config YAML with
model_name_or_path,template, andinfer_backend; the default architecture is v0 unlessUSE_V1=1is explicitly set. - For local interactive testing, run
llamafactory-cli chat CONFIG.yamlorlmf chat CONFIG.yaml. - For OpenAI-compatible serving, run
API_PORT=8000 llamafactory-cli api CONFIG.yamland callhttp://HOST:PORT/v1/...endpoints. - Use
API_KEYonly when bearer-token auth is desired; clients must sendAuthorization: Bearer $API_KEYwhen it is set. - Prefer
infer_backend: huggingfacefor broad compatibility and score evaluation; usevllmorsglangfor faster generation when those optional packages and GPU resources are available.
Bundled References
references/chat-and-api.mdcoversChatModel, CLI commands, API routes, request shapes, streaming, auth, env vars, and native verification candidates.references/backend-selection.mdcompares Hugging Face, vLLM, and SGLang inference backends and includes batch vLLM metric flow notes.references/troubleshooting.mdmaps common serving failures to likely causes and fixes.
Bundled Scripts
scripts/openai_api_smoke.pyis a standalone OpenAI-compatible smoke client for model listing, chat, optional streaming, optional score evaluation, and API-key verification.scripts/vllm_batch_infer.pyis a safe wrapper that prints or optionally runs a LlamaFactory batch vLLM command only when the caller supplies concrete model/config arguments.
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).