werty1248 commited on
Commit
ebce3b4
·
verified ·
1 Parent(s): e97e554

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +188 -60
README.md CHANGED
@@ -24,10 +24,10 @@ dataset_info:
24
  dtype: large_string
25
  splits:
26
  - name: train
27
- num_bytes: 8463845
28
- num_examples: 45769
29
- download_size: 4133304
30
- dataset_size: 8463845
31
  - config_name: CSharp
32
  features:
33
  - name: blob_id
@@ -52,10 +52,10 @@ dataset_info:
52
  dtype: large_string
53
  splits:
54
  - name: train
55
- num_bytes: 10799062
56
- num_examples: 53304
57
- download_size: 5229026
58
- dataset_size: 10799062
59
  - config_name: Cpp
60
  features:
61
  - name: blob_id
@@ -80,10 +80,10 @@ dataset_info:
80
  dtype: large_string
81
  splits:
82
  - name: train
83
- num_bytes: 25495370
84
- num_examples: 131729
85
- download_size: 12327512
86
- dataset_size: 25495370
87
  - config_name: Go
88
  features:
89
  - name: blob_id
@@ -112,10 +112,10 @@ dataset_info:
112
  dtype: large_string
113
  splits:
114
  - name: train
115
- num_bytes: 1289738
116
- num_examples: 5978
117
- download_size: 504218
118
- dataset_size: 1289738
119
  - config_name: Java
120
  features:
121
  - name: blob_id
@@ -140,10 +140,10 @@ dataset_info:
140
  dtype: large_string
141
  splits:
142
  - name: train
143
- num_bytes: 131964268
144
- num_examples: 606520
145
- download_size: 65086760
146
- dataset_size: 131964268
147
  - config_name: JavaScript
148
  features:
149
  - name: blob_id
@@ -168,10 +168,10 @@ dataset_info:
168
  dtype: large_string
169
  splits:
170
  - name: train
171
- num_bytes: 28682940
172
- num_examples: 143959
173
- download_size: 13628578
174
- dataset_size: 28682940
175
  - config_name: Markdown
176
  features:
177
  - name: blob_id
@@ -196,10 +196,10 @@ dataset_info:
196
  dtype: large_string
197
  splits:
198
  - name: train
199
- num_bytes: 114451402
200
- num_examples: 547852
201
- download_size: 54229584
202
- dataset_size: 114451402
203
  - config_name: PHP
204
  features:
205
  - name: blob_id
@@ -224,10 +224,10 @@ dataset_info:
224
  dtype: large_string
225
  splits:
226
  - name: train
227
- num_bytes: 4305039
228
- num_examples: 22365
229
- download_size: 1987572
230
- dataset_size: 4305039
231
  - config_name: Python
232
  features:
233
  - name: blob_id
@@ -252,10 +252,10 @@ dataset_info:
252
  dtype: large_string
253
  splits:
254
  - name: train
255
- num_bytes: 89313081
256
- num_examples: 458826
257
- download_size: 43846401
258
- dataset_size: 89313081
259
  - config_name: Ruby
260
  features:
261
  - name: blob_id
@@ -280,10 +280,10 @@ dataset_info:
280
  dtype: large_string
281
  splits:
282
  - name: train
283
- num_bytes: 722353
284
- num_examples: 3862
285
- download_size: 308486
286
- dataset_size: 722353
287
  - config_name: Rust
288
  features:
289
  - name: blob_id
@@ -308,10 +308,10 @@ dataset_info:
308
  dtype: large_string
309
  splits:
310
  - name: train
311
- num_bytes: 288366
312
- num_examples: 1494
313
- download_size: 117297
314
- dataset_size: 288366
315
  - config_name: SQL
316
  features:
317
  - name: blob_id
@@ -336,10 +336,10 @@ dataset_info:
336
  dtype: large_string
337
  splits:
338
  - name: train
339
- num_bytes: 6647337
340
- num_examples: 34493
341
- download_size: 3227395
342
- dataset_size: 6647337
343
  - config_name: Shell
344
  features:
345
  - name: blob_id
@@ -364,10 +364,10 @@ dataset_info:
364
  dtype: large_string
365
  splits:
366
  - name: train
