Add config-driven corpus normalizer for base datasets - #1
Merged
Conversation
S1 (Data & Bench) Week-1 deliverable. Normalizes Hugging Face corpora into the canonical Sample schema as JSONL, so every downstream module consumes one format. - src/ingestion/normalize_corpora.py: pure _normalize_rows() core reusing the existing normalize_record()/write_jsonl(); skips blank rows (WikiText is full of them), marks rows as the clean human baseline (source=human, generation=0), and derives ids from the source row index so re-runs are reproducible. `datasets` and `yaml` are imported lazily, keeping the module importable offline. - configs/corpora.yaml: WikiText-2 (all splits) + TinyStories (capped slice). - tests/test_normalize_corpora.py: 7 offline tests (blank skipping, provenance defaults, deterministic ids, row cap, custom text field, split validation). - requirements.txt: add pyyaml. Run: python -m src.ingestion.normalize_corpora --config configs/corpora.yaml
This was referenced Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What (S1 — Data & Bench, Week 1)
Normalizes base corpora into the canonical
Sampleschema as JSONL — the data foundation S2's feature suite and S3's fine-tune grid both consume.src/ingestion/normalize_corpora.py— pure_normalize_rows()core that reuses the existingnormalize_record()/write_jsonl()rather than duplicating validation. Skips blank rows (WikiText is full of them), stamps the clean human baseline (source=human,generation=0), and derives ids from the source row index so re-runs are byte-identical.datasets/yamlare imported lazily, so the module and its tests load offline.configs/corpora.yaml— WikiText-2 (train/validation/test) + TinyStories (capped slice). Config-driven, no magic numbers.tests/test_normalize_corpora.py— 7 offline tests.requirements.txt— addpyyaml.Verification
pytest -q→ 17 passed (10 existing + 7 new)python -m src.ingestion.normalize_corpora --help→ CLI wiredTo produce the actual data (not committed —
data/is gitignored):Review note
Requesting one teammate approval per the Definition of Done. Worth a look at the id scheme: ids key on the source row index, so skipped blank rows leave intentional gaps (0, 2, 5...) — this keeps ids stable if filtering rules ever change.