baichuan-7b
Operate Baichuan-7B model loading, architecture inspection, C-Eval/MMLU evaluation preflights, and DeepSpeed pretraining setup from self-contained repo guidance.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- baichuan-7b
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Operate Baichuan-7B model loading, architecture inspection, C-Eval/MMLU evaluation preflights, and DeepSpeed pretraining setup from self-contained repo guidance.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md5.7 KB
- 参考文档references/repo-provenance.md2.6 KB
- 参考文档references/repo-routing-metadata.json565 B
- 参考文档references/troubleshooting.md5.3 KB
03 SKILL.md 正文
Baichuan-7B Repo Skill
Use this skill when a task involves the Baichuan-7B repository, its custom Transformers model code, official Hugging Face loading pattern, C-Eval/MMLU benchmark scripts, or DeepSpeed pretraining demo. The skill is self-contained for operating decisions; do not reopen the original README or source scripts unless the user's active task is explicitly to edit a checkout.
Route by task
| User intent | Read | Why |
|---|---|---|
Load Baichuan-7B, inspect BaiChuanConfig, debug generation/cache behavior, or run a tiny architecture smoke |
architecture-and-loading | Owns model classes, config defaults, trust_remote_code loading, and safe local-source checks. |
| Prepare C-Eval or MMLU evaluation, validate benchmark layout, render commands, or interpret output files | evaluation-workflows | Owns Chinese/English benchmark preflights, dataset layout, output artifacts, and benchmark-specific failures. |
Prepare pretraining data, validate tokenizer.model, DeepSpeed JSON/hostfile, render launch commands, or explain checkpoints |
pretraining-and-deepspeed | Owns corpus sharding, tokenizer placement, DeepSpeed setup, and safe training dry-runs. |
| Check class signatures, dependency surfaces, or source-derived architecture facts shared across workflows | API reference | Summarizes verified public classes, signatures, model dimensions, and script surfaces. |
| Diagnose install/import/backend/model-weight problems before choosing a sub-skill | troubleshooting | Covers cross-cutting dependency pins, CUDA/xFormers, model assets, datasets, and training resource boundaries. |
| Decide whether this skill is stale for a checkout | repo provenance | Records the commit, dirty state, dependency pins, and evidence paths used to create this skill. |
Operating assumptions
- Baichuan-7B is a decoder-only 7B causal language model for Chinese and English with a 4096-token training context, 64k vocabulary, RMSNorm, SwiGLU MLP, rotary embeddings, and LLaMA-like design choices.
- The repository has no
setup.pyorpyproject.tomlpackage metadata in this snapshot. Local source checks therefore use a Baichuan checkout path or a compatible model directory rather than a pip distribution import. - The official README loading path uses
AutoTokenizer.from_pretrained(..., trust_remote_code=True)andAutoModelForCausalLM.from_pretrained(..., device_map="auto", trust_remote_code=True). - Full 7B generation, benchmark scoring, and DeepSpeed training require model weights/tokenizer files, CUDA-capable runtime, and task-specific data. The bundled helpers are safe preflight/smoke tools and do not download weights, fetch datasets, or launch training by default.
- Code is Apache-2.0 licensed. Model weights have a separate Baichuan model license; check the model source before commercial or redistribution decisions.
Setup checklist for a later runtime
- Choose the workflow route above before installing optional packages.
- Install the repo-documented stack when feasible:
deepspeed==0.9.2,numpy==1.23.5,sentencepiece==0.1.97,torch==2.0.0,transformers==4.29.1, andxformers==0.0.20. If newer CUDA/Torch wheels are required, treat compatibility as a runtime decision and run the safe checks again. - For architecture-only checks, run the tiny smoke from the architecture sub-skill; it needs no official weights or datasets.
- For real inference or evaluation, ensure the model identifier or local model directory contains compatible weights, config, tokenizer assets, and trusted remote-code files.
- For benchmark runs, validate C-Eval or MMLU prerequisites with the evaluation preflight helper before loading the model.
- For pretraining, validate corpus shards,
tokenizer.model, DeepSpeed config, hostfile, and checkpoint path before rendering or launching any command.
Safe first checks
Architecture-only smoke against an active Baichuan-style checkout:
python sub-skills/architecture-and-loading/scripts/local_model_smoke.py --repo-root /path/to/Baichuan-7B
Benchmark preflight without executing inference:
python sub-skills/evaluation-workflows/scripts/check_evaluation_inputs.py ceval --model /path/to/model --shot 5 --split val
Training preflight without launching DeepSpeed:
python sub-skills/pretraining-and-deepspeed/scripts/validate_training_inputs.py \
--data-dir /path/to/data_dir \
--tokenizer-path /path/to/tokenizer.model \
--deepspeed-config /path/to/deepspeed.json \
--hostfile /path/to/hostfile
Stop conditions
Stop and ask for explicit user resources before:
- downloading official weights, benchmark datasets, or external benchmark checkouts;
- running full C-Eval/MMLU inference;
- launching DeepSpeed or distributed training;
- changing pinned package versions in a user-owned environment;
- accepting unverified CUDA/DeepSpeed behavior as a completed benchmark or training result.
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).