Ananda100 commited on
Commit
231dd9a
·
verified ·
1 Parent(s): bcf5b98

update readme

Browse files
Files changed (1) hide show
  1. README.md +116 -15
README.md CHANGED
@@ -1,17 +1,118 @@
1
  ---
2
- dataset_info:
3
- features:
4
- - name: content
5
- dtype: string
6
- splits:
7
- - name: train
8
- num_bytes: 9265066612
9
- num_examples: 1800000
10
- download_size: 3616457452
11
- dataset_size: 9265066612
12
- configs:
13
- - config_name: default
14
- data_files:
15
- - split: train
16
- path: data/train-*
17
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: other
3
+ license_name: source-repo-licenses
4
+ license_link: https://huggingface.co/datasets/codeparrot/codeparrot-clean
5
+ language:
6
+ - code
7
+ task_categories:
8
+ - text-generation
9
+ tags:
10
+ - python
11
+ - code
12
+ - pretraining
13
+ size_categories:
14
+ - 1M<n<10M
 
 
15
  ---
16
+
17
+ # python-clean-codeparrot
18
+
19
+ A cleaned, deduplicated, Python-only pretraining corpus derived from
20
+ [`codeparrot/codeparrot-clean`](https://huggingface.co/datasets/codeparrot/codeparrot-clean),
21
+ built as the pretraining data for **PocketCoder**, a 95.87M-parameter decoder-only
22
+ code language model. Total: **~2.96 billion tokens** (DeepSeek-Coder tokenizer,
23
+ vocabulary 32,022).
24
+
25
+ - **Paper:** *PocketCoder: What Distillation, SFT, and DPO Each Buy You at 100M Parameters*
26
+ - **Model:** [`Ananda100/PocketCoder`](https://huggingface.co/Ananda100/PocketCoder)
27
+ - **Code:** [github.com/AnandaRimal/PocketCoder](https://github.com/AnandaRimal/PocketCoder)
28
+
29
+ ## Cleaning pipeline
30
+
31
+ Applied on top of `codeparrot-clean` (which is itself deduplicated), streaming
32
+ file-by-file:
33
+
34
+ 1. **Drop autogenerated/vendored files** — files flagged `autogenerated` by the
35
+ upstream dataset, plus regex matches for SWIG output, protocol-buffer compiler
36
+ output, Cython output, "do not edit"/"this file was generated" markers, and
37
+ similar machine-produced code.
38
+ 2. **Strip license headers** — leading `#`-comment blocks containing
39
+ copyright/license keywords (up to the first 80 lines).
40
+ 3. **Strip non-Python metadata blobs** — Ansible-style
41
+ `DOCUMENTATION` / `EXAMPLES` / `RETURN` / `ANSIBLE_METADATA` triple-quoted
42
+ assignments.
43
+ 4. **Strip boilerplate comment lines** — `# Filename:`, `# Author:`,
44
+ `# Created:`, `# Version:`, `# Date:`, `# Maintainer:` lines. Real docstrings
45
+ are left untouched.
46
+ 5. **Redact email addresses** — all email addresses replaced with `<EMAIL>`
47
+ (PII mitigation).
48
+ 6. **Length band** — files shorter than 100 characters or longer than 20,000
49
+ characters are dropped whole (never truncated).
50
+ 7. **Exact deduplication** — SHA-256 hash of the cleaned content; duplicates
51
+ dropped at collection time.
52
+
53
+ The full cleaning script is released in the PocketCoder GitHub repository.
54
+
55
+ ## Measured corpus statistics
56
+
57
+ Audited on a 5,000-document streamed sample (audit notebook and the resulting
58
+ `corpus_quality_report.json` are released alongside the code):
59
+
60
+ | Metric | Value |
61
+ |---|---|
62
+ | Natural-language content (chars) | 16.0% (7.8% comments, 8.2% docstrings) |
63
+ | Unique documents (exact hash) | 100.0% |
64
+ | Unique documents (near, comments/whitespace stripped) | 99.9% |
65
+ | Syntactic validity (`ast.parse`, Python 3) | 85.6%* |
66
+ | Docstring coverage (functions) | 26.4% |
67
+ | Mean function complexity (control-flow branches +1) | 2.31 |
68
+ | Document length median / mean / p95 (chars) | 3,569 / 5,170 / 14,977 |
69
+
70
+ \*Parse failures under Python 3 predominantly reflect legacy Python 2 syntax
71
+ present in the upstream GitHub-derived corpus (e.g. `print` statements), not
72
+ corrupted files; documents are dropped whole rather than truncated, so no file
73
+ is cut mid-statement.
74
+
75
+ ## Format
76
+
77
+ One field per example:
78
+
79
+ ```python
80
+ {"content": "<cleaned Python source file>"}
81
+ ```
82
+
83
+ ## Usage
84
+
85
+ ```python
86
+ from datasets import load_dataset
87
+
88
+ ds = load_dataset("Ananda100/python-clean-codeparrot", split="train", streaming=True)
89
+ for example in ds:
90
+ print(example["content"][:200])
91
+ break
92
+ ```
93
+
94
+ ## Intended use & limitations
95
+
96
+ Built for pretraining small code language models. Natural language appears only
97
+ as annotation embedded in code (comments/docstrings), never as standalone
98
+ problem-to-solution instruction — models pretrained on this corpus alone will
99
+ not follow natural-language instructions without subsequent instruction tuning
100
+ (measured in the PocketCoder paper: 0.0% MBPP pass@1 before SFT, 8.6% after).
101
+
102
+ ## Licensing
103
+
104
+ Derived from `codeparrot/codeparrot-clean`, which aggregates public GitHub
105
+ Python files under their original licenses. Use of this derived corpus is
106
+ subject to the licenses of the underlying source files; see the upstream
107
+ dataset card for details.
108
+
109
+ ## Citation
110
+
111
+ ```bibtex
112
+ @misc{rimal2026pocketcoder,
113
+ title = {PocketCoder: What Distillation, SFT, and DPO Each Buy You at 100M Parameters},
114
+ author = {Rimal, Ananda},
115
+ year = {2026},
116
+ url = {https://github.com/AnandaRimal/PocketCoder}
117
+ }
118
+ ```