技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
train-llm-from-scratch【数据与研究】Route train-llm-from-scratch workflows for from-scratch PyTorch LLM pretraining, SFT, reward modeling, DPO/ORPO/KTO, PPO, GRPO/RLVR, evaluation, chat, configs, UI, and data validation.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this repo skill when a task involves the train-llm-from-scratch project: a
pure-PyTorch educational LLM stack covering raw text tokenization, decoder-only
Transformer pretraining, SFT, reward modeling, DPO/ORPO/KTO, PPO, GRPO/RLVR,
GSM8K evaluation, chat, JSON configs, and a Streamlit control panel.
references/repo-provenance.md.references/installation.md.scripts/check_environment.py when you
need a safe import/backend smoke check in the user's environment.scripts/inspect_checkpoint.py before
loading the model.| User task | Read |
|---|---|
| Prepare or validate Pile HDF5, packed SFT HDF5, preference JSONL, RL prompt JSONL, arithmetic curriculum, tokenizer/mask/data-loader issues | sub-skills/data-preparation/SKILL.md |
| Inspect the custom Transformer, plan base pretraining, choose legacy vs modern pretraining, DDP/bf16, memory, checkpoint/resume, tiny model smoke | sub-skills/model-pretraining/SKILL.md |
| Run or debug SFT, reward model, DPO/ORPO/KTO, PPO, GRPO/RLVR, rollout/log-probs, KL/reward metrics, post-training pipeline sequencing | sub-skills/post-training-rlhf/SKILL.md |
| Evaluate on GSM8K, build stage tables, chat with checkpoints, choose raw vs chat mode, sampling controls, answer parsing/verifier behavior | sub-skills/evaluation-chat/SKILL.md |
| Edit JSON configs, use smoke configs, inspect CLI override precedence, operate the Streamlit UI, inspect metrics JSONL/job logs | sub-skills/configuration-ui/SKILL.md |
The package metadata exposes import roots config, data_loader, src, and
ui. A typical editable install from a compatible checkout is:
pip install -e .
pip install -e ".[train]" # datasets + optional wandb for data/post-training
pip install -e ".[ui]" # streamlit + pandas + altair for the control panel
pip install -e ".[docs]" # mkdocs tooling, only for docs-site work
For the selected training workflows, use a PyTorch build that matches the machine. Full training is CUDA-oriented; CPU smoke configs are useful for parser, config, and algorithm checks but do not verify large CUDA/bf16/DDP training.
Minimal import smoke:
python - <<'PY'
from src.models.transformer import Transformer
from src.post_training.chat_template import encode_chat, EOT_ID
ids, mask = encode_chat([
{"role": "user", "content": "What is 2+2?"},
{"role": "assistant", "content": "<answer>4</answer>"},
])
print(len(ids), len(mask), sum(mask), ids[-1] == EOT_ID)
print(Transformer(n_head=2, n_embed=16, context_length=8, vocab_size=64, N_BLOCKS=1).__class__.__name__)
PY
/ephemeral-style paths in examples as user-configurable storage roots,
not mandatory constants.Read references/troubleshooting.md for
cross-cutting install/import/backend/checkpoint routing. Workflow-specific
failures live in each sub-skill's nearest references/troubleshooting.md.