zhangir-azerbayev
commited on
Commit
•
607f6e3
1
Parent(s):
a39973c
Revert "Revert "Fix Dataset Viewer (#2)""
Browse filesThis reverts commit 4e223b348856a6c8faea4c78919ab7b254659f0e.
- README.md +25 -0
- proof-pile-2.py +0 -157
README.md
CHANGED
@@ -7,6 +7,31 @@ tags:
|
|
7 |
- math
|
8 |
size_categories:
|
9 |
- 10B<n<100B
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
---
|
11 |
<img src="proofpile_logo.jpg" width="500">
|
12 |
|
|
|
7 |
- math
|
8 |
size_categories:
|
9 |
- 10B<n<100B
|
10 |
+
configs:
|
11 |
+
- config_name: arxiv
|
12 |
+
data_files:
|
13 |
+
- split: train
|
14 |
+
path: arxiv/train/*.jsonl.zst
|
15 |
+
- split: validation
|
16 |
+
path: arxiv/validation/*.jsonl.zst
|
17 |
+
- split: test
|
18 |
+
path: arxiv/test/*.jsonl.zst
|
19 |
+
- config_name: open-web-math
|
20 |
+
data_files:
|
21 |
+
- split: train
|
22 |
+
path: open-web-math/train/*.jsonl.zst
|
23 |
+
- split: validation
|
24 |
+
path: open-web-math/validation/*.jsonl.zst
|
25 |
+
- split: test
|
26 |
+
path: open-web-math/test/*.jsonl.zst
|
27 |
+
- config_name: algebraic-stack
|
28 |
+
data_files:
|
29 |
+
- split: train
|
30 |
+
path: algebraic-stack/train/*.jsonl.zst
|
31 |
+
- split: validation
|
32 |
+
path: algebraic-stack/validation/*.jsonl.zst
|
33 |
+
- split: test
|
34 |
+
path: algebraic-stack/test/*.jsonl.zst
|
35 |
---
|
36 |
<img src="proofpile_logo.jpg" width="500">
|
37 |
|
proof-pile-2.py
DELETED
@@ -1,157 +0,0 @@
|
|
1 |
-
import json
|
2 |
-
import os
|
3 |
-
import zstandard as zstd
|
4 |
-
|
5 |
-
import datasets
|
6 |
-
|
7 |
-
_CITATION="""\
|
8 |
-
@article{azerbayev2023llemma,
|
9 |
-
title={Llemma: an open language model for mathematics},
|
10 |
-
author={Zhangir Azerbayev and Hailey Schoelkopf and Keiran Paster and Marco Dos Santos and Stephen McAleer and Albert Q. Jiang and Jia Deng and Stella Biderman and Sean Welleck},
|
11 |
-
eprint={xyz.xyz},
|
12 |
-
archivePrefix={arXiv}
|
13 |
-
year={2023}
|
14 |
-
}
|
15 |
-
"""
|
16 |
-
|
17 |
-
_DESCRIPTION = """\
|
18 |
-
A dataset of high quality mathematical text. """
|
19 |
-
_HOMEPAGE = "https://github.com/EleutherAI/math-lm"
|
20 |
-
|
21 |
-
|
22 |
-
SPLITS = ["train", "validation", "test"]
|
23 |
-
|
24 |
-
_DATA_PATHS = {
|
25 |
-
"arxiv": {
|
26 |
-
split: [f'arxiv/{split}/arXiv_{str(i).zfill(3)}.jsonl.zst' for i in range(100)]
|
27 |
-
for split in SPLITS
|
28 |
-
},
|
29 |
-
"open-web-math": {
|
30 |
-
split: [
|
31 |
-
os.path.join(f"open-web-math/{split}", filename)
|
32 |
-
for filename in os.listdir(f"open-web-math/{split}")
|
33 |
-
]
|
34 |
-
for split in SPLITS
|
35 |
-
},
|
36 |
-
"algebraic-stack": {
|
37 |
-
split: [
|
38 |
-
os.path.join(f"algebraic-stack/{split}", filename)
|
39 |
-
for filename in os.listdir(f"algebraic-stack/{split}")
|
40 |
-
]
|
41 |
-
for split in SPLITS
|
42 |
-
}
|
43 |
-
}
|
44 |
-
|
45 |
-
class ProofPile2Config(datasets.BuilderConfig):
|
46 |
-
"""BuilderConfig for RedPajama sample."""
|
47 |
-
|
48 |
-
def __init__(self, *args, subsets, **kwargs):
|
49 |
-
"""BuilderConfig for ProofPile2.
|
50 |
-
Args:
|
51 |
-
**kwargs: keyword arguments forwarded to super.
|
52 |
-
"""
|
53 |
-
super(ProofPile2Config, self).__init__(**kwargs)
|
54 |
-
self.subsets = subsets
|
55 |
-
|
56 |
-
|
57 |
-
class ProofPile2(datasets.GeneratorBasedBuilder):
|
58 |
-
"""A large dataset of mathematical text."""
|
59 |
-
VERSION = datasets.Version("1.1.0")
|
60 |
-
|
61 |
-
# This is an example of a dataset with multiple configurations.
|
62 |
-
# If you don't want/need to define several sub-sets in your dataset,
|
63 |
-
# just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
|
64 |
-
|
65 |
-
# If you need to make complex sub-parts in the datasets with configurable options
|
66 |
-
# You can create your own builder configuration class to store attribute, inheriting from ProofPile2Config
|
67 |
-
# BUILDER_CONFIG_CLASS = MyBuilderConfig
|
68 |
-
|
69 |
-
# You will be able to load one or the other configurations in the following list with
|
70 |
-
# data = datasets.load_dataset('my_dataset', 'first_domain')
|
71 |
-
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
72 |
-
BUILDER_CONFIGS = [
|
73 |
-
ProofPile2Config(
|
74 |
-
name='default',
|
75 |
-
subsets=list(_DATA_PATHS.keys()),
|
76 |
-
version=VERSION,
|
77 |
-
description="All subsets"
|
78 |
-
),
|
79 |
-
ProofPile2Config(
|
80 |
-
name='arxiv',
|
81 |
-
subsets=["arxiv"],
|
82 |
-
version=VERSION,
|
83 |
-
description="ArXiv subset"
|
84 |
-
),
|
85 |
-
ProofPile2Config(
|
86 |
-
name='open-web-math',
|
87 |
-
subsets=['open-web-math'],
|
88 |
-
version=VERSION,
|
89 |
-
description="OpenWebMath"
|
90 |
-
),
|
91 |
-
ProofPile2Config(
|
92 |
-
name='algebraic-stack',
|
93 |
-
subsets=['algebraic-stack'],
|
94 |
-
version=VERSION,
|
95 |
-
description="Code subset"
|
96 |
-
),
|
97 |
-
]
|
98 |
-
|
99 |
-
|
100 |
-
def _info(self):
|
101 |
-
features = datasets.Features(
|
102 |
-
{
|
103 |
-
"text": datasets.Value("string"),
|
104 |
-
"meta": datasets.Value("string")
|
105 |
-
}
|
106 |
-
)
|
107 |
-
return datasets.DatasetInfo(
|
108 |
-
description=_DESCRIPTION,
|
109 |
-
features=features,
|
110 |
-
homepage=_HOMEPAGE,
|
111 |
-
citation=_CITATION,
|
112 |
-
)
|
113 |
-
|
114 |
-
def _split_generators(self, dl_manager):
|
115 |
-
return [
|
116 |
-
datasets.SplitGenerator(
|
117 |
-
name=datasets.Split.TRAIN,
|
118 |
-
# These kwargs will be passed to _generate_examples
|
119 |
-
gen_kwargs={
|
120 |
-
"data_files": list(map(
|
121 |
-
dl_manager.download,
|
122 |
-
[x for subset in self.config.subsets for x in _DATA_PATHS[subset]["train"]]
|
123 |
-
)),
|
124 |
-
},
|
125 |
-
),
|
126 |
-
datasets.SplitGenerator(
|
127 |
-
name=datasets.Split.VALIDATION,
|
128 |
-
# These kwargs will be passed to _generate_examples
|
129 |
-
gen_kwargs={
|
130 |
-
"data_files": list(map(
|
131 |
-
dl_manager.download,
|
132 |
-
[x for subset in self.config.subsets for x in _DATA_PATHS[subset]["validation"]]
|
133 |
-
)),
|
134 |
-
},
|
135 |
-
),
|
136 |
-
datasets.SplitGenerator(
|
137 |
-
name=datasets.Split.TEST,
|
138 |
-
gen_kwargs={
|
139 |
-
"data_files": list(map(
|
140 |
-
dl_manager.download,
|
141 |
-
[x for subset in self.config.subsets for x in _DATA_PATHS[subset]["test"]]
|
142 |
-
)),
|
143 |
-
},
|
144 |
-
),
|
145 |
-
]
|
146 |
-
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
147 |
-
def _generate_examples(self, data_files):
|
148 |
-
key = 0
|
149 |
-
for name in data_files:
|
150 |
-
with zstd.open(open(name, "rb"), "rt", encoding="utf-8") as f:
|
151 |
-
for x in f.readlines():
|
152 |
-
instance = json.loads(x)
|
153 |
-
if instance:
|
154 |
-
if "meta" not in instance:
|
155 |
-
instance["meta"] = dict()
|
156 |
-
yield key, {"text": instance["text"], "meta": json.dumps(instance["meta"])}
|
157 |
-
key += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|