--- license: other license_name: source-repo-licenses license_link: https://huggingface.co/datasets/codeparrot/codeparrot-clean language: - code task_categories: - text-generation tags: - python - code - pretraining size_categories: - 1M` (PII mitigation). 6. **Length band** — files shorter than 100 characters or longer than 20,000 characters are dropped whole (never truncated). 7. **Exact deduplication** — SHA-256 hash of the cleaned content; duplicates dropped at collection time. The full cleaning script is released in the PocketCoder GitHub repository. ## Measured corpus statistics Audited on a 5,000-document streamed sample (audit notebook and the resulting `corpus_quality_report.json` are released alongside the code): | Metric | Value | |---|---| | Total documents | 1,800,000 | | Total tokens (DeepSeek-Coder tokenizer) | ~2,955,981,351 | | Natural-language content (chars) | 16.0% (7.8% comments, 8.2% docstrings) | | Unique documents (exact hash) | 100.0% | | Unique documents (near, comments/whitespace stripped) | 99.9% | | Syntactic validity (`ast.parse`, Python 3) | 85.6%* | | Docstring coverage (functions) | 26.4% | | Mean function complexity (control-flow branches +1) | 2.31 | | Document length median / mean / p95 (chars) | 3,569 / 5,170 / 14,977 | \*Parse failures under Python 3 predominantly reflect legacy Python 2 syntax present in the upstream GitHub-derived corpus (e.g. `print` statements), not corrupted files; documents are dropped whole rather than truncated, so no file is cut mid-statement. ## Format One field per example: ```python {"content": ""} ``` ## Usage ```python from datasets import load_dataset ds = load_dataset("Ananda100/python-clean-codeparrot", split="train", streaming=True) for example in ds: print(example["content"][:200]) break ``` ## Intended use & limitations Built for pretraining small code language models. Natural language appears only as annotation embedded in code (comments/docstrings), never as standalone problem-to-solution instruction — models pretrained on this corpus alone will not follow natural-language instructions without subsequent instruction tuning (measured in the PocketCoder paper: 0.0% MBPP pass@1 before SFT, 8.6% after). ## Licensing Derived from `codeparrot/codeparrot-clean`, which aggregates public GitHub Python files under their original licenses. Use of this derived corpus is subject to the licenses of the underlying source files; see the upstream dataset card for details. ## Citation ```bibtex @misc{rimal2026pocketcoder, title = {PocketCoder: What Distillation, SFT, and DPO Each Buy You at 100M Parameters}, author = {Rimal, Ananda}, year = {2026}, url = {https://github.com/AnandaRimal/PocketCoder} } ```