Datasets:
|
Download SCHEMA.md from vecnode/supercollider-moe-dataset: direct link, hf CLI and curl.
- Browser
- Download file 6.71 kB
-
https://huggingface.co/datasets/vecnode/supercollider-moe-dataset/resolve/main/SCHEMA.md
- Command line
-
hf download hf://datasets/vecnode/supercollider-moe-dataset/SCHEMA.md
-
curl -L -o SCHEMA.md https://huggingface.co/datasets/vecnode/supercollider-moe-dataset/resolve/main/SCHEMA.md
6.71 kB
| # SCHEMA v1 — record and artifact contracts | |
| Two different kinds of thing live in this folder: **records** (rich, intermediate) and **artifacts** | |
| (poor, exactly what the trainer reads). They are deliberately not the same schema: the trainer must never | |
| depend on a field that a future cleaning pass might stop producing. | |
| --- | |
| ## 1. Record — `10-extracted/*.jsonl`, `20-clean/*.jsonl` | |
| One JSON object per line. `schema` is bumped on any breaking change; a reader must refuse an unknown | |
| `schema` rather than guess. | |
| ```json | |
| { | |
| "schema": 1, | |
| "id": "supercollider:HelpSource/Classes/SinOsc.schelp", | |
| "source": "supercollider", | |
| "snapshot": "a1cbc78df43dfb48641fe9f290c0477e854b4459", | |
| "kind": "schelp", | |
| "path": "HelpSource/Classes/SinOsc.schelp", | |
| "title": "SinOsc", | |
| "class": "SinOsc", | |
| "categories": "UGens>Generators>Deterministic", | |
| "text": "SinOsc — Interpolating sine wavetable oscillator.\n\nCategory: UGens > Generators > Deterministic\n\n## ar, kr\n- freq: Frequency in Hertz.\n...\n```supercollider\n{ SinOsc.ar(200, 0, 0.5) }.play;\n```", | |
| "code": ["{ SinOsc.ar(200, 0, 0.5) }.play;", "{ SinOsc.ar(XLine.kr(2000, 200), 0, 0.5) }.play;"], | |
| "doc": { | |
| "summary": "Interpolating sine wavetable oscillator.", | |
| "description": "Generates a sine wave. Uses a wavetable lookup oscillator with linear interpolation. …", | |
| "methods": [ | |
| { | |
| "name": "ar, kr", | |
| "desc": "Sine oscillator at audio rate.", | |
| "args": [["freq", "Frequency in Hertz."], ["phase", "Phase in radians."], ["mul", "Output multiplier."], ["add", "Output offset."]], | |
| "returns": "a signal in the range [-mul, mul]" | |
| } | |
| ], | |
| "related": ["Osc", "FSinOsc", "PMOsc"] | |
| }, | |
| "meta": { | |
| "chars": 4820, | |
| "tokens": 2380, | |
| "has_code": true, | |
| "lang": "en", | |
| "licence": "GPL-3.0", | |
| "sha256": "…" | |
| } | |
| } | |
| ``` | |
| Rules: | |
| - `id` is stable across runs: `"<source>:<relative path>"` for files, `"<source>:<snippet id>"` for web | |
| sources. It is the join key everywhere downstream; a record with a different `id` is a different record. | |
| - `text` is **the renderable view** and always the thing the pretrain packer sees. It must be valid as | |
| plain text: no `.schelp` markup survives (`argument::`, `link::`, `code::` are all resolved). | |
| - `code` is a **list of verbatim code blocks**, in document order. Untouched by cleaning. This is what the | |
| SFT families C/D/E are built from, which is why they must never be fenced, escaped or reformatted. | |
| - `doc` is optional and only present for `kind` values that can be parsed structurally (`schelp`). SFT | |
| quality comes from here, not from regex over `text`. | |
| - `meta.tokens` is measured with **the model's tokenizer**, recorded so the packer can plan without | |
| re-tokenising everything. | |
| ## 2. Pretrain artifact — `30-corpus/pretrain_*.jsonl` | |
| Exactly one key. Nothing else, ever. | |
| ```json | |
| {"text": "…≤ 510 tokens of SuperCollider…"} | |
| ``` | |
| Invariants (checked by `scpipe verify`): | |
| | # | Invariant | Why | | |
| |---|---|---| | |
| | P1 | `tokens(text) ≤ seq_len - 2` for **every** line, using the same tokenizer the trainer loads | `PretrainDataset` truncates silently; P1 makes it a no-op | | |
| | P2 | no line is empty or under 40 tokens | stubs teach nothing and waste a step | | |
| | P3 | no `text` appears twice (exact, on normalised whitespace) | duplicated chunks are memorisation fuel | | |
| | P4 | no `.schelp` markup token survives (`argument::`, `link::`, `method::`, `code::`) | otherwise the model learns the docs' markup | | |
| | P5 | train/val are doc-disjoint (`val` ids ∩ `train` ids = ∅ at document level) | otherwise val loss measures repetition | | |
| ## 3. SFT artifact — `40-sft/sft_*.jsonl` | |
| Exactly the contract `SFTDataset` parses, and nothing more. | |
| ```json | |
| {"conversations": [{"role": "user", "content": "What does `SinOsc.ar` do? What arguments does it take?"}, | |
| {"role": "assistant", "content": "`SinOsc.ar` generates the oscillator at audio rate. Arguments: freq — Frequency in Hertz; …"}]} | |
| ``` | |
| `role` is only ever `user` or `assistant` (the dataset injects a system prompt for 20% of samples itself, | |
| and tool/thinking fields are out of scope for v1). | |
| Invariants (checked by `scpipe verify`): | |
| | # | Invariant | Why | | |
| |---|---|---| | |
| | S1 | `len(tokens(render(conversations))) ≤ sft_seq` | the loader truncates at this point | | |
| | S2 | `len(tokens(render(conversations[:-1], add_generation_prompt=True))) ≤ sft_seq - 24` | **the NaN guard**: if the prompt fills the window the answer is cut and the label mask is all `-100`, and `cross_entropy` over an empty target set returns NaN | | |
| | S3 | every assistant turn is 40–2,400 chars and non-empty after `.strip()` | | | |
| | S4 | no two records share the same first 200 chars of `content[0]` **and** the same first 200 of `content[-1]` | duplicate questions with different answers teach contradiction | | |
| | S5 | `val` records come from documents absent from `train` | same reasoning as P5 | | |
| | S6 | no `link::`, `argument::`, `method::`, `code::` in any `content` | markup leak | | |
| ## 4. Stage bookkeeping — `_SUCCESS` and `<stage>_stats.json` | |
| Every stage folder gets a `_SUCCESS` written **last**. Its presence means "this folder is internally | |
| consistent with these inputs": | |
| ```json | |
| { | |
| "stage": "pack", | |
| "schema": 1, | |
| "finished_at": "2026-11-20T20:41:07Z", | |
| "command": "python -m dataset.scpipe pack --seq 512", | |
| "inputs": [{"path": "20-clean/supercollider.jsonl", "bytes": 91234567, "sha256": "…"}], | |
| "config": {"seq_len": 512, "max_tokens": 510, "overlap": 32, "tokenizer": "model/tokenizer.json"}, | |
| "outputs": [{"path": "30-corpus/pretrain_train.jsonl", "lines": 8774, "sha256": "…"}], | |
| "counts": {"chunks": 8954, "tokens": 4127766, "max_tokens_per_chunk": 510, "docs_split": 1339}, | |
| "duration_s": 41.2, | |
| "git_commit": "cc9629e" | |
| } | |
| ``` | |
| A stage skips when every `inputs[].sha256` still matches and `config` matches the requested config; | |
| otherwise it refuses to run without `--force`. That is the whole of the reproducibility story: raw bytes + | |
| config + command + code commit. | |
| ## 5. Naming | |
| | Thing | Pattern | Example | | |
| |---|---|---| | |
| | raw snapshot | `00-raw/<source>/<sha-or-date>/` | `00-raw/supercollider/a1cbc78df43d…/` | | |
| | extracted | `10-extracted/<source>.jsonl` | `10-extracted/supercollider.jsonl` | | |
| | clean | `20-clean/<source>.jsonl` | `20-clean/supercollider.jsonl` | | |
| | pretrain | `30-corpus/pretrain_{train,val}.jsonl` | | | |
| | sft | `40-sft/sft_{pool,train,val}.jsonl` | | | |
| | logs | `90-logs/<stage>-<yyyymmdd-HHMMss>.jsonl` | `90-logs/pack-20261120-204107.jsonl` | | |
| No timestamps in artifact *file names* — only in logs and snapshots. An artifact's identity is its path | |
| plus its `_SUCCESS` hash, not the day it was built. | |