not possible to use streaming mode for common_crawl subset with load_dataset()

#20
by FanliLin - opened

when running the following code,

dataset = load_dataset(args.input, data_source, streaming=True)['train']
for rows in dataset.iter(batch_size=args.load_batch_size):
       df = pd.DataFrame(rows)

I got the following error:

File "/home/user/workspace/tools/redpajama_data_processing/preprocess_full.py", line 216, in main
    for rows in dataset.iter(batch_size=args.load_batch_size):
  File "/opt/conda/lib/python3.10/site-packages/datasets/iterable_dataset.py", line 1394, in iter
    examples = [example] + [example for key, example in islice(iterator, batch_size - 1)]
  File "/opt/conda/lib/python3.10/site-packages/datasets/iterable_dataset.py", line 1394, in <listcomp>
    examples = [example] + [example for key, example in islice(iterator, batch_size - 1)]
  File "/opt/conda/lib/python3.10/site-packages/datasets/iterable_dataset.py", line 207, in __iter__
    yield from self.generate_examples_fn(**self.kwargs)
  File "/root/.cache/huggingface/modules/datasets_modules/datasets/togethercomputer--RedPajama-Data-1T/d71c21cfe3a11386de9f82d60d553adc57848a1f1a4117b170d80b8fc866dc0e/RedPajama-Data-1T.py", line 177, in _generate_examples
    for i, row in enumerate(f):
  File "/opt/conda/lib/python3.10/site-packages/datasets/download/streaming_download_manager.py", line 372, in read_with_retries
    out = read(*args, **kwargs)
  File "/opt/conda/lib/python3.10/site-packages/fsspec/implementations/http.py", line 600, in read
    return super().read(length)
  File "/opt/conda/lib/python3.10/site-packages/fsspec/spec.py", line 1790, in read
    out = self.cache._fetch(self.loc, self.loc + length)
  File "/opt/conda/lib/python3.10/site-packages/fsspec/caching.py", line 396, in _fetch
    new = self.fetcher(self.end, bend)
  File "/opt/conda/lib/python3.10/site-packages/fsspec/asyn.py", line 121, in wrapper
    return sync(self.loop, func, *args, **kwargs)
  File "/opt/conda/lib/python3.10/site-packages/fsspec/asyn.py", line 106, in sync
    raise return_result
  File "/opt/conda/lib/python3.10/site-packages/fsspec/asyn.py", line 61, in _runner
    result[0] = await coro
  File "/opt/conda/lib/python3.10/site-packages/fsspec/implementations/http.py", line 671, in async_fetch_range
    raise ValueError(
ValueError: The HTTP server doesn't appear to support range requests. Only reading this file from the beginning is supported. Open with block_size=0 for a streaming file interface.
FanliLin changed discussion title from not possible to use streaming mode for common_crawl subset to not possible to use streaming mode for common_crawl subset with load_dataset()

@EugeneLu can you help me with it?

@FanliLin did you find a solution?

Sign up or log in to comment