inference-chat
Use LitGPT for local text generation, chat, and Python API inference from ready checkpoints, including prompt styles, sampling, quantization, and multi-device generation routes.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- inference-chat
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use LitGPT for local text generation, chat, and Python API inference from ready checkpoints, including prompt styles, sampling, quantization, and multi-device generation routes.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-reference.md7.5 KB
- 参考文档references/cli-reference.md7.4 KB
- 参考文档references/troubleshooting.md7.4 KB
- 参考文档references/workflows.md7.6 KB
- 脚本scripts/check_inference_inputs.py15.0 KB
03 SKILL.md 正文
LitGPT Inference And Chat
Use this sub-skill when the user wants to generate text locally with LitGPT, chat interactively, or write Python API inference code against a ready checkpoint. It covers litgpt generate, litgpt chat, specialized generation commands, and litgpt.LLM / litgpt.api.LLM workflows.
Route First
- Use this sub-skill for local generation, chat REPLs, API
LLM.load,LLM.generate,LLM.distribute, prompt-style selection, sampling settings, quantization for inference, and sequential/tensor-parallel generation. - Route checkpoint download, HF conversion, LitGPT checkpoint validation,
model_config.yaml, tokenizer placement, and LoRA merge planning to../checkpoint-conversion/before generation. - Route finetuning/pretraining output creation and adapter checkpoint ownership to
../training-data/; return here only to generate from the produced weights. - Route HTTP APIs, LitServe, OpenAI-compatible serving, and LM Evaluation Harness tasks to
../evaluation-serving/.
Fast Start
-
Confirm the checkpoint is already local and LitGPT-formatted, or route to
../checkpoint-conversion/. -
Run the bundled preflight before loading weights:
python sub-skills/inference-chat/scripts/check_inference_inputs.py \ --checkpoint-dir checkpoints/example-model \ --prompt "What food do llamas eat?" \ --max-new-tokens 50 \ --top-k 50 \ --top-p 1.0 \ --temperature 0.8 -
For one-shot local text generation, use
litgpt generate CHECKPOINT_DIR --prompt "...". -
For interactive local chat, use
litgpt chat CHECKPOINT_DIR; add--multiline truefor multi-line user prompts. -
For Python code, prefer local paths for offline work:
from litgpt import LLM llm = LLM.load("checkpoints/example-model") text = llm.generate("What do llamas eat?", max_new_tokens=80, top_k=1) print(text)
References
references/cli-reference.md: command matrix forgenerate,chat, adapter/full generation, sequential, speculative, and tensor-parallel routes.references/api-reference.md: Python API signatures, offline loading patterns, streaming, benchmarking, and distribution strategies.references/workflows.md: end-to-end local, chat, prompt-style, quantized, adapter, and multi-device workflows.references/troubleshooting.md: common failures for checkpoint layout, sampling, tokenizer/prompt styles, quantization, hardware, LoRA/adapters, and accidental network access.
Safety Notes
- The bundled checker never loads model weights, downloads checkpoints, starts servers, trains models, or writes outside normal Python bytecode caches.
LLM.load(model_name, init="pretrained")may download ifmodel_nameis not a local checkpoint path. For offline operation, use an existing local checkpoint path or passinit="random"with an explicit localtokenizer_dironly when random weights are intentional.bnb.*inference quantization requires the optionalbitsandbytespackage and CUDA/Linux-compatible runtime; do not assume it works in CPU-only environments.
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).