Skip to content
Back to skills

Training Data

ASecurity

"Guides RWKV-LM data preparation, RWKV-5/6/7 training command

  • 247 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 9, 2026
toolsgotestingbackend

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill training-data --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Training Data?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Training Data
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-training-data-d4c1485a/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-training-data-d4c1485a)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: training-data
description: "Guides RWKV-LM data preparation, RWKV-5/6/7 training command
  construction, checkpoint resume behavior, and training-backend
  troubleshooting."
disable-model-invocation: true
metadata:
  disco-role: operating
license: Apache 2.0
---

# 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](references/data-formats.md),
  run the bundled JSONL converter, then run the bundled magic-prime checker.
- **Train RWKV-7**: read [training-workflows.md](references/training-workflows.md)
  before constructing a command. RWKV-7 `train_temp` is the current reference
  implementation; do not mix its flags with the older v5/v6 launcher.
- **Train RWKV-5/6**: read [v5-v6-compatibility.md](references/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](references/troubleshooting.md)
  and inspect checkpoint names and `train_log.txt` before changing flags.

## Safe preparation sequence

1. Confirm the tokenizer family, vocabulary size, data prefix, total token count,
   context length, model family, and target backend.
2. 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.
3. Verify that the output has matching `.bin` and `.idx` files and that each
   document ends with token `0` when using the RWKV v20230424 tokenizer.
4. Compute a `magic_prime` for the exact token count and `ctx_len`; do not copy
   a value from a different context length. The candidate must be prime and
   congruent to `2 mod 3`.
5. Construct an initialization command (`train_stage`/`my_pile_stage` 1) and
   a separate resume command (stage 2/3). Use a fresh `proj_dir` for the first
   run and save the complete command in the run directory.
6. 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`, and `my_exit_tokens` consistent with one data
  prefix. The trainer uses mini-epochs of `40320 * ctx_len` tokens.
- Match `head_size`/`head_size_a` to 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=1` to reduce memory at the cost of speed. Tune `micro_bsz` and
  `head_chunk` before 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 `.cu`
  extensions can compile. Check `CUDA_HOME`, `nvcc`, compiler ABI, and the
  selected torch CUDA tag separately.

## Bundled helpers

- [convert_jsonl_to_rwkv_binidx.py](scripts/convert_jsonl_to_rwkv_binidx.py)
  creates a new `.bin/.idx` pair from JSONL and validates the round trip.
- [compute_magic_prime.py](scripts/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`.

Files in this skill

  • SKILL.md4 KB
  • references/data-formats.md3.1 KB
  • references/training-workflows.md4 KB
  • references/troubleshooting.md3.2 KB
  • references/v5-v6-compatibility.md2 KB
  • scripts/compute_magic_prime.py3 KB
  • scripts/convert_jsonl_to_rwkv_binidx.py7.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.