Skip to main content

data

Get a dataset into the right shape for a Halo training method, and pre-process it (tokenize / pack / shard) when worth it. USER-INVOKED ONLY. Use when the user asks "what format does SFT/DPO/GRPO/reward/embedding expect", "prepare/tokenize/pack/shard my dataset", "load from S3/HF Hub", "which collator", "padding-free / completions-only", or hits a data-loading error (wrong schema, embedding OOB at step 0, presharded re-shard, num_shards < DP).

소스 정보

저장소
whitecircle/halo
최근 소스 활동
2026년 9월 28일 21:59
감지된 SKILL.md 언어
영어
스타
816
포크
38

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

파일 탐색기
2 개 파일

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
data
description
Get a dataset into the right shape for a Halo training method, and pre-process it (tokenize / pack / shard) when worth it. USER-INVOKED ONLY. Use when the user asks "what format does SFT/DPO/GRPO/reward/embedding expect", "prepare/tokenize/pack/shard my dataset", "load from S3/HF Hub", "which collator", "padding-free / completions-only", or hits a data-loading error (wrong schema, embedding OOB at step 0, presharded re-shard, num_shards < DP).
disable-model-invocation
true
allowed-tools
["Read","Bash","Grep","Glob"]
# data — dataset formats, prep, loading & collators Pick the format for the method, decide whether to pre-process offline, and let the right collator get selected. Per-method schema detail, the `prepare_dataset.py` flags, and the footguns are in **`reference.md`** — read it before acting. Authoritative docs: `agent-docs/data/dataset-formats.md`, `agent-docs/data/dataset-preparation.md`, `agent-docs/data/collators.md`, `agent-docs/data/s3-utilities.md`, `agent-docs/data/filesystem-handling.md`. ## Format per method (messages are ChatML `{"role","content"}`) Required columns and types per method: `agent-docs/data/dataset-formats.md#required-columns-by-method` (its intro routes Async GRPO with Environments and distillation to their method pages); embedding reads its columns positionally (`agent-docs/training-methods/embedding.md#dataset-formats`). The default `conversation_field` is **method-dependent** — `"prompt"` (sft.py, self-distillation and `prepare_dataset.py --conversation-field`), `"messages"` (teacher distillation). Don't assume one value; check the script/config. Every config declares `max_length` natively; the YAML parser migrates no spelling, so TRL's retired `max_seq_length` raises the unknown-key error. ## Offline pre-processing (`scripts/before_training/prepare_dataset.py`) — SFT only Tokenize → optional pack → optional shard, written to `s3://` / `hf://org/name` / local. Worth it for large SFT corpora (pay tokenization+packing once; multi-node ranks load disjoint shards). The output carries `metadata.json` (`preprocessed: true`); a training config sets `dataset:` to that S3 or local path — **no flag needed**, `load_datasets_auto()` auto-detects and skips tokenization. A Hub-published output is refused as `dataset:`; download it and point at the directory. Sharded output also carries `shard_index.json`; the trainer computes `dataset_presharded` so the DataLoader does **not** re-shard. Key flags (read the argparse for the rest): `--mode {chat,text}`, `--pack-sequences` `--packing-strategy {bfd,bfd_split,wrapped}` (text SFT only, not VLM), `--num-shards N` (above 1: **must be ≥ data_parallel_size**, and needs a `test` split — `--test-size`), `--vlm`. Non-SFT methods are not supported by this script. Full flag list + the two distinct mechanisms (preprocessed vs presharded) in `reference.md`. ## Loading & collators (selected for you) - Sources (`src/data/sources/loading.py`): `s3://bucket/key`, `org/name[:config][@split]` (HF Hub), a local `load_from_disk` path, or a local `.jsonl/.json/.parquet/.arrow/.csv` file. Bare strings are local/HF — **not** auto-prefixed to any bucket. - Multi-node: `ShardedDatasetLoader` gives each DP rank its shards; `fs_aware_main_first(tag)` / `DIST_INPUT_SHARED_FILESYSTEM` (falling back to the `DIST_SHARED_FILESYSTEM` umbrella, default `"1"`) coordinate shared-NFS vs per-node-local downloads. - Collator routing (`src/data/collators/factory.py`, `select_data_collator`): picks completions-only / packing / padding-free (`cu_seq_lens`) from your YAML flags. Mutually-exclusive guards raise: packing+padding_free, CP+padding_free; `train_on_completions_only` needs `assistant_message_template`. Selection matrix in `reference.md`. ## Sources of truth The `agent-docs/data/` pages document the intended behavior — check them first. The code is the **ultimate** authority: when a doc, this skill, `reference.md`, or memory disagrees — or you are unsure — read the actual file (`src/data/sources/loading.py`, `src/data/pipeline/processing.py`, `src/data/sources/sharded_dataset.py`, `src/data/collators/factory.py`, `src/data/collators/`, `scripts/before_training/prepare_dataset.py`) before you assert or act. (`CLAUDE.md`: docs-first, but the code wins.)
GitHub에서 보기