Datasets:

Modalities:
Text
ArXiv:
Libraries:
Datasets
Maurice Weber commited on
Commit
167a6e2
1 Parent(s): 3654bf8

add snippet, fix citation

Browse files
Files changed (1) hide show
  1. README.md +64 -1
README.md CHANGED
@@ -77,6 +77,69 @@ done
77
  A full set of scripts to recreate the dataset, including the quality signals, can be
78
  found [here](https://github.com/togethercomputer/RedPajama-Data).
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  ### Dataset Summary
81
 
82
  RedPajama-V2 is an open dataset for training large laguage models and includes over 100B text documents. Out of these,
@@ -272,7 +335,7 @@ To cite RedPajama-V2, please use:
272
  ```
273
  @software{together2023redpajama-v2,
274
  author = {Together Computer},
275
- title = {RedPajama-Data-v2: an Open Dataset for Training Large Language Models},
276
  month = October,
277
  year = 2023,
278
  url = {https://github.com/togethercomputer/RedPajama-Data}
 
77
  A full set of scripts to recreate the dataset, including the quality signals, can be
78
  found [here](https://github.com/togethercomputer/RedPajama-Data).
79
 
80
+ ### Applying Filtering Rules
81
+ You can use the quality signals to filter the raw RedPajama-V2 dataset for a given set of rules. For example, consider
82
+ the following set of rules used in Gopher:
83
+
84
+ ```python
85
+ def gopher_rules_pass(sample) -> bool:
86
+ """ function returns True if the sample complies with Gopher rules """
87
+ signals = json.loads(sample["quality_signals"])
88
+
89
+ # rule 1: number of words between 50 and 10'000
90
+ word_count = signals["rps_doc_word_count"][0][2]
91
+ if word_count < 50 or word_count > 10_000:
92
+ return False
93
+
94
+ # rule 2: mean word length between 3 and 10
95
+ mean_word_length = signals["rps_doc_mean_word_length"][0][2]
96
+ if mean_word_length < 3 or mean_word_length > 10:
97
+ return False
98
+
99
+ # rule 2: symbol to word ratio below 0.1
100
+ symbol_word_ratio = signals["rps_doc_symbol_to_word_ratio"][0][2]
101
+ if symbol_word_ratio > 0.1:
102
+ return False
103
+
104
+ # rule 3: 90% of lines need to start without a bullet point
105
+ n_lines = signals["ccnet_nlines"][0][2]
106
+ n_lines_bulletpoint_start = sum(map(lambda ln: ln[2], signals["rps_lines_start_with_bulletpoint"]))
107
+ if n_lines_bulletpoint_start / n_lines > 0.9:
108
+ return False
109
+
110
+ # rule 4: the ratio between characters in the most frequent 2-gram and the total number
111
+ # of characters must be below 0.2
112
+ top_2_gram_frac = signals["rps_doc_frac_chars_top_2gram"][0][2]
113
+ if top_2_gram_frac > 0.2:
114
+ return False
115
+
116
+ # rule 5: ...
117
+
118
+
119
+ return True
120
+ ```
121
+
122
+ Filtering the RedPajama-V2 dataset with this set of rules is then as easy as:
123
+
124
+ ```python
125
+ ds_iterator = load_dataset(
126
+ "togethercomputer/RedPajama-Data-V2",
127
+ snapshots=["2023-14"],
128
+ languages=["en"],
129
+ name="default",
130
+ streaming=True
131
+ )
132
+
133
+ filtered_dataset = []
134
+
135
+ for sample in ds_iterator["train"]:
136
+
137
+ if not gopher_rules_pass(sample):
138
+ continue
139
+
140
+ filtered_dataset.append(sample)
141
+ ```
142
+
143
  ### Dataset Summary
144
 
145
  RedPajama-V2 is an open dataset for training large laguage models and includes over 100B text documents. Out of these,
 
335
  ```
336
  @software{together2023redpajama-v2,
337
  author = {Together Computer},
338
+ title = {RedPajama: an Open Dataset for Training Large Language Models},
339
  month = October,
340
  year = 2023,
341
  url = {https://github.com/togethercomputer/RedPajama-Data}