Commit
·
44e273f
1
Parent(s):
52cc20b
Update the_legal_pile_preprocessed.py
Browse files
the_legal_pile_preprocessed.py
CHANGED
|
@@ -147,11 +147,12 @@ class LegalPile(datasets.GeneratorBasedBuilder):
|
|
| 147 |
logger.info("⏳ Generating examples from = %s", filepath)
|
| 148 |
with xz.open(open(filepath, "rb"), "rt", encoding='utf-8') as f:
|
| 149 |
for row in f:
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
|
|
|
|
|
| 147 |
logger.info("⏳ Generating examples from = %s", filepath)
|
| 148 |
with xz.open(open(filepath, "rb"), "rt", encoding='utf-8') as f:
|
| 149 |
for row in f:
|
| 150 |
+
if row:
|
| 151 |
+
try:
|
| 152 |
+
data = json.loads(row)
|
| 153 |
+
yield id_, {
|
| 154 |
+
"text": data["text"]
|
| 155 |
+
}
|
| 156 |
+
id_ += 1
|
| 157 |
+
except:
|
| 158 |
+
continue
|