Datasets:
Workaround for duplicated ID's issue
#41
by
yury-zyphra
- opened
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", ""),
|