File size: 4,480 Bytes
b98d09b
 
f5beed8
 
 
 
 
 
 
 
 
b98d09b
f5beed8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
---
license: apache-2.0
task_categories:
- text-generation
language:
- en
tags:
- data-juicer
- pretraining
size_categories:
- 10M<n<100M
---

# RedPajama & TheStack -- Github Code (refined by Data-Juicer)

A refined version of Github Code dataset in RedPajama & TheStack by [Data-Juicer](https://github.com/alibaba/data-juicer). Removing some "bad" samples from the original dataset to make it higher-quality.

This dataset is usually used to pretrain a Large Language Model.

**Notice**: Here is a small subset for previewing. The whole dataset is available [here](https://dail-wlcb.oss-cn-wulanchabu.aliyuncs.com/LLM_data/our_refined_datasets/pretraining/redpajama-stack-code-refine-result.jsonl) (About 232GB).

## Dataset Information

- Number of samples: 49,279,344 (Keep ~52.09% from the original dataset)

## Refining Recipe

### RedPajama code refinement

```yaml
# global parameters
project_name: 'Data-Juicer-recipes-code-rp'
dataset_path: '/path/to/your/dataset'  # path to your dataset directory or file
export_path: '/path/to/your/dataset.jsonl'

np: 50  # number of subprocess to process your dataset
open_tracer: true

# process schedule
# a list of several process operators with their arguments
process:
  - clean_email_mapper:
  - clean_links_mapper:
  - fix_unicode_mapper:
  - punctuation_normalization_mapper:
  - whitespace_normalization_mapper:
  - clean_copyright_mapper:

  - alphanumeric_filter:
      tokenization: False
      min_ratio: 0.4
      max_ratio: 0.8
  - alphanumeric_filter:
      tokenization: True
      min_ratio: 1.5
      max_ratio: 3
  - average_line_length_filter:
      min_len: 15
      max_len: 100
  - character_repetition_filter:
      rep_len: 10
      min_ratio: 0.05
      max_ratio: 0.3
  - maximum_line_length_filter:
      min_len: 50
      max_len: 500
  - text_length_filter:
      min_len: 300
  - words_num_filter:
      lang: en
      tokenization: False
      min_num: 30
      max_num: 5000
  - word_repetition_filter:
      lang: en
      tokenization: False
      rep_len: 10
      max_ratio: 0.1
  - document_simhash_deduplicator:
      tokenization: space
      window_size: 6
      lowercase: true
      ignore_pattern: '\p{P}'
      num_blocks: 6
      hamming_distance: 4
```

### TheStack code refinement (only max_stars_count >= 20)

```yaml
# global parameters
project_name: 'Data-Juicer-recipes-the-stack'
dataset_path: '/path/to/your/dataset'  # path to your dataset directory or file
export_path: '/path/to/your/dataset.jsonl'

text_key: 'content'

np: 50  # number of subprocess to process your dataset
open_tracer: true

# process schedule
# a list of several process operators with their arguments
process:
  - clean_email_mapper:
  - clean_links_mapper:
  - fix_unicode_mapper:
  - punctuation_normalization_mapper:
  - whitespace_normalization_mapper:
  - clean_copyright_mapper:

  - alphanumeric_filter:  # 18766
      tokenization: false
      min_ratio: 0.2  # < 3sigma (0.3791)
      max_ratio: 0.9163  # 3sigma
  - alphanumeric_filter:  # 146432
      tokenization: true
      min_ratio: 0.546  # 3sigma
      max_ratio: 3.65  # 3sigma
  - average_line_length_filter:  # for code
      min_len: 10  # > 3sigma (0) -- 48790
      max_len: 150  # < 3sigma (15603) -- 233275
  - character_repetition_filter:
      max_ratio: 0.36  # 3sigma -- 346875
  - maximum_line_length_filter:  # for code
      max_len: 1000  # remove 256670 samples
  - text_length_filter:
      max_len: 96714  # 3sigma -- 190006
  - words_num_filter:
      min_num: 20  # remove 1504958 samples
      max_num: 6640  # 3sigma -- remove 179847 samples
  - word_repetition_filter:
      rep_len: 10
      max_ratio: 0.357  # 3sigma -- 598462

  - document_simhash_deduplicator:
      tokenization: space
      window_size: 6
      lowercase: true
      ignore_pattern: '\p{P}'
      num_blocks: 6
      hamming_distance: 4
```

### Merge and Remove Duplicate Samples

```yaml
project_name: 'Data-Juicer-recipes-code'
dataset_path: '/path/to/your/dataset'  # path to your dataset directory or file
export_path: '/path/to/your/dataset.jsonl' # path to your dataset result file

np: 50  # number of subprocess to process your dataset
open_tracer: true

# process schedule
# a list of several process operators with their arguments

process:
  - document_simhash_deduplicator:
      tokenization: space
      window_size: 6
      lowercase: true
      ignore_pattern: '\p{P}'
      num_blocks: 6
      hamming_distance: 4
```