Datasets:

Languages:
English
ArXiv:
Tags:
math

Unable to load dataset

#13
by lvh-tony - opened

Hi Team,

I've encountered an error while attempting to generate a dataset using the datasets library. The error message indicates a problem with zstd decompression, as shown below:

I ran:

from datasets import load_dataset

ds = load_dataset("EleutherAI/proof-pile-2", "default")

Output Cell:

{
    "name": "DatasetGenerationError",
    "message": "An error occurred while generating the dataset",
    "stack": "---------------------------------------------------------------------------
ZstdError                                 Traceback (most recent call last)
File ~/miniconda3/envs/datasets/lib/python3.10/site-packages/datasets/builder.py:1750, in GeneratorBasedBuilder._prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id)
   1749 _time = time.time()
-> 1750 for key, record in generator:
   1751     if max_shard_size is not None and writer._num_bytes > max_shard_size:

File ~/.cache/huggingface/modules/datasets_modules/datasets/EleutherAI--proof-pile-2/d802527145511da18e4730abf06f6c2c6c682a72254f78ec50f83fddd3a0fcdd/proof-pile-2.py:193, in ProofPile2._generate_examples(self, data_files)
    192 with zstd.open(open(name, \"rb\"), \"rt\", encoding=\"utf-8\") as f: 
--> 193     for x in f.readlines():
    194         instance = json.loads(x)

ZstdError: zstd decompress error: Unknown frame descriptor

The above exception was the direct cause of the following exception:

DatasetGenerationError                    Traceback (most recent call last)
Cell In[3], line 2
      1 from datasets import load_dataset
----> 2 ds = load_dataset(\"EleutherAI/proof-pile-2\", \"default\")

File ~/miniconda3/envs/datasets/lib/python3.10/site-packages/datasets/load.py:2616, in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, verification_mode, ignore_verifications, keep_in_memory, save_infos, revision, token, use_auth_token, task, streaming, num_proc, storage_options, trust_remote_code, **config_kwargs)
   2613     return builder_instance.as_streaming_dataset(split=split)
   2615 # Download and prepare data
-> 2616 builder_instance.download_and_prepare(
   2617     download_config=download_config,
   2618     download_mode=download_mode,
   2619     verification_mode=verification_mode,
   2620     num_proc=num_proc,
   2621     storage_options=storage_options,
   2622 )
   2624 # Build dataset for splits
   2625 keep_in_memory = (
   2626     keep_in_memory if keep_in_memory is not None else is_small_dataset(builder_instance.info.dataset_size)
   2627 )

File ~/miniconda3/envs/datasets/lib/python3.10/site-packages/datasets/builder.py:1029, in DatasetBuilder.download_and_prepare(self, output_dir, download_config, download_mode, verification_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, file_format, max_shard_size, num_proc, storage_options, **download_and_prepare_kwargs)
   1027     if num_proc is not None:
   1028         prepare_split_kwargs[\"num_proc\"] = num_proc
-> 1029     self._download_and_prepare(
   1030         dl_manager=dl_manager,
   1031         verification_mode=verification_mode,
   1032         **prepare_split_kwargs,
   1033         **download_and_prepare_kwargs,
   1034     )
   1035 # Sync info
   1036 self.info.dataset_size = sum(split.num_bytes for split in self.info.splits.values())

File ~/miniconda3/envs/datasets/lib/python3.10/site-packages/datasets/builder.py:1791, in GeneratorBasedBuilder._download_and_prepare(self, dl_manager, verification_mode, **prepare_splits_kwargs)
   1790 def _download_and_prepare(self, dl_manager, verification_mode, **prepare_splits_kwargs):
-> 1791     super()._download_and_prepare(
   1792         dl_manager,
   1793         verification_mode,
   1794         check_duplicate_keys=verification_mode == VerificationMode.BASIC_CHECKS
   1795         or verification_mode == VerificationMode.ALL_CHECKS,
   1796         **prepare_splits_kwargs,
   1797     )

File ~/miniconda3/envs/datasets/lib/python3.10/site-packages/datasets/builder.py:1124, in DatasetBuilder._download_and_prepare(self, dl_manager, verification_mode, **prepare_split_kwargs)
   1120 split_dict.add(split_generator.split_info)
   1122 try:
   1123     # Prepare split will record examples associated to the split
-> 1124     self._prepare_split(split_generator, **prepare_split_kwargs)
   1125 except OSError as e:
   1126     raise OSError(
   1127         \"Cannot find data file. \"
   1128         + (self.manual_download_instructions or \"\")
   1129         + \"\
Original error:\
\"
   1130         + str(e)
   1131     ) from None

File ~/miniconda3/envs/datasets/lib/python3.10/site-packages/datasets/builder.py:1629, in GeneratorBasedBuilder._prepare_split(self, split_generator, check_duplicate_keys, file_format, num_proc, max_shard_size)
   1627 job_id = 0
   1628 with pbar:
-> 1629     for job_id, done, content in self._prepare_split_single(
   1630         gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args
   1631     ):
   1632         if done:
   1633             result = content

File ~/miniconda3/envs/datasets/lib/python3.10/site-packages/datasets/builder.py:1786, in GeneratorBasedBuilder._prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id)
   1784     if isinstance(e, SchemaInferenceError) and e.__context__ is not None:
   1785         e = e.__context__
-> 1786     raise DatasetGenerationError(\"An error occurred while generating the dataset\") from e
   1788 yield job_id, True, (total_num_examples, total_num_bytes, writer._features, num_shards, shard_lengths)

DatasetGenerationError: An error occurred while generating the dataset"
}

It seems the error occurs during the data loading phase, possibly due to a corrupted or incorrectly formatted data file. I've already ensured that the dependencies, including zstd and datasets, are up-to-date. However, the issue persists.

Could anyone provide guidance or suggestions on how to resolve this?

Sign up or log in to comment