baichuan2
Route Baichuan2 chat inference, deployment/quantization, and fine-tuning workflows.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- baichuan2
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Route Baichuan2 chat inference, deployment/quantization, and fine-tuning workflows.
- disable-model-invocation
- true
02 资源文件 7
- 参考文档references/installation.md2.9 KB
- 许可证references/license-and-citation.md1.4 KB
- 参考文档references/model-overview.md2.5 KB
- 参考文档references/repo-provenance.md1.4 KB
- 参考文档references/repo-routing-metadata.json453 B
- 参考文档references/troubleshooting.md3.1 KB
- 脚本scripts/check_baichuan2_env.py6.5 KB
03 SKILL.md 正文
Baichuan2
Use this repo skill when a task is about Baichuan2 model selection, chat/base inference, local chat demos, OpenAI-compatible serving, quantized deployment, CPU deployment, checkpoint conversion, or supervised fine-tuning.
Baichuan2 is a model-family repository rather than an importable Python package. The operating guidance is therefore organized around public workflows and bundled helpers, not a package module tree.
Start here
- If the task may depend on repo freshness, read
references/repo-provenance.md. - If the user has not chosen a checkpoint, read
references/model-overview.md. - Prepare the smallest environment for the requested workflow using
references/installation.md. - Run a no-weight dependency check before loading 7B/13B weights:
python scripts/check_baichuan2_env.py --workflow inference
python scripts/check_baichuan2_env.py --workflow all --require-cuda
Use --workflow inference, deployment, fine-tuning, or all to match the route. These checks do not download model weights.
Route by user request
| User request signals | Read | Why |
|---|---|---|
model.chat, Python inference, Base-model generation, terminal demo, Streamlit web UI, OpenAI-compatible /v1/chat/completions |
sub-skills/inference/SKILL.md |
Owns Baichuan2 Chat/Base inference, CLI/web demos, and the Flask chat-completions helper. |
4-bit/8-bit quantization, BitsAndBytes, CPU-only loading, load_in_8bit, quantize(4), lm_head.weight, Baichuan1 optimization migration |
sub-skills/deployment/SKILL.md |
Owns memory-reduction, CPU deployment, and checkpoint-conversion workflows. |
supervised fine-tuning, DeepSpeed, LoRA, fine-tune.py, hostfile, W_pack, ds_config, training data schema |
sub-skills/fine-tuning/SKILL.md |
Owns SFT data validation, ZeRO-3 launch planning, LoRA, and post-training loading. |
| installation/import/backend failure before a route is clear | references/troubleshooting.md |
Covers shared CUDA, dependency, model-access, and optional-extra problems. |
| license, commercial-use constraints, or citation | references/license-and-citation.md |
Distills the repo's license/citation section. |
Core operating facts
- Released model ids include
baichuan-inc/Baichuan2-7B-Base,baichuan-inc/Baichuan2-7B-Chat,baichuan-inc/Baichuan2-13B-Base,baichuan-inc/Baichuan2-13B-Chat, and published 4-bit Chat variants. - Chat checkpoints expose
model.chat(tokenizer, messages)through Hugging Facetrust_remote_code=True. Base checkpoints usemodel.generate(...)instead. - The repository demos are GPU-oriented by default. CPU loading is a separate float32 deployment branch and is expected to be slow.
- Quantization and training are CUDA-sensitive. Do not use a CPU import check as proof that those workflows work.
- The bundled scripts intentionally include
--help,--dry-run, or validation modes so future agents can inspect plans without downloading large weights.
Do not do this
- Do not tell the user to open or run original checkout scripts; use the bundled helpers and references in this skill.
- Do not force Base checkpoints through Chat-only CLI/web/API wrappers.
- Do not add
device_map="auto"to online quantization; the deployment sub-skill explains why. - Do not launch DeepSpeed training until the data validator and dry-run plan pass.
- Do not import this skill into live repo-skill storage unless a later verification/import workflow is explicitly approved. This construction run was requested as not import.
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).