Datasets:
Update README.md
Browse files
README.md
CHANGED
|
@@ -110,3 +110,109 @@ configs:
|
|
| 110 |
- split: test
|
| 111 |
path: algebraic-stack/test-*
|
| 112 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
- split: test
|
| 111 |
path: algebraic-stack/test-*
|
| 112 |
---
|
| 113 |
+
|
| 114 |
+

|
| 115 |
+
|
| 116 |
+
The original [EleutherAI/proof-pile-2](https://huggingface.co/datasets/EleutherAI/proof-pile-2) dataset uses a custom python script and .jsonl.zst files, which some versions of the datasets library struggle with.
|
| 117 |
+
|
| 118 |
+
This dataset contains the same data, subsets, and splits as [EleutherAI/proof-pile-2](https://huggingface.co/datasets/EleutherAI/proof-pile-2), converted into standard parquet format.
|
| 119 |
+
|
| 120 |
+
Each subset and split was also shuffled so that directly training on the data is possible.
|
| 121 |
+
|
| 122 |
+
Conversion was performed using the following script:
|
| 123 |
+
```python
|
| 124 |
+
|
| 125 |
+
import os
|
| 126 |
+
import zstandard as zstd
|
| 127 |
+
import json
|
| 128 |
+
import pandas as pd
|
| 129 |
+
from tqdm import tqdm
|
| 130 |
+
|
| 131 |
+
import datasets
|
| 132 |
+
import huggingface_hub as hf
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
DATA_URL = "EleutherAI/proof-pile-2"
|
| 136 |
+
SUBSETS = [
|
| 137 |
+
"algebraic-stack",
|
| 138 |
+
"arxiv",
|
| 139 |
+
"open-web-math"
|
| 140 |
+
]
|
| 141 |
+
SPLITS = [
|
| 142 |
+
"train",
|
| 143 |
+
"validation",
|
| 144 |
+
"test"
|
| 145 |
+
]
|
| 146 |
+
|
| 147 |
+
LOCAL_DIR = "./local_data/proof-pile-2"
|
| 148 |
+
|
| 149 |
+
OUT_URL = 'aklein4/proof-pile-2-fixed'
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
def download_data(
|
| 153 |
+
url: str,
|
| 154 |
+
subset: str,
|
| 155 |
+
split: str,
|
| 156 |
+
):
|
| 157 |
+
hf.snapshot_download(
|
| 158 |
+
repo_id=url,
|
| 159 |
+
repo_type="dataset",
|
| 160 |
+
allow_patterns=[f"{subset}/{split}/*"],
|
| 161 |
+
local_dir=LOCAL_DIR,
|
| 162 |
+
)
|
| 163 |
+
|
| 164 |
+
return os.path.join(LOCAL_DIR, subset, split)
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
def format_data(
|
| 168 |
+
url: str,
|
| 169 |
+
subset: str ,
|
| 170 |
+
split: str,
|
| 171 |
+
):
|
| 172 |
+
|
| 173 |
+
# download the data
|
| 174 |
+
folder = download_data(url, subset, split)
|
| 175 |
+
|
| 176 |
+
# get all files in the local dir
|
| 177 |
+
data_files = [
|
| 178 |
+
os.path.join(folder, f)
|
| 179 |
+
for f in os.listdir(folder)
|
| 180 |
+
if f.endswith(".zst")
|
| 181 |
+
]
|
| 182 |
+
|
| 183 |
+
# read all of the .jsonl.zst files
|
| 184 |
+
examples = []
|
| 185 |
+
for file_path in tqdm(data_files):
|
| 186 |
+
|
| 187 |
+
with zstd.open(open(file_path, "rb"), "rt", encoding="utf-8") as f:
|
| 188 |
+
for x in f.readlines():
|
| 189 |
+
examples.append(json.loads(x))
|
| 190 |
+
|
| 191 |
+
# get the dataset
|
| 192 |
+
df = pd.DataFrame(examples)
|
| 193 |
+
dataset = datasets.Dataset.from_pandas(df)
|
| 194 |
+
dataset = dataset.shuffle(seed=42)
|
| 195 |
+
|
| 196 |
+
dataset.push_to_hub(
|
| 197 |
+
OUT_URL,
|
| 198 |
+
config_name=subset,
|
| 199 |
+
split=split,
|
| 200 |
+
private=False
|
| 201 |
+
)
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
def main():
|
| 205 |
+
|
| 206 |
+
for subset in SUBSETS:
|
| 207 |
+
for split in SPLITS:
|
| 208 |
+
|
| 209 |
+
format_data(
|
| 210 |
+
DATA_URL,
|
| 211 |
+
subset,
|
| 212 |
+
split,
|
| 213 |
+
)
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
if __name__ == "__main__":
|
| 217 |
+
main()
|
| 218 |
+
```
|