Update MultiLegalPile_Chunks_500.py
Browse files
MultiLegalPile_Chunks_500.py
CHANGED
|
@@ -4,6 +4,8 @@ import json
|
|
| 4 |
|
| 5 |
import datasets
|
| 6 |
from huggingface_hub.file_download import hf_hub_url
|
|
|
|
|
|
|
| 7 |
|
| 8 |
try:
|
| 9 |
import lzma as xz
|
|
@@ -110,7 +112,7 @@ class MultiLegalPileChunks500(datasets.GeneratorBasedBuilder):
|
|
| 110 |
for filepath in filepaths:
|
| 111 |
logger.info("Generating examples from = %s", filepath)
|
| 112 |
try:
|
| 113 |
-
with xz.open(
|
| 114 |
for line in f:
|
| 115 |
if line:
|
| 116 |
example = json.loads(line)
|
|
|
|
| 4 |
|
| 5 |
import datasets
|
| 6 |
from huggingface_hub.file_download import hf_hub_url
|
| 7 |
+
from datasets.download.streaming_download_manager import xopen
|
| 8 |
+
|
| 9 |
|
| 10 |
try:
|
| 11 |
import lzma as xz
|
|
|
|
| 112 |
for filepath in filepaths:
|
| 113 |
logger.info("Generating examples from = %s", filepath)
|
| 114 |
try:
|
| 115 |
+
with xz.open(xopen(filepath, "rb"), "rt", encoding="utf-8") as f:
|
| 116 |
for line in f:
|
| 117 |
if line:
|
| 118 |
example = json.loads(line)
|