Datasets:
yury-zyphra
commited on
Commit
•
62f9040
1
Parent(s):
7f48140
Workaround for duplicated ID's issue
Browse filesWorkaround for this issue: https://huggingface.co/datasets/allenai/dolma/discussions/18
dolma.py
CHANGED
@@ -18,6 +18,7 @@
|
|
18 |
import gzip
|
19 |
import json
|
20 |
import os
|
|
|
21 |
from typing import List
|
22 |
|
23 |
import datasets
|
@@ -131,7 +132,7 @@ class Dolma(datasets.GeneratorBasedBuilder):
|
|
131 |
with gzip.open(fn, mode="rt", encoding="utf-8") as f:
|
132 |
for line in f:
|
133 |
row = json.loads(line)
|
134 |
-
yield
|
135 |
"id": row["id"],
|
136 |
"text": row["text"],
|
137 |
"added": row.get("added", ""),
|
|
|
18 |
import gzip
|
19 |
import json
|
20 |
import os
|
21 |
+
import uuid
|
22 |
from typing import List
|
23 |
|
24 |
import datasets
|
|
|
132 |
with gzip.open(fn, mode="rt", encoding="utf-8") as f:
|
133 |
for line in f:
|
134 |
row = json.loads(line)
|
135 |
+
yield str(uuid.uuid4()), {
|
136 |
"id": row["id"],
|
137 |
"text": row["text"],
|
138 |
"added": row.get("added", ""),
|