Datasets:

Modalities:
Text
Formats:
json
ArXiv:
Libraries:
Datasets
Dask
License:

Streaming broken for Pile

#5
by Dahoas - opened

I am trying to access monology/pile-uncopyrighted via streaming with the lines:

pile = load_dataset("monology/pile-uncopyrighted", split="validation", streaming=True)
for sample in pile:
    print(sample)

However I get the following difficult to parse error when beginning the loop:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/storage/coda1/p-wliao60/0/ahavrilla3/alex/.envs/tml/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 1384, in __iter__
    for key, example in ex_iterable:
  File "/storage/coda1/p-wliao60/0/ahavrilla3/alex/.envs/tml/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 282, in __iter__
    for key, pa_table in self.generate_tables_fn(**self.kwargs):
  File "/storage/coda1/p-wliao60/0/ahavrilla3/alex/.envs/tml/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 78, in _generate_tables
    for file_idx, file in enumerate(itertools.chain.from_iterable(files)):
  File "/storage/coda1/p-wliao60/0/ahavrilla3/alex/.envs/tml/lib/python3.9/site-packages/datasets/download/streaming_download_manager.py", line 863, in __iter__
    yield from self.generator(*self.args, **self.kwargs)
  File "/storage/coda1/p-wliao60/0/ahavrilla3/alex/.envs/tml/lib/python3.9/site-packages/datasets/download/streaming_download_manager.py", line 939, in _iter_from_urlpaths
    if xisfile(urlpath, download_config=download_config):
  File "/storage/coda1/p-wliao60/0/ahavrilla3/alex/.envs/tml/lib/python3.9/site-packages/datasets/download/streaming_download_manager.py", line 261, in xisfile
    fs, *_ = fsspec.get_fs_token_paths(path, storage_options=storage_options)
  File "/storage/coda1/p-wliao60/0/ahavrilla3/alex/.envs/tml/lib/python3.9/site-packages/fsspec/core.py", line 622, in get_fs_token_paths
    fs = filesystem(protocol, **inkwargs)
  File "/storage/coda1/p-wliao60/0/ahavrilla3/alex/.envs/tml/lib/python3.9/site-packages/fsspec/registry.py", line 290, in filesystem
    return cls(**storage_options)
  File "/storage/coda1/p-wliao60/0/ahavrilla3/alex/.envs/tml/lib/python3.9/site-packages/fsspec/spec.py", line 79, in __call__
    obj = super().__call__(*args, **kwargs)
  File "/storage/coda1/p-wliao60/0/ahavrilla3/alex/.envs/tml/lib/python3.9/site-packages/datasets/filesystems/compression.py", line 138, in __init__
    super().__init__(
  File "/storage/coda1/p-wliao60/0/ahavrilla3/alex/.envs/tml/lib/python3.9/site-packages/datasets/filesystems/compression.py", line 37, in __init__
    self.file = fsspec.open(
  File "/storage/coda1/p-wliao60/0/ahavrilla3/alex/.envs/tml/lib/python3.9/site-packages/fsspec/core.py", line 452, in open
    out = open_files(
  File "/storage/coda1/p-wliao60/0/ahavrilla3/alex/.envs/tml/lib/python3.9/site-packages/fsspec/core.py", line 295, in open_files
    [
  File "/storage/coda1/p-wliao60/0/ahavrilla3/alex/.envs/tml/lib/python3.9/site-packages/fsspec/core.py", line 296, in <listcomp>
    OpenFile(
  File "/storage/coda1/p-wliao60/0/ahavrilla3/alex/.envs/tml/lib/python3.9/site-packages/fsspec/core.py", line 74, in __init__
    self.compression = get_compression(path, compression)
  File "/storage/coda1/p-wliao60/0/ahavrilla3/alex/.envs/tml/lib/python3.9/site-packages/fsspec/core.py", line 501, in get_compression
    raise ValueError(f"Compression type {compression} not supported")
ValueError: Compression type zstd not supported

Is this expected? Please advise.

I guess that zstd compressed files cannot be streamed and must be fully downloaded before decompression. cc @lhoestq

Have you installed the zstandard python package ?

No I did not. Installing zstandard seems to produce the expected behavior. Perhaps this solution should be hinted at in the above error message, if possible.

I installed zstandard but still cannot stream. Has anyone figured this out?

EDIT: Install zstandard before importing the transformers library. If you load the dataset before pip installing zstandard you must restart the kernel and try again.

Sign up or log in to comment