Datasets:

Languages:
English
ArXiv:
Tags:
math

zstd decompress error: Unknown frame descriptor

#7
by malteos - opened

Thanks for providing this dataset.

I am getting the following error when trying to download it:

from datasets import load_dataset
ds = load_dataset("EleutherAI/proof-pile-2", "algebraic-stack")

Error:

...
Downloading data: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 2.52M/2.52M [00:00<00:00, 4.33MB/s]
Traceback (most recent call last):                      
  File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1629, in _prepare_split_single
    for key, record in generator:
  File "$HOME/.cache/huggingface/modules/datasets_modules/datasets/EleutherAI--proof-pile-2/d802527145511da18e4730abf06f6c2c6c682a72254f78ec50f83fddd3a0fcdd/proof-pile-2.py", line 193, in _generate_examples
    for x in f.readlines():
zstd.ZstdError: zstd decompress error: Unknown frame descriptor

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

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/dist-packages/datasets/load.py", line 1809, in load_dataset
    builder_instance.download_and_prepare(
  File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 909, in download_and_prepare
    self._download_and_prepare(
  File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1670, in _download_and_prepare
    super()._download_and_prepare(
  File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1004, in _download_and_prepare
    self._prepare_split(split_generator, **prepare_split_kwargs)
  File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1508, in _prepare_split
    for job_id, done, content in self._prepare_split_single(
  File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1665, in _prepare_split_single
    raise DatasetGenerationError("An error occurred while generating the dataset") from e
datasets.builder.DatasetGenerationError: An error occurred while generating the dataset

My best guess is that the script tries to decompress files which are not compressed with ZSTD.

I also get this error when downloading the dataset.

I encountered the same error, and managed to fix it by doing the following:

Edit $HOME/.cache/huggingface/modules/datasets_modules/datasets/EleutherAI--proof-pile-2/d802527145511da18e4730abf06f6c2c6c682a72254f78ec50f83fddd3a0fcdd/proof-pile-2.py

    def _generate_examples(self, data_files):
        key = 0
        for name in data_files:
            print( "###{}####".format(name))
            try:
                with zstd.open(open(name, "rb"), "rt", encoding="utf-8") as f:
                    for x in f.readlines():
                        instance = json.loads(x)
                        if instance:
                            if "meta" not in instance:
                                instance["meta"] = dict()
                            yield key, {"text": instance["text"], "meta": json.dumps(instance["meta"])}
                            key += 1
# it seems already extracted...           
            except:
                with open(name, "r", encoding="utf-8") as f:
                    for x in f.readlines():
                        instance = json.loads(x)
                        if instance:
                            if "meta" not in instance:
                                instance["meta"] = dict()
                            yield key, {"text": instance["text"], "meta": json.dumps(instance["meta"])}
                            key += 1

Now the json decoder throws an error: json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 112 (char 111)

Edit:
Looking at the file and the line that failed, I see that the line is an unusually long chunk of text that has ended abruptly. So it was not a valid JSON.
Not sure whether this had happened during the download, saving, or reading the line.

Sign up or log in to comment