367
- num_bytes: 1019999
368
- num_examples: 5371
369
- download_size: 456837
370
- dataset_size: 1019999
371
  - config_name: Swift
372
  features:
373
  - name: blob_id
@@ -392,10 +392,10 @@ dataset_info:
392
  dtype: large_string
393
  splits:
394
  - name: train
395
- num_bytes: 8229529
396
- num_examples: 37726
397
- download_size: 3715589
398
- dataset_size: 8229529
399
  - config_name: TypeScript
400
  features:
401
  - name: blob_id
@@ -420,10 +420,10 @@ dataset_info:
420
  dtype: large_string
421
  splits:
422
  - name: train
423
- num_bytes: 4690102
424
- num_examples: 22948
425
- download_size: 2080678
426
- dataset_size: 4690102
427
  configs:
428
  - config_name: C
429
  data_files:
@@ -486,3 +486,131 @@ configs:
486
  - split: train
487
  path: TypeScript/train-*
488
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  dtype: large_string
25
  splits:
26
  - name: train
27
+ num_bytes: 1100442974
28
+ num_examples: 5848375
29
+ download_size: 571816053
30
+ dataset_size: 1100442974
31
  - config_name: CSharp
32
  features:
33
  - name: blob_id
 
52
  dtype: large_string
53
  splits:
54
  - name: train
55
+ num_bytes: 2392066248
56
+ num_examples: 11425016
57
+ download_size: 1232015539
58
+ dataset_size: 2392066248
59
  - config_name: Cpp
60
  features:
61
  - name: blob_id
 
80
  dtype: large_string
81
  splits:
82
  - name: train
83
+ num_bytes: 3167426435
84
+ num_examples: 16246746
85
+ download_size: 1632803797
86
+ dataset_size: 3167426435
87
  - config_name: Go
88
  features:
89
  - name: blob_id
 
112
  dtype: large_string
113
  splits:
114
  - name: train
115
+ num_bytes: 433053889
116
+ num_examples: 1917163
117
+ download_size: 179388495
118
+ dataset_size: 433053889
119
  - config_name: Java
120
  features:
121
  - name: blob_id
 
140
  dtype: large_string
141
  splits:
142
  - name: train
143
+ num_bytes: 10292427437
144
+ num_examples: 44990158
145
+ download_size: 5291667797
146
+ dataset_size: 10292427437
147
  - config_name: JavaScript
148
  features:
149
  - name: blob_id
 
168
  dtype: large_string
169
  splits:
170
  - name: train
171
+ num_bytes: 2654326008
172
+ num_examples: 13253431
173
+ download_size: 1287066511
174
+ dataset_size: 2654326008
175
  - config_name: Markdown
176
  features:
177
  - name: blob_id
 
196
  dtype: large_string
197
  splits:
198
  - name: train
199
+ num_bytes: 4268378053
200
+ num_examples: 20687077
201
+ download_size: 2058772192
202
+ dataset_size: 4268378053
203
  - config_name: PHP
204
  features:
205
  - name: blob_id
 
224
  dtype: large_string
225
  splits:
226
  - name: train
227
+ num_bytes: 1985843762
228
+ num_examples: 9914497
229
+ download_size: 983498806
230
+ dataset_size: 1985843762
231
  - config_name: Python
232
  features:
233
  - name: blob_id
 
252
  dtype: large_string
253
  splits:
254
  - name: train
255
+ num_bytes: 4947575770
256
+ num_examples: 25286019
257
+ download_size: 2500795086
258
+ dataset_size: 4947575770
259
  - config_name: Ruby
260
  features:
261
  - name: blob_id
 
280
  dtype: large_string
281
  splits:
282
  - name: train
283
+ num_bytes: 592832039
284
+ num_examples: 2976874
285
+ download_size: 284535771
286
+ dataset_size: 592832039
287
  - config_name: Rust
288
  features:
289
  - name: blob_id
 
308
  dtype: large_string
309
  splits:
310
  - name: train
311
+ num_bytes: 227434676
312
+ num_examples: 1135379
313
+ download_size: 103158397
314
+ dataset_size: 227434676
315
  - config_name: SQL
316
  features:
317
  - name: blob_id
 
336
  dtype: large_string
337
  splits:
338
  - name: train
