training-data
Guides RWKV-LM data preparation, RWKV-5/6/7 training command construction, checkpoint resume behavior, and training-backend troubleshooting.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- training-data
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Guides RWKV-LM data preparation, RWKV-5/6/7 training command construction, checkpoint resume behavior, and training-backend troubleshooting.
- disable-model-invocation
- true
02 资源文件 6
- 参考文档references/data-formats.md3.1 KB
- 参考文档references/training-workflows.md4.0 KB
- 参考文档references/troubleshooting.md3.2 KB
- 参考文档references/v5-v6-compatibility.md2.0 KB
- 脚本scripts/compute_magic_prime.py3.0 KB
- 脚本scripts/convert_jsonl_to_rwkv_binidx.py7.2 KB
03 SKILL.md 正文
RWKV training and data
Use this route when the request mentions RWKV-5, RWKV-6, RWKV-7, MiniPile,
Pile/binidx data, make_data, magic_prime, my_exit_tokens, train_stage,
my_testing, DeepSpeed, Lightning, checkpoint resume, or training spikes.
Route by task
- Prepare a corpus: read data-formats.md, run the bundled JSONL converter, then run the bundled magic-prime checker.
- Train RWKV-7: read training-workflows.md
before constructing a command. RWKV-7
train_tempis the current reference implementation; do not mix its flags with the older v5/v6 launcher. - Train RWKV-5/6: read v5-v6-compatibility.md.
RWKV-6 is selected through the RWKV-5 training tree with
--my_testing x060. - Resume or debug a run: read troubleshooting.md
and inspect checkpoint names and
train_log.txtbefore changing flags.
Safe preparation sequence
- Confirm the tokenizer family, vocabulary size, data prefix, total token count, context length, model family, and target backend.
- Convert JSONL only into a new output prefix. Keep the source JSONL unchanged and never use a training launcher that deletes checkpoints as a first step.
- Verify that the output has matching
.binand.idxfiles and that each document ends with token0when using the RWKV v20230424 tokenizer. - Compute a
magic_primefor the exact token count andctx_len; do not copy a value from a different context length. The candidate must be prime and congruent to2 mod 3. - Construct an initialization command (
train_stage/my_pile_stage1) and a separate resume command (stage 2/3). Use a freshproj_dirfor the first run and save the complete command in the run directory. - Perform a parser/help check and a tiny data-layout check before allocating GPU time. Full training is long-running and requires the checkout's matching CUDA extension sources, toolkit, and data files.
Non-negotiable training rules
- Keep
ctx_len,magic_prime, andmy_exit_tokensconsistent with one data prefix. The trainer uses mini-epochs of40320 * ctx_lentokens. - Match
head_size/head_size_ato the model family. RWKV-7 reference code expects a head size of 64 for the standard x070 LM configuration. - RWKV-7 has carefully chosen initialization, parameter-specific learning-rate scales, and weight-decay groups. Do not simplify the optimizer grouping and assume the same loss curve.
- Set
grad_cp=1to reduce memory at the cost of speed. Tunemicro_bszandhead_chunkbefore changing architecture flags. - A checkpoint directory is stateful: stage-2/3 code searches for the latest
rwkv-*.pth. Remove or move stale files only after recording a backup and confirming the intended resume point. - CUDA torch availability is not proof that the repository's custom
.cuextensions can compile. CheckCUDA_HOME,nvcc, compiler ABI, and the selected torch CUDA tag separately.
Bundled helpers
- convert_jsonl_to_rwkv_binidx.py
creates a new
.bin/.idxpair from JSONL and validates the round trip. - compute_magic_prime.py reads a binidx
prefix or an explicit token count and prints the largest valid prime below
token_count // ctx_len - 1.
These helpers are adapted from the repository's data utilities and do not require the original checkout's hard-coded paths.
Handoff
After data and command construction, route model generation or prompt sampling
to inference-evaluation. Route tensor names, checkpoint conversion, or
context-parallel state questions to architecture-reference. Route ROSA
experiments to rosa-experiments.
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).