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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"@context": {
|
3 |
+
"@language": "en",
|
4 |
+
"@vocab": "https://schema.org/",
|
5 |
+
"citeAs": "cr:citeAs",
|
6 |
+
"column": "cr:column",
|
7 |
+
"conformsTo": "dct:conformsTo",
|
8 |
+
"cr": "http://mlcommons.org/croissant/",
|
9 |
+
"rai": "http://mlcommons.org/croissant/RAI/",
|
10 |
+
"data": {
|
11 |
+
"@id": "cr:data",
|
12 |
+
"@type": "@json"
|
13 |
+
},
|
14 |
+
"dataType": {
|
15 |
+
"@id": "cr:dataType",
|
16 |
+
"@type": "@vocab"
|
17 |
+
},
|
18 |
+
"dct": "http://purl.org/dc/terms/",
|
19 |
+
"examples": {
|
20 |
+
"@id": "cr:examples",
|
21 |
+
"@type": "@json"
|
22 |
+
},
|
23 |
+
"extract": "cr:extract",
|
24 |
+
"field": "cr:field",
|
25 |
+
"fileProperty": "cr:fileProperty",
|
26 |
+
"fileObject": "cr:fileObject",
|
27 |
+
"fileSet": "cr:fileSet",
|
28 |
+
"format": "cr:format",
|
29 |
+
"includes": "cr:includes",
|
30 |
+
"isLiveDataset": "cr:isLiveDataset",
|
31 |
+
"jsonPath": "cr:jsonPath",
|
32 |
+
"key": "cr:key",
|
33 |
+
"md5": "cr:md5",
|
34 |
+
"parentField": "cr:parentField",
|
35 |
+
"path": "cr:path",
|
36 |
+
"recordSet": "cr:recordSet",
|
37 |
+
"references": "cr:references",
|
38 |
+
"regex": "cr:regex",
|
39 |
+
"repeated": "cr:repeated",
|
40 |
+
"replace": "cr:replace",
|
41 |
+
"sc": "https://schema.org/",
|
42 |
+
"separator": "cr:separator",
|
43 |
+
"source": "cr:source",
|
44 |
+
"subField": "cr:subField",
|
45 |
+
"transform": "cr:transform"
|
46 |
+
},
|
47 |
+
"@type": "sc:Dataset",
|
48 |
+
"name": "ProofWalaDataset",
|
49 |
+
"description": "A dataset of formal theorem-proving steps extracted from Lean, Coq, GeoCoq, MathComp, and more.",
|
50 |
+
"conformsTo": "http://mlcommons.org/croissant/1.0",
|
51 |
+
"license": "https://opensource.org/licenses/MIT",
|
52 |
+
"url": "https://huggingface.co/datasets/amitayusht/ProofWalaDataset",
|
53 |
+
"version": "1.0.0",
|
54 |
+
"distribution": [
|
55 |
+
{
|
56 |
+
"@type": "cr:FileObject",
|
57 |
+
"@id": "huggingface-repo",
|
58 |
+
"name": "huggingface-repo",
|
59 |
+
"description": "ProofWalaDataset GitHub repo",
|
60 |
+
"contentUrl": "https://huggingface.co/datasets/amitayusht/ProofWalaDataset",
|
61 |
+
"encodingFormat": "git+https",
|
62 |
+
"sha256": "main"
|
63 |
+
},
|
64 |
+
{
|
65 |
+
"@type": "cr:FileSet",
|
66 |
+
"@id": "all-json",
|
67 |
+
"name": "all-json",
|
68 |
+
"description": "All .json files across datasets and splits.",
|
69 |
+
"containedIn": {
|
70 |
+
"@id": "huggingface-repo"
|
71 |
+
},
|
72 |
+
"encodingFormat": "application/json",
|
73 |
+
"includes": "**/*.json"
|
74 |
+
}
|
75 |
+
],
|
76 |
+
"recordSet": [
|
77 |
+
{
|
78 |
+
"@type": "cr:RecordSet",
|
79 |
+
"@id": "proof-records",
|
80 |
+
"name": "proof-records",
|
81 |
+
"description": "All proof records across dataset families and splits.",
|
82 |
+
"field": [
|
83 |
+
{
|
84 |
+
"@type": "cr:Field",
|
85 |
+
"@id": "record/proof_id",
|
86 |
+
"name": "proof_id",
|
87 |
+
"description": "Proof ID",
|
88 |
+
"dataType": "sc:Text",
|
89 |
+
"source": {
|
90 |
+
"fileSet": {
|
91 |
+
"@id": "all-json"
|
92 |
+
},
|
93 |
+
"extract": {
|
94 |
+
"jsonPath": "training_data[*].proof_id"
|
95 |
+
}
|
96 |
+
}
|
97 |
+
},
|
98 |
+
{
|
99 |
+
"@type": "cr:Field",
|
100 |
+
"@id": "record/goal_description",
|
101 |
+
"name": "goal_description",
|
102 |
+
"description": "Goal description",
|
103 |
+
"dataType": "sc:Text",
|
104 |
+
"source": {
|
105 |
+
"fileSet": {
|
106 |
+
"@id": "all-json"
|
107 |
+
},
|
108 |
+
"extract": {
|
109 |
+
"jsonPath": "training_data[*].goal_description"
|
110 |
+
}
|
111 |
+
}
|
112 |
+
},
|
113 |
+
{
|
114 |
+
"@type": "cr:Field",
|
115 |
+
"@id": "record/proof_steps",
|
116 |
+
"name": "proof_steps",
|
117 |
+
"description": "Tactic steps",
|
118 |
+
"dataType": "sc:Text",
|
119 |
+
"source": {
|
120 |
+
"fileSet": {
|
121 |
+
"@id": "all-json"
|
122 |
+
},
|
123 |
+
"extract": {
|
124 |
+
"jsonPath": "training_data[*].proof_steps"
|
125 |
+
}
|
126 |
+
}
|
127 |
+
},
|
128 |
+
{
|
129 |
+
"@type": "cr:Field",
|
130 |
+
"@id": "record/theorem_name",
|
131 |
+
"name": "theorem_name",
|
132 |
+
"description": "Theorem name",
|
133 |
+
"dataType": "sc:Text",
|
134 |
+
"source": {
|
135 |
+
"fileSet": {
|
136 |
+
"@id": "all-json"
|
137 |
+
},
|
138 |
+
"extract": {
|
139 |
+
"jsonPath": "training_data[*].theorem_name"
|
140 |
+
}
|
141 |
+
}
|
142 |
+
},
|
143 |
+
{
|
144 |
+
"@type": "cr:Field",
|
145 |
+
"@id": "record/project_id",
|
146 |
+
"name": "project_id",
|
147 |
+
"description": "Project ID",
|
148 |
+
"dataType": "sc:Text",
|
149 |
+
"source": {
|
150 |
+
"fileSet": {
|
151 |
+
"@id": "all-json"
|
152 |
+
},
|
153 |
+
"extract": {
|
154 |
+
"jsonPath": "training_data[*].project_id"
|
155 |
+
}
|
156 |
+
}
|
157 |
+
},
|
158 |
+
{
|
159 |
+
"@type": "cr:Field",
|
160 |
+
"@id": "record/file_path",
|
161 |
+
"name": "file_path",
|
162 |
+
"description": "File path",
|
163 |
+
"dataType": "sc:Text",
|
164 |
+
"source": {
|
165 |
+
"fileSet": {
|
166 |
+
"@id": "all-json"
|
167 |
+
},
|
168 |
+
"extract": {
|
169 |
+
"jsonPath": "training_data[*].file_path"
|
170 |
+
}
|
171 |
+
}
|
172 |
+
},
|
173 |
+
{
|
174 |
+
"@type": "cr:Field",
|
175 |
+
"@id": "record/start_goal",
|
176 |
+
"name": "start_goal",
|
177 |
+
"description": "Main goal from start_goals list",
|
178 |
+
"dataType": "sc:Text",
|
179 |
+
"source": {
|
180 |
+
"fileSet": {
|
181 |
+
"@id": "all-json"
|
182 |
+
},
|
183 |
+
"extract": {
|
184 |
+
"jsonPath": "training_data[*].start_goals[*].goal"
|
185 |
+
}
|
186 |
+
}
|
187 |
+
},
|
188 |
+
{
|
189 |
+
"@type": "cr:Field",
|
190 |
+
"@id": "record/start_hypotheses",
|
191 |
+
"name": "start_hypotheses",
|
192 |
+
"description": "List of hypotheses from start_goals",
|
193 |
+
"dataType": "sc:Text",
|
194 |
+
"source": {
|
195 |
+
"fileSet": {
|
196 |
+
"@id": "all-json"
|
197 |
+
},
|
198 |
+
"extract": {
|
199 |
+
"jsonPath": "training_data[*].start_goals[*].hypotheses"
|
200 |
+
}
|
201 |
+
}
|
202 |
+
},
|
203 |
+
{
|
204 |
+
"@type": "cr:Field",
|
205 |
+
"@id": "record/end_goal",
|
206 |
+
"name": "end_goal",
|
207 |
+
"description": "Main goal from end_goals list",
|
208 |
+
"dataType": "sc:Text",
|
209 |
+
"source": {
|
210 |
+
"fileSet": {
|
211 |
+
"@id": "all-json"
|
212 |
+
},
|
213 |
+
"extract": {
|
214 |
+
"jsonPath": "training_data[*].end_goals[*].goal"
|
215 |
+
}
|
216 |
+
}
|
217 |
+
},
|
218 |
+
{
|
219 |
+
"@type": "cr:Field",
|
220 |
+
"@id": "record/end_hypotheses",
|
221 |
+
"name": "end_hypotheses",
|
222 |
+
"description": "List of hypotheses from end_goals",
|
223 |
+
"dataType": "sc:Text",
|
224 |
+
"source": {
|
225 |
+
"fileSet": {
|
226 |
+
"@id": "all-json"
|
227 |
+
},
|
228 |
+
"extract": {
|
229 |
+
"jsonPath": "training_data[*].end_goals[*].hypotheses"
|
230 |
+
}
|
231 |
+
}
|
232 |
+
},
|
233 |
+
{
|
234 |
+
"@type": "cr:Field",
|
235 |
+
"@id": "record/source_dataset",
|
236 |
+
"name": "source_dataset",
|
237 |
+
"description": "Dataset family (e.g. lean, coq).",
|
238 |
+
"dataType": "sc:Text",
|
239 |
+
"source": {
|
240 |
+
"fileSet": {
|
241 |
+
"@id": "all-json"
|
242 |
+
},
|
243 |
+
"extract": {
|
244 |
+
"fileProperty": "filepath"
|
245 |
+
},
|
246 |
+
"transform": {
|
247 |
+
"regex": "^([^/]+)/.*"
|
248 |
+
}
|
249 |
+
}
|
250 |
+
},
|
251 |
+
{
|
252 |
+
"@type": "cr:Field",
|
253 |
+
"@id": "record/split",
|
254 |
+
"name": "split",
|
255 |
+
"description": "Split name (train/test/eval).",
|
256 |
+
"dataType": "sc:Text",
|
257 |
+
"source": {
|
258 |
+
"fileSet": {
|
259 |
+
"@id": "all-json"
|
260 |
+
},
|
261 |
+
"extract": {
|
262 |
+
"fileProperty": "filepath"
|
263 |
+
},
|
264 |
+
"transform": {
|
265 |
+
"regex": "^[^/]+/([^/]+)/.*"
|
266 |
+
}
|
267 |
+
}
|
268 |
+
}
|
269 |
+
]
|
270 |
+
}
|
271 |
+
]
|
272 |
+
}
|
crossoint.py
CHANGED
@@ -1,103 +1,126 @@
|
|
1 |
-
import
|
|
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
9 |
)
|
10 |
|
11 |
-
#
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
16 |
)
|
17 |
-
metadata.distribution = [distribution]
|
18 |
|
19 |
-
#
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
),
|
30 |
-
mlc.nodes.Field(
|
31 |
-
name="all_useful_defns_theorems",
|
32 |
-
data_type="sc:Text", # Consider using a more specific type if appropriate
|
33 |
-
description="List of all useful definitions and theorems",
|
34 |
-
source=mlc.nodes.Source(extract={"json_path": "all_useful_defns_theorems"}),
|
35 |
-
),
|
36 |
-
mlc.nodes.Field(
|
37 |
-
name="goal_description",
|
38 |
-
data_type="sc:Text", # Consider using a more specific type if appropriate
|
39 |
-
description="Description of the goal",
|
40 |
-
source=mlc.nodes.Source(extract={"json_path": "goal_description"}),
|
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 |
-
source=mlc.nodes.Source(extract={"json_path": "file_path"}),
|
77 |
-
),
|
78 |
-
mlc.nodes.Field(
|
79 |
-
name="project_id",
|
80 |
-
data_type="sc:Text",
|
81 |
-
description="Project identifier",
|
82 |
-
source=mlc.nodes.Source(extract={"json_path": "project_id"}),
|
83 |
-
),
|
84 |
-
mlc.nodes.Field(
|
85 |
-
name="theorem_name",
|
86 |
-
data_type="sc:Text",
|
87 |
-
description="Name of the theorem",
|
88 |
-
source=mlc.nodes.Source(extract={"json_path": "theorem_name"}),
|
89 |
),
|
|
|
|
|
90 |
|
91 |
-
|
|
|
|
|
|
|
|
|
|
|
92 |
)
|
93 |
-
metadata.record_set = [record_set]
|
94 |
-
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
-
# Print or save the Croissant metadata
|
98 |
-
print(metadata.to_json())
|
99 |
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
validate(
|
|
|
1 |
+
import json
|
2 |
+
import mlcroissant as mlc
|
3 |
+
from mlcroissant._src.structure_graph.nodes.source import FileProperty
|
4 |
+
from mlcroissant.scripts import validate
|
5 |
|
6 |
+
|
7 |
+
# 1. Base repo
|
8 |
+
repo = mlc.FileObject(
|
9 |
+
id="huggingface-repo",
|
10 |
+
name="huggingface-repo",
|
11 |
+
description="ProofWalaDataset GitHub repo",
|
12 |
+
content_url="https://huggingface.co/datasets/amitayusht/ProofWalaDataset",
|
13 |
+
encoding_formats=["git+https"],
|
14 |
+
sha256="main",
|
15 |
)
|
16 |
|
17 |
+
# 2. Single FileSet that includes all .json files recursively
|
18 |
+
file_set = mlc.FileSet(
|
19 |
+
id="all-json",
|
20 |
+
name="all-json",
|
21 |
+
description="All .json files across datasets and splits.",
|
22 |
+
contained_in=["huggingface-repo"],
|
23 |
+
includes="**/*.json", # recursive glob
|
24 |
+
encoding_formats=["application/json"],
|
25 |
)
|
|
|
26 |
|
27 |
+
# 3. Helper to make fields
|
28 |
+
def make_field(field_id, name, description, json_path):
|
29 |
+
return mlc.Field(
|
30 |
+
id=field_id,
|
31 |
+
name=name,
|
32 |
+
description=description,
|
33 |
+
data_types=[mlc.DataType.TEXT],
|
34 |
+
source=mlc.Source(
|
35 |
+
file_set="all-json",
|
36 |
+
extract=mlc.Extract(json_path=json_path),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
),
|
38 |
+
)
|
39 |
+
|
40 |
+
# 4. Standard fields
|
41 |
+
fields = [
|
42 |
+
make_field("record/proof_id", "proof_id", "Proof ID", "training_data[*].proof_id"),
|
43 |
+
make_field("record/goal_description", "goal_description", "Goal description", "training_data[*].goal_description"),
|
44 |
+
make_field("record/proof_steps", "proof_steps", "Tactic steps", "training_data[*].proof_steps"),
|
45 |
+
make_field("record/theorem_name", "theorem_name", "Theorem name", "training_data[*].theorem_name"),
|
46 |
+
make_field("record/project_id", "project_id", "Project ID", "training_data[*].project_id"),
|
47 |
+
make_field("record/file_path", "file_path", "File path", "training_data[*].file_path"),
|
48 |
+
]
|
49 |
+
|
50 |
+
fields += [
|
51 |
+
make_field(
|
52 |
+
"record/start_goal",
|
53 |
+
"start_goal",
|
54 |
+
"Main goal from start_goals list",
|
55 |
+
"training_data[*].start_goals[*].goal",
|
56 |
+
),
|
57 |
+
make_field(
|
58 |
+
"record/start_hypotheses",
|
59 |
+
"start_hypotheses",
|
60 |
+
"List of hypotheses from start_goals",
|
61 |
+
"training_data[*].start_goals[*].hypotheses",
|
62 |
+
),
|
63 |
+
make_field(
|
64 |
+
"record/end_goal",
|
65 |
+
"end_goal",
|
66 |
+
"Main goal from end_goals list",
|
67 |
+
"training_data[*].end_goals[*].goal",
|
68 |
+
),
|
69 |
+
make_field(
|
70 |
+
"record/end_hypotheses",
|
71 |
+
"end_hypotheses",
|
72 |
+
"List of hypotheses from end_goals",
|
73 |
+
"training_data[*].end_goals[*].hypotheses",
|
74 |
+
),
|
75 |
+
]
|
76 |
+
|
77 |
+
|
78 |
+
# 5. Derived fields: dataset family and split from path
|
79 |
+
fields += [
|
80 |
+
mlc.Field(
|
81 |
+
id="record/source_dataset",
|
82 |
+
name="source_dataset",
|
83 |
+
description="Dataset family (e.g. lean, coq).",
|
84 |
+
data_types=[mlc.DataType.TEXT],
|
85 |
+
source=mlc.Source(
|
86 |
+
file_set="all-json",
|
87 |
+
extract=mlc.Extract(file_property=FileProperty.filepath),
|
88 |
+
transforms=[mlc.Transform(regex="^([^/]+)/.*")],
|
89 |
),
|
90 |
+
),
|
91 |
+
mlc.Field(
|
92 |
+
id="record/split",
|
93 |
+
name="split",
|
94 |
+
description="Split name (train/test/eval).",
|
95 |
+
data_types=[mlc.DataType.TEXT],
|
96 |
+
source=mlc.Source(
|
97 |
+
file_set="all-json",
|
98 |
+
extract=mlc.Extract(file_property=FileProperty.filepath),
|
99 |
+
transforms=[mlc.Transform(regex="^[^/]+/([^/]+)/.*")],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
),
|
101 |
+
),
|
102 |
+
]
|
103 |
|
104 |
+
# 6. RecordSet
|
105 |
+
record_set = mlc.RecordSet(
|
106 |
+
id="proof-records",
|
107 |
+
name="proof-records",
|
108 |
+
description="All proof records across dataset families and splits.",
|
109 |
+
fields=fields,
|
110 |
)
|
|
|
|
|
111 |
|
112 |
+
metadata = mlc.Metadata(
|
113 |
+
name="ProofWalaDataset",
|
114 |
+
description="A dataset of formal theorem-proving steps extracted from Lean, Coq, GeoCoq, MathComp, and more.",
|
115 |
+
license="https://opensource.org/licenses/MIT",
|
116 |
+
url="https://huggingface.co/datasets/amitayusht/ProofWalaDataset",
|
117 |
+
version="1.0.0",
|
118 |
+
distribution=[repo, file_set],
|
119 |
+
record_sets=[record_set],
|
120 |
+
)
|
121 |
|
|
|
|
|
122 |
|
123 |
+
json_dict = metadata.to_json()
|
124 |
+
with open("croissant.json", "w") as f:
|
125 |
+
json.dump(json_dict, f, indent=2)
|
126 |
+
# validate.main("croissant.json")
|