339
+ num_bytes: 505669712
340
+ num_examples: 2504412
341
+ download_size: 261176608
342
+ dataset_size: 505669712
343
  - config_name: Shell
344
  features:
345
  - name: blob_id
 
364
  dtype: large_string
365
  splits:
366
  - name: train
367
+ num_bytes: 811611733
368
+ num_examples: 4133547
369
+ download_size: 394872047
370
+ dataset_size: 811611733
371
  - config_name: Swift
372
  features:
373
  - name: blob_id
 
392
  dtype: large_string
393
  splits:
394
  - name: train
395
+ num_bytes: 529873695
396
+ num_examples: 2454309
397
+ download_size: 257883733
398
+ dataset_size: 529873695
399
  - config_name: TypeScript
400
  features:
401
  - name: blob_id
 
420
  dtype: large_string
421
  splits:
422
  - name: train
423
+ num_bytes: 904736029
424
+ num_examples: 4290356
425
+ download_size: 425942502
426
+ dataset_size: 904736029
427
  configs:
428
  - config_name: C
429
  data_files:
 
486
  - split: train
487
  path: TypeScript/train-*
488
  ---
489
+
490
+ [HuggingFaceTB/stack-edu](https://huggingface.co/datasets/HuggingFaceTB/stack-edu) 에서 한국어가 포함된 데이터만 발췌
491
+
492
+ - 주석이나 소스코드 내부에 한국어가 포함된 경우
493
+ - 한국어로 작성된 문서(Markdown 등)
494
+
495
+ **특징**
496
+
497
+ - **한글이 5글자 이상** 들어있으면 한국어가 포함된 데이터라고 판단함
498
+ - 극소수지만 한국어가 아닌데 유니코드가 깨져서 우연히 한글이 검출된 경우도 있는 것 같음
499
+
500
+ - [SmolLM2](HuggingFaceTB/SmolLM2-1.7B-Instruct) 토크나이저 기준 토큰 수 비교 (총 125B -> 4.1B, 마크다운 제외 시 2.1B)
501
+
502
+ | Language | Stack-Edu (B tokens) | Stack-Edu-Ko (M tokens) |
503
+ |------------|----------------------|-------------------------|
504
+ | Python | 21.8 | 430.8 |
505
+ | Cpp | 16.0 | 187.4 |
506
+ | Markdown | 14.0 | 1990.9 |
507
+ | C | 11.1 | 76.5 |
508
+ | JavaScript | 11.1 | 179.6 |
509
+ | Java | 42.1 | 810.5 |
510
+ | SQL | 9.62 | 240.1 |
511
+ | PHP | 9.07 | 32.2 |
512
+ | C-Sharp | 8.87 | 66.8 |
513
+ | TypeScript | 3.03 | 23.4 |
514
+ | Shell | 3.13 | 8.5 |
515
+ | Swift | 1.83 | 41.6 |
516
+ | Go | 1.80 | 6.5 |
517
+ | Rust | 1.75 | 5.2 |
518
+ | Ruby | 1.61 | 4.2 |
519
+
520
+
521
+
522
+
523
+ # 💻 Stack-Edu
524
+
525
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/61c141342aac764ce1654e43/3W_vdVnYBBAifrF5JU5QM.png)
526
+
527
+ Stack-Edu is a 125B token dataset of educational code filtered from [The Stack v2](https://huggingface.co/datasets/bigcode/the-stack-v2), precisely the curated training corpus of [StarCoder2](https://arxiv.org/abs/2402.19173) models denoted StarCoder2Data. It is intended for Language Models training.
528
+
529
+ This dataset was curated using a classifier-based filtering strategy, inspired by [📚 FineWeb-Edu](https://huggingface.co/datasets/HuggingFaceFW/fineweb-edu), to retain only the highest-quality educational programming content.
530
+
531
+ Stack-Edu shows consistent improvement over StarCoder2data on all the programming languages on MultiPL-E benchmark.
532
+
533
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/61c141342aac764ce1654e43/GWnPgD0diMu0I8buK6mvG.png" width="600"/>
534
+
535
+ ## Downloading the data
536
+ This dataset only contains the SWHIDs to download the code files and not the content of the files itself. The contents can be downloaded from Software Heritage's S3 bucket to ensure data compliance.
537
+ Please refer to [the-stack-v2](https://huggingface.co/datasets/bigcode/the-stack-v2-train-full-ids) for the data license.
538
+
539
+ When running on a 16-core AWS `us-east-1` instance, this script takes ~6 hours to download the files:
540
+ ```python
541
+ import boto3
542
+ import gzip
543
+ from datasets import load_dataset
544
+ from botocore.exceptions import ClientError
545
+
546
+ num_proc = 16
547
+ s3 = boto3.client('s3')
548
+ bucket_name = "softwareheritage"
549
+
550
+ def download_contents(blob_id):
551
+ key = f"content/{blob_id}"
552
+ try:
553
+ obj = s3.get_object(Bucket=bucket_name, Key=key)
554
+ with gzip.GzipFile(fileobj=obj['Body']) as fin:
555
+ content = fin.read().decode("utf-8", errors="ignore")
556
+ return {"text": content, "download_success": True}
557
+ except ClientError as e:
558
+ if e.response['Error']['Code'] == 'NoSuchKey':
559
+ print(f"File not found: {key}")
560
+ return {"text": "", "download_success": False}
561
+ else:
562
+ raise
563
+
564
+ # For Python
565
+ ds = load_dataset("HuggingFaceTB/stack-edu", "Python", split="train", num_proc=num_proc)
566
+ ds = ds.map(download_contents, input_columns="blob_id", num_proc=num_proc)
567
+
568
+ # Filter out failed downloads
569
+ ds = ds.filter(lambda x: x['download_success'])
570
+
571
+ # Optionally, print the first example to verify the data
572
+ print(ds[0])
573
+ ```
574
+
575
+ ## Details
576
+ The table below shows the number of tokens in each programming language using [SmolLM2](https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct) tokenizer.
577
+
578
+ | Language | Stack-Edu (B tokens) |
579
+ |------------|----------------------|
580
+ | Python | 21.8 |
581
+ | Cpp | 16.0 |
582
+ | Markdown | 14.0 |
583
+ | C | 11.1 |
584
+ | JavaScript | 11.1 |
585
+ | Java | 42.1 |
586
+ | SQL | 9.62 |
587
+ | PHP | 9.07 |
588
+ | C-Sharp | 8.87 |
589
+ | TypeScript | 3.03 |
590
+ | Shell | 3.13 |
591
+ | Swift | 1.83 |
592
+ | Go | 1.80 |
593
+ | Rust | 1.75 |
594
+ | Ruby | 1.61 |
595
+
596
+
597
+ ## Dataset curation
598
+ To build Stack-Edu, we:
599
+
600
+ - Selected 15 largest programming languages from StarCoder2Data
601
+ - Trained 15 language-specific classifiers, using [StarEncoder](https://huggingface.co/bigcode/starencoder) model on synthetic annotations generated by Llama3-70B-Instruct. The classifiers for each language are available in this [collection](https://huggingface.co/collections/HuggingFaceTB/the-ultimate-collection-of-code-classifiers-67b5aa3eb8994a4b71453005).
602
+ - Applied a filtering threshold of 3 (out of 5) to retain highly educational content, except for Java, which performed best at threshold 2.
603
+
604
+ ## Citation Information
605
+
606
+ ```
607
+ @misc{allal2025smollm2smolgoesbig,
608
+ title={SmolLM2: When Smol Goes Big -- Data-Centric Training of a Small Language Model},
609
+ author={Loubna Ben Allal and Anton Lozhkov and Elie Bakouch and Gabriel Martín Blázquez and Guilherme Penedo and Lewis Tunstall and Andrés Marafioti and Hynek Kydlíček and Agustín Piqueres Lajarín and Vaibhav Srivastav and Joshua Lochner and Caleb Fahlgren and Xuan-Son Nguyen and Clémentine Fourrier and Ben Burtenshaw and Hugo Larcher and Haojun Zhao and Cyril Zakka and Mathieu Morlon and Colin Raffel and Leandro von Werra and Thomas Wolf},
610
+ year={2025},
611
+ eprint={2502.02737},
612
+ archivePrefix={arXiv},
613
+ primaryClass={cs.CL},
614
+ url={https://arxiv.org/abs/2502.02737},
615
+ }
616
+ ```