Update openwebtext_split.py
Browse files- openwebtext_split.py +5 -1
openwebtext_split.py
CHANGED
|
@@ -55,7 +55,11 @@ def custom_iter_archive(path_or_buf, _filter=lambda x: True):
|
|
| 55 |
if not file_path.endswith('xz'):
|
| 56 |
continue
|
| 57 |
file_obj = stream.extractfile(tarinfo)
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
stream.members = []
|
| 60 |
del stream
|
| 61 |
if hasattr(path_or_buf, "read"):
|
|
|
|
| 55 |
if not file_path.endswith('xz'):
|
| 56 |
continue
|
| 57 |
file_obj = stream.extractfile(tarinfo)
|
| 58 |
+
inner_stream = tarfile.open(file_obj=file_obj, mode="r|*")
|
| 59 |
+
for j, xzinfo in enumerate(inner_stream):
|
| 60 |
+
if not xzinfo.name.endswith('txt'):
|
| 61 |
+
continue
|
| 62 |
+
yield xzinfo.name, inner_stream.extractfile(xzinfo)
|
| 63 |
stream.members = []
|
| 64 |
del stream
|
| 65 |
if hasattr(path_or_buf, "read"):
|