html_url
stringlengths
48
51
title
stringlengths
5
280
comments
stringlengths
63
51.8k
body
stringlengths
0
36.2k
comment_length
int64
16
1.52k
text
stringlengths
163
54.1k
https://github.com/huggingface/datasets/issues/6176
how to limit the size of memory mapped file?
Hi! Can you share the error this reproducer throws in your environment? `streaming=True` streams the dataset as it's iterated over without creating a memory-map file.
### Describe the bug Huggingface datasets use memory-mapped file to map large datasets in memory for fast access. However, it seems like huggingface will occupy all the memory for memory-mapped files, which makes a troublesome situation since we cluster will distribute a small portion of memory to me (once it's over the limit, memory cannot be allocated), however, when the dataset checks the total memory, all of the memory will be taken into account which makes huggingface dataset try to allocate more memory than allowed. So is there a way to explicitly limit the size of memory mapped file? ### Steps to reproduce the bug python >>> from datasets import load_dataset >>> dataset = load_dataset("c4", "en", streaming=True) ### Expected behavior In a normal environment, this will not have any problem. However, when the system allocates a portion of the memory to the program and when the dataset checks the total memory, all of the memory will be taken into account which makes huggingface dataset try to allocate more memory than allowed. ### Environment info linux cluster with SGE(Sun Grid Engine)
25
how to limit the size of memory mapped file? ### Describe the bug Huggingface datasets use memory-mapped file to map large datasets in memory for fast access. However, it seems like huggingface will occupy all the memory for memory-mapped files, which makes a troublesome situation since we cluster will distribute a small portion of memory to me (once it's over the limit, memory cannot be allocated), however, when the dataset checks the total memory, all of the memory will be taken into account which makes huggingface dataset try to allocate more memory than allowed. So is there a way to explicitly limit the size of memory mapped file? ### Steps to reproduce the bug python >>> from datasets import load_dataset >>> dataset = load_dataset("c4", "en", streaming=True) ### Expected behavior In a normal environment, this will not have any problem. However, when the system allocates a portion of the memory to the program and when the dataset checks the total memory, all of the memory will be taken into account which makes huggingface dataset try to allocate more memory than allowed. ### Environment info linux cluster with SGE(Sun Grid Engine) Hi! Can you share the error this reproducer throws in your environment? `streaming=True` streams the dataset as it's iterated over without creating a memory-map file.
https://github.com/huggingface/datasets/issues/6176
how to limit the size of memory mapped file?
The trace of the error. Streaming works but is slower. ``` Root Cause (first observed failure): [0]: time : 2023-08-24_06:06:01 host : compute-126.cm.cluster rank : 0 (local_rank: 0) exitcode : 1 (pid: 48442) error_file: /tmp/torchelastic_4fqzcuuz/none_rx2470jl/attempt_0/0/error.json traceback : Traceback (most recent call last): File "/users/yli7/.conda/envs/pytorch2.0/lib/python3.8/site-packages/torch/distributed/elastic/multiprocessing/errors/__init__.py", line 346, in wrapper return f(*args, **kwargs) File "Pretrain.py", line 214, in main pair_dataset, c4_dataset = create_dataset('pretrain', config) File "/dcs05/qiao/data/william/project/DaVinci/dataset/__init__.py", line 109, in create_dataset c4_dataset = load_dataset("c4", "en", split="train").to_iterable_dataset(num_shards=1024).map(pre_caption_huggingface) File "/users/yli7/.local/lib/python3.8/site-packages/datasets/load.py", line 1810, in load_dataset ds = builder_instance.as_dataset(split=split, verification_mode=verification_mode, in_memory=keep_in_memory) File "/users/yli7/.local/lib/python3.8/site-packages/datasets/builder.py", line 1145, in as_dataset datasets = map_nested( File "/users/yli7/.local/lib/python3.8/site-packages/datasets/utils/py_utils.py", line 436, in map_nested return function(data_struct) File "/users/yli7/.local/lib/python3.8/site-packages/datasets/builder.py", line 1175, in _build_single_dataset ds = self._as_dataset( File "/users/yli7/.local/lib/python3.8/site-packages/datasets/builder.py", line 1246, in _as_dataset dataset_kwargs = ArrowReader(cache_dir, self.info).read( File "/users/yli7/.local/lib/python3.8/site-packages/datasets/arrow_reader.py", line 244, in read return self.read_files(files=files, original_instructions=instructions, in_memory=in_memory) File "/users/yli7/.local/lib/python3.8/site-packages/datasets/arrow_reader.py", line 265, in read_files pa_table = self._read_files(files, in_memory=in_memory) File "/users/yli7/.local/lib/python3.8/site-packages/datasets/arrow_reader.py", line 200, in _read_files pa_table: Table = self._get_table_from_filename(f_dict, in_memory=in_memory) File "/users/yli7/.local/lib/python3.8/site-packages/datasets/arrow_reader.py", line 336, in _get_table_from_filename table = ArrowReader.read_table(filename, in_memory=in_memory) File "/users/yli7/.local/lib/python3.8/site-packages/datasets/arrow_reader.py", line 357, in read_table return table_cls.from_file(filename) File "/users/yli7/.local/lib/python3.8/site-packages/datasets/table.py", line 1059, in from_file table = _memory_mapped_arrow_table_from_file(filename) File "/users/yli7/.local/lib/python3.8/site-packages/datasets/table.py", line 65, in _memory_mapped_arrow_table_from_file opened_stream = _memory_mapped_record_batch_reader_from_file(filename) File "/users/yli7/.local/lib/python3.8/site-packages/datasets/table.py", line 50, in _memory_mapped_record_batch_reader_from_file memory_mapped_stream = pa.memory_map(filename) File "pyarrow/io.pxi", line 1009, in pyarrow.lib.memory_map File "pyarrow/io.pxi", line 956, in pyarrow.lib.MemoryMappedFile._open File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 115, in pyarrow.lib.check_status OSError: Memory mapping file failed: Cannot allocate memory ```
### Describe the bug Huggingface datasets use memory-mapped file to map large datasets in memory for fast access. However, it seems like huggingface will occupy all the memory for memory-mapped files, which makes a troublesome situation since we cluster will distribute a small portion of memory to me (once it's over the limit, memory cannot be allocated), however, when the dataset checks the total memory, all of the memory will be taken into account which makes huggingface dataset try to allocate more memory than allowed. So is there a way to explicitly limit the size of memory mapped file? ### Steps to reproduce the bug python >>> from datasets import load_dataset >>> dataset = load_dataset("c4", "en", streaming=True) ### Expected behavior In a normal environment, this will not have any problem. However, when the system allocates a portion of the memory to the program and when the dataset checks the total memory, all of the memory will be taken into account which makes huggingface dataset try to allocate more memory than allowed. ### Environment info linux cluster with SGE(Sun Grid Engine)
229
how to limit the size of memory mapped file? ### Describe the bug Huggingface datasets use memory-mapped file to map large datasets in memory for fast access. However, it seems like huggingface will occupy all the memory for memory-mapped files, which makes a troublesome situation since we cluster will distribute a small portion of memory to me (once it's over the limit, memory cannot be allocated), however, when the dataset checks the total memory, all of the memory will be taken into account which makes huggingface dataset try to allocate more memory than allowed. So is there a way to explicitly limit the size of memory mapped file? ### Steps to reproduce the bug python >>> from datasets import load_dataset >>> dataset = load_dataset("c4", "en", streaming=True) ### Expected behavior In a normal environment, this will not have any problem. However, when the system allocates a portion of the memory to the program and when the dataset checks the total memory, all of the memory will be taken into account which makes huggingface dataset try to allocate more memory than allowed. ### Environment info linux cluster with SGE(Sun Grid Engine) The trace of the error. Streaming works but is slower. ``` Root Cause (first observed failure): [0]: time : 2023-08-24_06:06:01 host : compute-126.cm.cluster rank : 0 (local_rank: 0) exitcode : 1 (pid: 48442) error_file: /tmp/torchelastic_4fqzcuuz/none_rx2470jl/attempt_0/0/error.json traceback : Traceback (most recent call last): File "/users/yli7/.conda/envs/pytorch2.0/lib/python3.8/site-packages/torch/distributed/elastic/multiprocessing/errors/__init__.py", line 346, in wrapper return f(*args, **kwargs) File "Pretrain.py", line 214, in main pair_dataset, c4_dataset = create_dataset('pretrain', config) File "/dcs05/qiao/data/william/project/DaVinci/dataset/__init__.py", line 109, in create_dataset c4_dataset = load_dataset("c4", "en", split="train").to_iterable_dataset(num_shards=1024).map(pre_caption_huggingface) File "/users/yli7/.local/lib/python3.8/site-packages/datasets/load.py", line 1810, in load_dataset ds = builder_instance.as_dataset(split=split, verification_mode=verification_mode, in_memory=keep_in_memory) File "/users/yli7/.local/lib/python3.8/site-packages/datasets/builder.py", line 1145, in as_dataset datasets = map_nested( File "/users/yli7/.local/lib/python3.8/site-packages/datasets/utils/py_utils.py", line 436, in map_nested return function(data_struct) File "/users/yli7/.local/lib/python3.8/site-packages/datasets/builder.py", line 1175, in _build_single_dataset ds = self._as_dataset( File "/users/yli7/.local/lib/python3.8/site-packages/datasets/builder.py", line 1246, in _as_dataset dataset_kwargs = ArrowReader(cache_dir, self.info).read( File "/users/yli7/.local/lib/python3.8/site-packages/datasets/arrow_reader.py", line 244, in read return self.read_files(files=files, original_instructions=instructions, in_memory=in_memory) File "/users/yli7/.local/lib/python3.8/site-packages/datasets/arrow_reader.py", line 265, in read_files pa_table = self._read_files(files, in_memory=in_memory) File "/users/yli7/.local/lib/python3.8/site-packages/datasets/arrow_reader.py", line 200, in _read_files pa_table: Table = self._get_table_from_filename(f_dict, in_memory=in_memory) File "/users/yli7/.local/lib/python3.8/site-packages/datasets/arrow_reader.py", line 336, in _get_table_from_filename table = ArrowReader.read_table(filename, in_memory=in_memory) File "/users/yli7/.local/lib/python3.8/site-packages/datasets/arrow_reader.py", line 357, in read_table return table_cls.from_file(filename) File "/users/yli7/.local/lib/python3.8/site-packages/datasets/table.py", line 1059, in from_file table = _memory_mapped_arrow_table_from_file(filename) File "/users/yli7/.local/lib/python3.8/site-packages/datasets/table.py", line 65, in _memory_mapped_arrow_table_from_file opened_stream = _memory_mapped_record_batch_reader_from_file(filename) File "/users/yli7/.local/lib/python3.8/site-packages/datasets/table.py", line 50, in _memory_mapped_record_batch_reader_from_file memory_mapped_stream = pa.memory_map(filename) File "pyarrow/io.pxi", line 1009, in pyarrow.lib.memory_map File "pyarrow/io.pxi", line 956, in pyarrow.lib.MemoryMappedFile._open File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 115, in pyarrow.lib.check_status OSError: Memory mapping file failed: Cannot allocate memory ```
https://github.com/huggingface/datasets/issues/6176
how to limit the size of memory mapped file?
This issue has previously been reported here: https://github.com/huggingface/datasets/issues/5710. Reporting it in the Arrow repo makes more sense as they have control over memory mapping. PS: this is the API to reduce the size of the generated Arrow file: ```python from datasets import load_dataset builder = load_dataset_builder("c4", "en") builder.download_and_prepare(max_shard_size="5GB") dataset = builder.as_dataset() ``` If this resolves the issue, we can consider exposing `max_shard_size` in `load_dataset`.
### Describe the bug Huggingface datasets use memory-mapped file to map large datasets in memory for fast access. However, it seems like huggingface will occupy all the memory for memory-mapped files, which makes a troublesome situation since we cluster will distribute a small portion of memory to me (once it's over the limit, memory cannot be allocated), however, when the dataset checks the total memory, all of the memory will be taken into account which makes huggingface dataset try to allocate more memory than allowed. So is there a way to explicitly limit the size of memory mapped file? ### Steps to reproduce the bug python >>> from datasets import load_dataset >>> dataset = load_dataset("c4", "en", streaming=True) ### Expected behavior In a normal environment, this will not have any problem. However, when the system allocates a portion of the memory to the program and when the dataset checks the total memory, all of the memory will be taken into account which makes huggingface dataset try to allocate more memory than allowed. ### Environment info linux cluster with SGE(Sun Grid Engine)
64
how to limit the size of memory mapped file? ### Describe the bug Huggingface datasets use memory-mapped file to map large datasets in memory for fast access. However, it seems like huggingface will occupy all the memory for memory-mapped files, which makes a troublesome situation since we cluster will distribute a small portion of memory to me (once it's over the limit, memory cannot be allocated), however, when the dataset checks the total memory, all of the memory will be taken into account which makes huggingface dataset try to allocate more memory than allowed. So is there a way to explicitly limit the size of memory mapped file? ### Steps to reproduce the bug python >>> from datasets import load_dataset >>> dataset = load_dataset("c4", "en", streaming=True) ### Expected behavior In a normal environment, this will not have any problem. However, when the system allocates a portion of the memory to the program and when the dataset checks the total memory, all of the memory will be taken into account which makes huggingface dataset try to allocate more memory than allowed. ### Environment info linux cluster with SGE(Sun Grid Engine) This issue has previously been reported here: https://github.com/huggingface/datasets/issues/5710. Reporting it in the Arrow repo makes more sense as they have control over memory mapping. PS: this is the API to reduce the size of the generated Arrow file: ```python from datasets import load_dataset builder = load_dataset_builder("c4", "en") builder.download_and_prepare(max_shard_size="5GB") dataset = builder.as_dataset() ``` If this resolves the issue, we can consider exposing `max_shard_size` in `load_dataset`.
https://github.com/huggingface/datasets/issues/6172
Make Dataset streaming queries retryable
Hi! The streaming mode also retries requests - `datasets.config.STREAMING_READ_MAX_RETRIES` (20 sec by default) controls the number of retries and `datasets.config.STREAMING_READ_RETRY_INTERVAL` (5 sec) the sleep time between retries. > At step 1800 I got a 504 HTTP status code error from Huggingface hub for my pytorch dataloader A minor Hub outage that we experienced yesterday could be the cause.
### Feature request Streaming datasets, as intended, do not load the entire dataset in memory or disk. However, while querying the next data chunk from the remote, sometimes it is possible that the service is down or there might be other issues that may cause the query to fail. In such a scenario, it would be nice to make these queries retryable (perhaps with a backoff strategy). ### Motivation I was working on a model and the model checkpoints after every 1000 steps. At step 1800 I got a 504 HTTP status code error from Huggingface hub for my pytorch `dataloader`. Given the size of my model and data, it took around 2 hours to reach 1800 steps and now it will take about an hour to recover the lost 800. It would be better to get a retryable querying strategy. ### Your contribution It would be better if someone having experience in this area takes this up as this would require some testing.
58
Make Dataset streaming queries retryable ### Feature request Streaming datasets, as intended, do not load the entire dataset in memory or disk. However, while querying the next data chunk from the remote, sometimes it is possible that the service is down or there might be other issues that may cause the query to fail. In such a scenario, it would be nice to make these queries retryable (perhaps with a backoff strategy). ### Motivation I was working on a model and the model checkpoints after every 1000 steps. At step 1800 I got a 504 HTTP status code error from Huggingface hub for my pytorch `dataloader`. Given the size of my model and data, it took around 2 hours to reach 1800 steps and now it will take about an hour to recover the lost 800. It would be better to get a retryable querying strategy. ### Your contribution It would be better if someone having experience in this area takes this up as this would require some testing. Hi! The streaming mode also retries requests - `datasets.config.STREAMING_READ_MAX_RETRIES` (20 sec by default) controls the number of retries and `datasets.config.STREAMING_READ_RETRY_INTERVAL` (5 sec) the sleep time between retries. > At step 1800 I got a 504 HTTP status code error from Huggingface hub for my pytorch dataloader A minor Hub outage that we experienced yesterday could be the cause.
https://github.com/huggingface/datasets/issues/6169
Configurations in yaml not working
Unfortunately, I cannot reproduce this behavior on my machine or Colab - the reproducer returns `['main_data', 'additional_data']` as expected.
### Dataset configurations cannot be created in YAML/README Hello! I'm trying to follow the docs here in order to create structure in my dataset as added from here (#5331): https://github.com/huggingface/datasets/blob/8b8e6ee067eb74e7965ca2a6768f15f9398cb7c8/docs/source/repository_structure.mdx#L110-L118 I have the exact example in my config file for [my data repo](https://huggingface.co/datasets/tsor13/test): ``` configs: - config_name: main_data data_files: "main_data.csv" - config_name: additional_data data_files: "additional_data.csv" ``` Yet, I'm unable to load different configurations: ``` from datasets import get_dataset_config_names get_dataset_config_names('tsor13/test', use_auth_token=True) ``` returns a single split, `['tsor13--test']` Does anyone have any insights? @polinaeterna thank you for adding this feature, it is super useful. Do you happen to have any ideas? ### Steps to reproduce the bug from datasets import get_dataset_config_names get_dataset_config_names('tsor13/test') ### Expected behavior I would expect there to be two splits, `main_data` and `additional_data`. However, only `['tsor13--test']` test is returned. ### Environment info - `datasets` version: 2.14.4 - Platform: macOS-13.4-arm64-arm-64bit - Python version: 3.11.4 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 1.5.1
19
Configurations in yaml not working ### Dataset configurations cannot be created in YAML/README Hello! I'm trying to follow the docs here in order to create structure in my dataset as added from here (#5331): https://github.com/huggingface/datasets/blob/8b8e6ee067eb74e7965ca2a6768f15f9398cb7c8/docs/source/repository_structure.mdx#L110-L118 I have the exact example in my config file for [my data repo](https://huggingface.co/datasets/tsor13/test): ``` configs: - config_name: main_data data_files: "main_data.csv" - config_name: additional_data data_files: "additional_data.csv" ``` Yet, I'm unable to load different configurations: ``` from datasets import get_dataset_config_names get_dataset_config_names('tsor13/test', use_auth_token=True) ``` returns a single split, `['tsor13--test']` Does anyone have any insights? @polinaeterna thank you for adding this feature, it is super useful. Do you happen to have any ideas? ### Steps to reproduce the bug from datasets import get_dataset_config_names get_dataset_config_names('tsor13/test') ### Expected behavior I would expect there to be two splits, `main_data` and `additional_data`. However, only `['tsor13--test']` test is returned. ### Environment info - `datasets` version: 2.14.4 - Platform: macOS-13.4-arm64-arm-64bit - Python version: 3.11.4 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 1.5.1 Unfortunately, I cannot reproduce this behavior on my machine or Colab - the reproducer returns `['main_data', 'additional_data']` as expected.
https://github.com/huggingface/datasets/issues/6169
Configurations in yaml not working
Thank you for looking into this, Mario. Is this on [my repository](https://huggingface.co/datasets/tsor13/test), or on another one that you have reproduced? Would you mind pointing me to it if so?
### Dataset configurations cannot be created in YAML/README Hello! I'm trying to follow the docs here in order to create structure in my dataset as added from here (#5331): https://github.com/huggingface/datasets/blob/8b8e6ee067eb74e7965ca2a6768f15f9398cb7c8/docs/source/repository_structure.mdx#L110-L118 I have the exact example in my config file for [my data repo](https://huggingface.co/datasets/tsor13/test): ``` configs: - config_name: main_data data_files: "main_data.csv" - config_name: additional_data data_files: "additional_data.csv" ``` Yet, I'm unable to load different configurations: ``` from datasets import get_dataset_config_names get_dataset_config_names('tsor13/test', use_auth_token=True) ``` returns a single split, `['tsor13--test']` Does anyone have any insights? @polinaeterna thank you for adding this feature, it is super useful. Do you happen to have any ideas? ### Steps to reproduce the bug from datasets import get_dataset_config_names get_dataset_config_names('tsor13/test') ### Expected behavior I would expect there to be two splits, `main_data` and `additional_data`. However, only `['tsor13--test']` test is returned. ### Environment info - `datasets` version: 2.14.4 - Platform: macOS-13.4-arm64-arm-64bit - Python version: 3.11.4 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 1.5.1
29
Configurations in yaml not working ### Dataset configurations cannot be created in YAML/README Hello! I'm trying to follow the docs here in order to create structure in my dataset as added from here (#5331): https://github.com/huggingface/datasets/blob/8b8e6ee067eb74e7965ca2a6768f15f9398cb7c8/docs/source/repository_structure.mdx#L110-L118 I have the exact example in my config file for [my data repo](https://huggingface.co/datasets/tsor13/test): ``` configs: - config_name: main_data data_files: "main_data.csv" - config_name: additional_data data_files: "additional_data.csv" ``` Yet, I'm unable to load different configurations: ``` from datasets import get_dataset_config_names get_dataset_config_names('tsor13/test', use_auth_token=True) ``` returns a single split, `['tsor13--test']` Does anyone have any insights? @polinaeterna thank you for adding this feature, it is super useful. Do you happen to have any ideas? ### Steps to reproduce the bug from datasets import get_dataset_config_names get_dataset_config_names('tsor13/test') ### Expected behavior I would expect there to be two splits, `main_data` and `additional_data`. However, only `['tsor13--test']` test is returned. ### Environment info - `datasets` version: 2.14.4 - Platform: macOS-13.4-arm64-arm-64bit - Python version: 3.11.4 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 1.5.1 Thank you for looking into this, Mario. Is this on [my repository](https://huggingface.co/datasets/tsor13/test), or on another one that you have reproduced? Would you mind pointing me to it if so?
https://github.com/huggingface/datasets/issues/6169
Configurations in yaml not working
Whoa, in colab I received the correct behavior using my dataset. It must have something to do with my local copy of `datasets` (which again just failed). I've tried uninstalling/reinstnalling to no avail
### Dataset configurations cannot be created in YAML/README Hello! I'm trying to follow the docs here in order to create structure in my dataset as added from here (#5331): https://github.com/huggingface/datasets/blob/8b8e6ee067eb74e7965ca2a6768f15f9398cb7c8/docs/source/repository_structure.mdx#L110-L118 I have the exact example in my config file for [my data repo](https://huggingface.co/datasets/tsor13/test): ``` configs: - config_name: main_data data_files: "main_data.csv" - config_name: additional_data data_files: "additional_data.csv" ``` Yet, I'm unable to load different configurations: ``` from datasets import get_dataset_config_names get_dataset_config_names('tsor13/test', use_auth_token=True) ``` returns a single split, `['tsor13--test']` Does anyone have any insights? @polinaeterna thank you for adding this feature, it is super useful. Do you happen to have any ideas? ### Steps to reproduce the bug from datasets import get_dataset_config_names get_dataset_config_names('tsor13/test') ### Expected behavior I would expect there to be two splits, `main_data` and `additional_data`. However, only `['tsor13--test']` test is returned. ### Environment info - `datasets` version: 2.14.4 - Platform: macOS-13.4-arm64-arm-64bit - Python version: 3.11.4 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 1.5.1
33
Configurations in yaml not working ### Dataset configurations cannot be created in YAML/README Hello! I'm trying to follow the docs here in order to create structure in my dataset as added from here (#5331): https://github.com/huggingface/datasets/blob/8b8e6ee067eb74e7965ca2a6768f15f9398cb7c8/docs/source/repository_structure.mdx#L110-L118 I have the exact example in my config file for [my data repo](https://huggingface.co/datasets/tsor13/test): ``` configs: - config_name: main_data data_files: "main_data.csv" - config_name: additional_data data_files: "additional_data.csv" ``` Yet, I'm unable to load different configurations: ``` from datasets import get_dataset_config_names get_dataset_config_names('tsor13/test', use_auth_token=True) ``` returns a single split, `['tsor13--test']` Does anyone have any insights? @polinaeterna thank you for adding this feature, it is super useful. Do you happen to have any ideas? ### Steps to reproduce the bug from datasets import get_dataset_config_names get_dataset_config_names('tsor13/test') ### Expected behavior I would expect there to be two splits, `main_data` and `additional_data`. However, only `['tsor13--test']` test is returned. ### Environment info - `datasets` version: 2.14.4 - Platform: macOS-13.4-arm64-arm-64bit - Python version: 3.11.4 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 1.5.1 Whoa, in colab I received the correct behavior using my dataset. It must have something to do with my local copy of `datasets` (which again just failed). I've tried uninstalling/reinstnalling to no avail
https://github.com/huggingface/datasets/issues/6169
Configurations in yaml not working
hi @tsor13 , I haven't been able to reproduce your issue on `tsor13/test` dataset locally either. reinstalling doesn't help?
### Dataset configurations cannot be created in YAML/README Hello! I'm trying to follow the docs here in order to create structure in my dataset as added from here (#5331): https://github.com/huggingface/datasets/blob/8b8e6ee067eb74e7965ca2a6768f15f9398cb7c8/docs/source/repository_structure.mdx#L110-L118 I have the exact example in my config file for [my data repo](https://huggingface.co/datasets/tsor13/test): ``` configs: - config_name: main_data data_files: "main_data.csv" - config_name: additional_data data_files: "additional_data.csv" ``` Yet, I'm unable to load different configurations: ``` from datasets import get_dataset_config_names get_dataset_config_names('tsor13/test', use_auth_token=True) ``` returns a single split, `['tsor13--test']` Does anyone have any insights? @polinaeterna thank you for adding this feature, it is super useful. Do you happen to have any ideas? ### Steps to reproduce the bug from datasets import get_dataset_config_names get_dataset_config_names('tsor13/test') ### Expected behavior I would expect there to be two splits, `main_data` and `additional_data`. However, only `['tsor13--test']` test is returned. ### Environment info - `datasets` version: 2.14.4 - Platform: macOS-13.4-arm64-arm-64bit - Python version: 3.11.4 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 1.5.1
19
Configurations in yaml not working ### Dataset configurations cannot be created in YAML/README Hello! I'm trying to follow the docs here in order to create structure in my dataset as added from here (#5331): https://github.com/huggingface/datasets/blob/8b8e6ee067eb74e7965ca2a6768f15f9398cb7c8/docs/source/repository_structure.mdx#L110-L118 I have the exact example in my config file for [my data repo](https://huggingface.co/datasets/tsor13/test): ``` configs: - config_name: main_data data_files: "main_data.csv" - config_name: additional_data data_files: "additional_data.csv" ``` Yet, I'm unable to load different configurations: ``` from datasets import get_dataset_config_names get_dataset_config_names('tsor13/test', use_auth_token=True) ``` returns a single split, `['tsor13--test']` Does anyone have any insights? @polinaeterna thank you for adding this feature, it is super useful. Do you happen to have any ideas? ### Steps to reproduce the bug from datasets import get_dataset_config_names get_dataset_config_names('tsor13/test') ### Expected behavior I would expect there to be two splits, `main_data` and `additional_data`. However, only `['tsor13--test']` test is returned. ### Environment info - `datasets` version: 2.14.4 - Platform: macOS-13.4-arm64-arm-64bit - Python version: 3.11.4 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 1.5.1 hi @tsor13 , I haven't been able to reproduce your issue on `tsor13/test` dataset locally either. reinstalling doesn't help?
https://github.com/huggingface/datasets/issues/6162
load_dataset('json',...) from togethercomputer/RedPajama-Data-1T errors when jsonl rows contains different data fields
Hi ! Feel free to open a discussion at https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T/discussions to ask the file to be fixed (or directly open a PR with the fixed file) `datasets` expects all the examples to have the same fields
### Describe the bug When loading some jsonl from redpajama-data-1T github source [togethercomputer/RedPajama-Data-1T](https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T) fails due to one row of the file containing an extra field called **symlink_target: string>**. When deleting that line the loading is successful. We also tried loading this file with the discrepancy using this function and it is successful ```python os.environ["RED_PAJAMA_DATA_DIR"] ="/path_to_local_copy_of_RedPajama-Data-1T" ds = load_dataset('togethercomputer/RedPajama-Data-1T', 'github',cache_dir="/path_to_folder_with_jsonl",streaming=True)['train'] ``` ### Steps to reproduce the bug Steps to reproduce the behavior: 1. Load one jsonl from the redpajama-data-1T ```bash wget https://data.together.xyz/redpajama-data-1T/v1.0.0/github/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl ``` 2.Load dataset will give error: ```python from datasets import load_dataset ds = load_dataset('json', data_files='/path_to/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl') ``` _TypeError: Couldn't cast array of type Struct <content_hash: string, timestamp: string, source: string, line_count: int64, max_line_length: int64, avg_line_length: double, alnum_prop: double, repo_name: string, id: string, size: string, binary: bool, copies: string, ref: string, path: string, mode: string, license: string, language: list<item: struct<name: string, bytes: string>>, **symlink_target: string>** to {'content_hash': Value(dtype='string', id=None), 'timestamp': Value(dtype='string', id=None), 'source': Value(dtype='string', id=None), 'line_count': Value(dtype='int64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'alnum_prop': Value(dtype='float64', id=None), 'repo_name': Value(dtype='string', id=None), 'id': Value(dtype='string', id=None), 'size': Value(dtype='string', id=None), 'binary': Value(dtype='bool', id=None), 'copies': Value(dtype='string', id=None), 'ref': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'mode': Value(dtype='string', id=None), 'license': Value(dtype='string', id=None), 'language': [{'name': Value(dtype='string', id=None), 'bytes': Value(dtype='string', id=None)}]}_ 3. To remove the line causing the problem that includes the **symlink_target: string>** do: ```bash sed -i '112252d' filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl ``` 4. Rerun the loading function now is succesful: ```python from datasets import load_dataset ds = load_dataset('json', data_files='/path_to/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl') ``` ### Expected behavior Have a clean dataset without discrepancies on the jsonl fields or have the load_dataset('json',...) method not error out. ### Environment info - `datasets` version: 2.14.1 - Platform: Linux-4.18.0-425.13.1.el8_7.x86_64-x86_64-with-glibc2.28 - Python version: 3.9.17 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 2.0.3
36
load_dataset('json',...) from togethercomputer/RedPajama-Data-1T errors when jsonl rows contains different data fields ### Describe the bug When loading some jsonl from redpajama-data-1T github source [togethercomputer/RedPajama-Data-1T](https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T) fails due to one row of the file containing an extra field called **symlink_target: string>**. When deleting that line the loading is successful. We also tried loading this file with the discrepancy using this function and it is successful ```python os.environ["RED_PAJAMA_DATA_DIR"] ="/path_to_local_copy_of_RedPajama-Data-1T" ds = load_dataset('togethercomputer/RedPajama-Data-1T', 'github',cache_dir="/path_to_folder_with_jsonl",streaming=True)['train'] ``` ### Steps to reproduce the bug Steps to reproduce the behavior: 1. Load one jsonl from the redpajama-data-1T ```bash wget https://data.together.xyz/redpajama-data-1T/v1.0.0/github/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl ``` 2.Load dataset will give error: ```python from datasets import load_dataset ds = load_dataset('json', data_files='/path_to/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl') ``` _TypeError: Couldn't cast array of type Struct <content_hash: string, timestamp: string, source: string, line_count: int64, max_line_length: int64, avg_line_length: double, alnum_prop: double, repo_name: string, id: string, size: string, binary: bool, copies: string, ref: string, path: string, mode: string, license: string, language: list<item: struct<name: string, bytes: string>>, **symlink_target: string>** to {'content_hash': Value(dtype='string', id=None), 'timestamp': Value(dtype='string', id=None), 'source': Value(dtype='string', id=None), 'line_count': Value(dtype='int64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'alnum_prop': Value(dtype='float64', id=None), 'repo_name': Value(dtype='string', id=None), 'id': Value(dtype='string', id=None), 'size': Value(dtype='string', id=None), 'binary': Value(dtype='bool', id=None), 'copies': Value(dtype='string', id=None), 'ref': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'mode': Value(dtype='string', id=None), 'license': Value(dtype='string', id=None), 'language': [{'name': Value(dtype='string', id=None), 'bytes': Value(dtype='string', id=None)}]}_ 3. To remove the line causing the problem that includes the **symlink_target: string>** do: ```bash sed -i '112252d' filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl ``` 4. Rerun the loading function now is succesful: ```python from datasets import load_dataset ds = load_dataset('json', data_files='/path_to/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl') ``` ### Expected behavior Have a clean dataset without discrepancies on the jsonl fields or have the load_dataset('json',...) method not error out. ### Environment info - `datasets` version: 2.14.1 - Platform: Linux-4.18.0-425.13.1.el8_7.x86_64-x86_64-with-glibc2.28 - Python version: 3.9.17 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 2.0.3 Hi ! Feel free to open a discussion at https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T/discussions to ask the file to be fixed (or directly open a PR with the fixed file) `datasets` expects all the examples to have the same fields
https://github.com/huggingface/datasets/issues/6162
load_dataset('json',...) from togethercomputer/RedPajama-Data-1T errors when jsonl rows contains different data fields
@lhoestq I think the problem is caused by the fact that hugging face datasets writes a copy of data to the local cache using pyarrow. And the data scheme is inferred from the first few data blocks as can be seen [here](https://github.com/huggingface/datasets/blob/main/src/datasets/arrow_writer.py#L570). Maybe setting `streaming=True` can workaround this problem. Would you agree with my statement?
### Describe the bug When loading some jsonl from redpajama-data-1T github source [togethercomputer/RedPajama-Data-1T](https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T) fails due to one row of the file containing an extra field called **symlink_target: string>**. When deleting that line the loading is successful. We also tried loading this file with the discrepancy using this function and it is successful ```python os.environ["RED_PAJAMA_DATA_DIR"] ="/path_to_local_copy_of_RedPajama-Data-1T" ds = load_dataset('togethercomputer/RedPajama-Data-1T', 'github',cache_dir="/path_to_folder_with_jsonl",streaming=True)['train'] ``` ### Steps to reproduce the bug Steps to reproduce the behavior: 1. Load one jsonl from the redpajama-data-1T ```bash wget https://data.together.xyz/redpajama-data-1T/v1.0.0/github/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl ``` 2.Load dataset will give error: ```python from datasets import load_dataset ds = load_dataset('json', data_files='/path_to/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl') ``` _TypeError: Couldn't cast array of type Struct <content_hash: string, timestamp: string, source: string, line_count: int64, max_line_length: int64, avg_line_length: double, alnum_prop: double, repo_name: string, id: string, size: string, binary: bool, copies: string, ref: string, path: string, mode: string, license: string, language: list<item: struct<name: string, bytes: string>>, **symlink_target: string>** to {'content_hash': Value(dtype='string', id=None), 'timestamp': Value(dtype='string', id=None), 'source': Value(dtype='string', id=None), 'line_count': Value(dtype='int64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'alnum_prop': Value(dtype='float64', id=None), 'repo_name': Value(dtype='string', id=None), 'id': Value(dtype='string', id=None), 'size': Value(dtype='string', id=None), 'binary': Value(dtype='bool', id=None), 'copies': Value(dtype='string', id=None), 'ref': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'mode': Value(dtype='string', id=None), 'license': Value(dtype='string', id=None), 'language': [{'name': Value(dtype='string', id=None), 'bytes': Value(dtype='string', id=None)}]}_ 3. To remove the line causing the problem that includes the **symlink_target: string>** do: ```bash sed -i '112252d' filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl ``` 4. Rerun the loading function now is succesful: ```python from datasets import load_dataset ds = load_dataset('json', data_files='/path_to/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl') ``` ### Expected behavior Have a clean dataset without discrepancies on the jsonl fields or have the load_dataset('json',...) method not error out. ### Environment info - `datasets` version: 2.14.1 - Platform: Linux-4.18.0-425.13.1.el8_7.x86_64-x86_64-with-glibc2.28 - Python version: 3.9.17 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 2.0.3
55
load_dataset('json',...) from togethercomputer/RedPajama-Data-1T errors when jsonl rows contains different data fields ### Describe the bug When loading some jsonl from redpajama-data-1T github source [togethercomputer/RedPajama-Data-1T](https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T) fails due to one row of the file containing an extra field called **symlink_target: string>**. When deleting that line the loading is successful. We also tried loading this file with the discrepancy using this function and it is successful ```python os.environ["RED_PAJAMA_DATA_DIR"] ="/path_to_local_copy_of_RedPajama-Data-1T" ds = load_dataset('togethercomputer/RedPajama-Data-1T', 'github',cache_dir="/path_to_folder_with_jsonl",streaming=True)['train'] ``` ### Steps to reproduce the bug Steps to reproduce the behavior: 1. Load one jsonl from the redpajama-data-1T ```bash wget https://data.together.xyz/redpajama-data-1T/v1.0.0/github/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl ``` 2.Load dataset will give error: ```python from datasets import load_dataset ds = load_dataset('json', data_files='/path_to/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl') ``` _TypeError: Couldn't cast array of type Struct <content_hash: string, timestamp: string, source: string, line_count: int64, max_line_length: int64, avg_line_length: double, alnum_prop: double, repo_name: string, id: string, size: string, binary: bool, copies: string, ref: string, path: string, mode: string, license: string, language: list<item: struct<name: string, bytes: string>>, **symlink_target: string>** to {'content_hash': Value(dtype='string', id=None), 'timestamp': Value(dtype='string', id=None), 'source': Value(dtype='string', id=None), 'line_count': Value(dtype='int64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'alnum_prop': Value(dtype='float64', id=None), 'repo_name': Value(dtype='string', id=None), 'id': Value(dtype='string', id=None), 'size': Value(dtype='string', id=None), 'binary': Value(dtype='bool', id=None), 'copies': Value(dtype='string', id=None), 'ref': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'mode': Value(dtype='string', id=None), 'license': Value(dtype='string', id=None), 'language': [{'name': Value(dtype='string', id=None), 'bytes': Value(dtype='string', id=None)}]}_ 3. To remove the line causing the problem that includes the **symlink_target: string>** do: ```bash sed -i '112252d' filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl ``` 4. Rerun the loading function now is succesful: ```python from datasets import load_dataset ds = load_dataset('json', data_files='/path_to/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl') ``` ### Expected behavior Have a clean dataset without discrepancies on the jsonl fields or have the load_dataset('json',...) method not error out. ### Environment info - `datasets` version: 2.14.1 - Platform: Linux-4.18.0-425.13.1.el8_7.x86_64-x86_64-with-glibc2.28 - Python version: 3.9.17 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 2.0.3 @lhoestq I think the problem is caused by the fact that hugging face datasets writes a copy of data to the local cache using pyarrow. And the data scheme is inferred from the first few data blocks as can be seen [here](https://github.com/huggingface/datasets/blob/main/src/datasets/arrow_writer.py#L570). Maybe setting `streaming=True` can workaround this problem. Would you agree with my statement?
https://github.com/huggingface/datasets/issues/6162
load_dataset('json',...) from togethercomputer/RedPajama-Data-1T errors when jsonl rows contains different data fields
> @lhoestq I think the problem is caused by the fact that hugging face datasets writes a copy of data to the local cache using pyarrow. And the data scheme is inferred from the first few data blocks as can be seen [here](https://github.com/huggingface/datasets/blob/main/src/datasets/arrow_writer.py#L570). Correct. Therefore any example that doesn't follow the inferred schema will make the code fail. > Maybe setting streaming=True can workaround this problem. Would you agree with my statement? You'll meet the same problem but later - when streaming and arriving at the problematic example
### Describe the bug When loading some jsonl from redpajama-data-1T github source [togethercomputer/RedPajama-Data-1T](https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T) fails due to one row of the file containing an extra field called **symlink_target: string>**. When deleting that line the loading is successful. We also tried loading this file with the discrepancy using this function and it is successful ```python os.environ["RED_PAJAMA_DATA_DIR"] ="/path_to_local_copy_of_RedPajama-Data-1T" ds = load_dataset('togethercomputer/RedPajama-Data-1T', 'github',cache_dir="/path_to_folder_with_jsonl",streaming=True)['train'] ``` ### Steps to reproduce the bug Steps to reproduce the behavior: 1. Load one jsonl from the redpajama-data-1T ```bash wget https://data.together.xyz/redpajama-data-1T/v1.0.0/github/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl ``` 2.Load dataset will give error: ```python from datasets import load_dataset ds = load_dataset('json', data_files='/path_to/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl') ``` _TypeError: Couldn't cast array of type Struct <content_hash: string, timestamp: string, source: string, line_count: int64, max_line_length: int64, avg_line_length: double, alnum_prop: double, repo_name: string, id: string, size: string, binary: bool, copies: string, ref: string, path: string, mode: string, license: string, language: list<item: struct<name: string, bytes: string>>, **symlink_target: string>** to {'content_hash': Value(dtype='string', id=None), 'timestamp': Value(dtype='string', id=None), 'source': Value(dtype='string', id=None), 'line_count': Value(dtype='int64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'alnum_prop': Value(dtype='float64', id=None), 'repo_name': Value(dtype='string', id=None), 'id': Value(dtype='string', id=None), 'size': Value(dtype='string', id=None), 'binary': Value(dtype='bool', id=None), 'copies': Value(dtype='string', id=None), 'ref': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'mode': Value(dtype='string', id=None), 'license': Value(dtype='string', id=None), 'language': [{'name': Value(dtype='string', id=None), 'bytes': Value(dtype='string', id=None)}]}_ 3. To remove the line causing the problem that includes the **symlink_target: string>** do: ```bash sed -i '112252d' filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl ``` 4. Rerun the loading function now is succesful: ```python from datasets import load_dataset ds = load_dataset('json', data_files='/path_to/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl') ``` ### Expected behavior Have a clean dataset without discrepancies on the jsonl fields or have the load_dataset('json',...) method not error out. ### Environment info - `datasets` version: 2.14.1 - Platform: Linux-4.18.0-425.13.1.el8_7.x86_64-x86_64-with-glibc2.28 - Python version: 3.9.17 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 2.0.3
88
load_dataset('json',...) from togethercomputer/RedPajama-Data-1T errors when jsonl rows contains different data fields ### Describe the bug When loading some jsonl from redpajama-data-1T github source [togethercomputer/RedPajama-Data-1T](https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T) fails due to one row of the file containing an extra field called **symlink_target: string>**. When deleting that line the loading is successful. We also tried loading this file with the discrepancy using this function and it is successful ```python os.environ["RED_PAJAMA_DATA_DIR"] ="/path_to_local_copy_of_RedPajama-Data-1T" ds = load_dataset('togethercomputer/RedPajama-Data-1T', 'github',cache_dir="/path_to_folder_with_jsonl",streaming=True)['train'] ``` ### Steps to reproduce the bug Steps to reproduce the behavior: 1. Load one jsonl from the redpajama-data-1T ```bash wget https://data.together.xyz/redpajama-data-1T/v1.0.0/github/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl ``` 2.Load dataset will give error: ```python from datasets import load_dataset ds = load_dataset('json', data_files='/path_to/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl') ``` _TypeError: Couldn't cast array of type Struct <content_hash: string, timestamp: string, source: string, line_count: int64, max_line_length: int64, avg_line_length: double, alnum_prop: double, repo_name: string, id: string, size: string, binary: bool, copies: string, ref: string, path: string, mode: string, license: string, language: list<item: struct<name: string, bytes: string>>, **symlink_target: string>** to {'content_hash': Value(dtype='string', id=None), 'timestamp': Value(dtype='string', id=None), 'source': Value(dtype='string', id=None), 'line_count': Value(dtype='int64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'alnum_prop': Value(dtype='float64', id=None), 'repo_name': Value(dtype='string', id=None), 'id': Value(dtype='string', id=None), 'size': Value(dtype='string', id=None), 'binary': Value(dtype='bool', id=None), 'copies': Value(dtype='string', id=None), 'ref': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'mode': Value(dtype='string', id=None), 'license': Value(dtype='string', id=None), 'language': [{'name': Value(dtype='string', id=None), 'bytes': Value(dtype='string', id=None)}]}_ 3. To remove the line causing the problem that includes the **symlink_target: string>** do: ```bash sed -i '112252d' filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl ``` 4. Rerun the loading function now is succesful: ```python from datasets import load_dataset ds = load_dataset('json', data_files='/path_to/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl') ``` ### Expected behavior Have a clean dataset without discrepancies on the jsonl fields or have the load_dataset('json',...) method not error out. ### Environment info - `datasets` version: 2.14.1 - Platform: Linux-4.18.0-425.13.1.el8_7.x86_64-x86_64-with-glibc2.28 - Python version: 3.9.17 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 2.0.3 > @lhoestq I think the problem is caused by the fact that hugging face datasets writes a copy of data to the local cache using pyarrow. And the data scheme is inferred from the first few data blocks as can be seen [here](https://github.com/huggingface/datasets/blob/main/src/datasets/arrow_writer.py#L570). Correct. Therefore any example that doesn't follow the inferred schema will make the code fail. > Maybe setting streaming=True can workaround this problem. Would you agree with my statement? You'll meet the same problem but later - when streaming and arriving at the problematic example
https://github.com/huggingface/datasets/issues/6162
load_dataset('json',...) from togethercomputer/RedPajama-Data-1T errors when jsonl rows contains different data fields
@lhoestq I just run below test with streaming=True and is not failing at the problematic example ```python ds = load_dataset('json', data_files='/path_to_local_RedPajamaData/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl', streaming=True) count = 0 for i in ds['train']: count += 1 print(count) ``` and completes the 262241 samples successfully. It does error our when streaming is not used
### Describe the bug When loading some jsonl from redpajama-data-1T github source [togethercomputer/RedPajama-Data-1T](https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T) fails due to one row of the file containing an extra field called **symlink_target: string>**. When deleting that line the loading is successful. We also tried loading this file with the discrepancy using this function and it is successful ```python os.environ["RED_PAJAMA_DATA_DIR"] ="/path_to_local_copy_of_RedPajama-Data-1T" ds = load_dataset('togethercomputer/RedPajama-Data-1T', 'github',cache_dir="/path_to_folder_with_jsonl",streaming=True)['train'] ``` ### Steps to reproduce the bug Steps to reproduce the behavior: 1. Load one jsonl from the redpajama-data-1T ```bash wget https://data.together.xyz/redpajama-data-1T/v1.0.0/github/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl ``` 2.Load dataset will give error: ```python from datasets import load_dataset ds = load_dataset('json', data_files='/path_to/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl') ``` _TypeError: Couldn't cast array of type Struct <content_hash: string, timestamp: string, source: string, line_count: int64, max_line_length: int64, avg_line_length: double, alnum_prop: double, repo_name: string, id: string, size: string, binary: bool, copies: string, ref: string, path: string, mode: string, license: string, language: list<item: struct<name: string, bytes: string>>, **symlink_target: string>** to {'content_hash': Value(dtype='string', id=None), 'timestamp': Value(dtype='string', id=None), 'source': Value(dtype='string', id=None), 'line_count': Value(dtype='int64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'alnum_prop': Value(dtype='float64', id=None), 'repo_name': Value(dtype='string', id=None), 'id': Value(dtype='string', id=None), 'size': Value(dtype='string', id=None), 'binary': Value(dtype='bool', id=None), 'copies': Value(dtype='string', id=None), 'ref': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'mode': Value(dtype='string', id=None), 'license': Value(dtype='string', id=None), 'language': [{'name': Value(dtype='string', id=None), 'bytes': Value(dtype='string', id=None)}]}_ 3. To remove the line causing the problem that includes the **symlink_target: string>** do: ```bash sed -i '112252d' filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl ``` 4. Rerun the loading function now is succesful: ```python from datasets import load_dataset ds = load_dataset('json', data_files='/path_to/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl') ``` ### Expected behavior Have a clean dataset without discrepancies on the jsonl fields or have the load_dataset('json',...) method not error out. ### Environment info - `datasets` version: 2.14.1 - Platform: Linux-4.18.0-425.13.1.el8_7.x86_64-x86_64-with-glibc2.28 - Python version: 3.9.17 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 2.0.3
49
load_dataset('json',...) from togethercomputer/RedPajama-Data-1T errors when jsonl rows contains different data fields ### Describe the bug When loading some jsonl from redpajama-data-1T github source [togethercomputer/RedPajama-Data-1T](https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T) fails due to one row of the file containing an extra field called **symlink_target: string>**. When deleting that line the loading is successful. We also tried loading this file with the discrepancy using this function and it is successful ```python os.environ["RED_PAJAMA_DATA_DIR"] ="/path_to_local_copy_of_RedPajama-Data-1T" ds = load_dataset('togethercomputer/RedPajama-Data-1T', 'github',cache_dir="/path_to_folder_with_jsonl",streaming=True)['train'] ``` ### Steps to reproduce the bug Steps to reproduce the behavior: 1. Load one jsonl from the redpajama-data-1T ```bash wget https://data.together.xyz/redpajama-data-1T/v1.0.0/github/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl ``` 2.Load dataset will give error: ```python from datasets import load_dataset ds = load_dataset('json', data_files='/path_to/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl') ``` _TypeError: Couldn't cast array of type Struct <content_hash: string, timestamp: string, source: string, line_count: int64, max_line_length: int64, avg_line_length: double, alnum_prop: double, repo_name: string, id: string, size: string, binary: bool, copies: string, ref: string, path: string, mode: string, license: string, language: list<item: struct<name: string, bytes: string>>, **symlink_target: string>** to {'content_hash': Value(dtype='string', id=None), 'timestamp': Value(dtype='string', id=None), 'source': Value(dtype='string', id=None), 'line_count': Value(dtype='int64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'alnum_prop': Value(dtype='float64', id=None), 'repo_name': Value(dtype='string', id=None), 'id': Value(dtype='string', id=None), 'size': Value(dtype='string', id=None), 'binary': Value(dtype='bool', id=None), 'copies': Value(dtype='string', id=None), 'ref': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'mode': Value(dtype='string', id=None), 'license': Value(dtype='string', id=None), 'language': [{'name': Value(dtype='string', id=None), 'bytes': Value(dtype='string', id=None)}]}_ 3. To remove the line causing the problem that includes the **symlink_target: string>** do: ```bash sed -i '112252d' filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl ``` 4. Rerun the loading function now is succesful: ```python from datasets import load_dataset ds = load_dataset('json', data_files='/path_to/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl') ``` ### Expected behavior Have a clean dataset without discrepancies on the jsonl fields or have the load_dataset('json',...) method not error out. ### Environment info - `datasets` version: 2.14.1 - Platform: Linux-4.18.0-425.13.1.el8_7.x86_64-x86_64-with-glibc2.28 - Python version: 3.9.17 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 2.0.3 @lhoestq I just run below test with streaming=True and is not failing at the problematic example ```python ds = load_dataset('json', data_files='/path_to_local_RedPajamaData/filtered_27f05c041a1c401783f90b9415e40e4b.sampled.jsonl', streaming=True) count = 0 for i in ds['train']: count += 1 print(count) ``` and completes the 262241 samples successfully. It does error our when streaming is not used
https://github.com/huggingface/datasets/issues/6157
DatasetInfo.__init__() got an unexpected keyword argument '_column_requires_decoding'
Thanks for reporting, but we can only fix this issue if you can provide a reproducer that consistently reproduces it.
### Describe the bug When I was in load_dataset, it said "DatasetInfo.__init__() got an unexpected keyword argument '_column_requires_decoding'". The second time I ran it, there was no error and the dataset object worked ### Steps to reproduce the bug /home/aihao/workspace/DeepLearningContent/datasets/images/images.py ```python from logging import config import datasets import os from PIL import Image import csv import json class ImagesConfig(datasets.BuilderConfig): def __init__(self, **kwargs): super(ImagesConfig, self).__init__(**kwargs) class Images(datasets.GeneratorBasedBuilder): def _split_generators(self, dl_manager: datasets.DownloadManager): return [ datasets.SplitGenerator( name=datasets.Split.TRAIN, gen_kwargs={"split": datasets.Split.TRAIN}, ) ] BUILDER_CONFIGS = [ ImagesConfig( name="similar_pairs", description="simliar pair dataset,item is a pair of similar images", ), ImagesConfig( name="image_prompt_pairs", description="image prompt pairs", ), ] def _info(self): if self.config.name == "similar_pairs": return datasets.Features( { "image1": datasets.features.Image(), "image2": datasets.features.Image(), "similarity": datasets.Value("float32"), } ) elif self.config.name == "image_prompt_pairs": return datasets.Features( {"image": datasets.features.Image(), "prompt": datasets.Value("string")} ) def _generate_examples(self, split): data_path = os.path.join(self.config.data_dir, "data") if self.config.name == "similar_pairs": prompts = {} with open(os.path.join(data_path ,"prompts.json"), "r") as f: prompts = json.load(f) with open(os.path.join(data_path, "similar_pairs.csv"), "r") as f: reader = csv.reader(f) for row in reader: image1_path, image2_path, similarity = row yield image1_path + ":" + image2_path + ":", { "image1": Image.open(image1_path), "prompt1": prompts[image1_path], "image2": Image.open(image2_path), "prompt2": prompts[image2_path], "similarity": float(similarity), } ``` Code that indicates an error: ```python from datasets import load_dataset import json import csv import ast import torch data_dir = "/home/aihao/workspace/DeepLearningContent/datasets/images" dataset = load_dataset(data_dir, data_dir=data_dir, name="similar_pairs") ``` ### Expected behavior The first execution gives an error, but it works fine ### Environment info - `datasets` version: 2.14.3 - Platform: Linux-6.2.0-26-generic-x86_64-with-glibc2.35 - Python version: 3.11.4 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 2.0.3
20
DatasetInfo.__init__() got an unexpected keyword argument '_column_requires_decoding' ### Describe the bug When I was in load_dataset, it said "DatasetInfo.__init__() got an unexpected keyword argument '_column_requires_decoding'". The second time I ran it, there was no error and the dataset object worked ### Steps to reproduce the bug /home/aihao/workspace/DeepLearningContent/datasets/images/images.py ```python from logging import config import datasets import os from PIL import Image import csv import json class ImagesConfig(datasets.BuilderConfig): def __init__(self, **kwargs): super(ImagesConfig, self).__init__(**kwargs) class Images(datasets.GeneratorBasedBuilder): def _split_generators(self, dl_manager: datasets.DownloadManager): return [ datasets.SplitGenerator( name=datasets.Split.TRAIN, gen_kwargs={"split": datasets.Split.TRAIN}, ) ] BUILDER_CONFIGS = [ ImagesConfig( name="similar_pairs", description="simliar pair dataset,item is a pair of similar images", ), ImagesConfig( name="image_prompt_pairs", description="image prompt pairs", ), ] def _info(self): if self.config.name == "similar_pairs": return datasets.Features( { "image1": datasets.features.Image(), "image2": datasets.features.Image(), "similarity": datasets.Value("float32"), } ) elif self.config.name == "image_prompt_pairs": return datasets.Features( {"image": datasets.features.Image(), "prompt": datasets.Value("string")} ) def _generate_examples(self, split): data_path = os.path.join(self.config.data_dir, "data") if self.config.name == "similar_pairs": prompts = {} with open(os.path.join(data_path ,"prompts.json"), "r") as f: prompts = json.load(f) with open(os.path.join(data_path, "similar_pairs.csv"), "r") as f: reader = csv.reader(f) for row in reader: image1_path, image2_path, similarity = row yield image1_path + ":" + image2_path + ":", { "image1": Image.open(image1_path), "prompt1": prompts[image1_path], "image2": Image.open(image2_path), "prompt2": prompts[image2_path], "similarity": float(similarity), } ``` Code that indicates an error: ```python from datasets import load_dataset import json import csv import ast import torch data_dir = "/home/aihao/workspace/DeepLearningContent/datasets/images" dataset = load_dataset(data_dir, data_dir=data_dir, name="similar_pairs") ``` ### Expected behavior The first execution gives an error, but it works fine ### Environment info - `datasets` version: 2.14.3 - Platform: Linux-6.2.0-26-generic-x86_64-with-glibc2.35 - Python version: 3.11.4 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 2.0.3 Thanks for reporting, but we can only fix this issue if you can provide a reproducer that consistently reproduces it.
https://github.com/huggingface/datasets/issues/6157
DatasetInfo.__init__() got an unexpected keyword argument '_column_requires_decoding'
Does this error occur even if you change the cache directory (the `cache_dir` parameter in `load_dataset`)?
### Describe the bug When I was in load_dataset, it said "DatasetInfo.__init__() got an unexpected keyword argument '_column_requires_decoding'". The second time I ran it, there was no error and the dataset object worked ### Steps to reproduce the bug /home/aihao/workspace/DeepLearningContent/datasets/images/images.py ```python from logging import config import datasets import os from PIL import Image import csv import json class ImagesConfig(datasets.BuilderConfig): def __init__(self, **kwargs): super(ImagesConfig, self).__init__(**kwargs) class Images(datasets.GeneratorBasedBuilder): def _split_generators(self, dl_manager: datasets.DownloadManager): return [ datasets.SplitGenerator( name=datasets.Split.TRAIN, gen_kwargs={"split": datasets.Split.TRAIN}, ) ] BUILDER_CONFIGS = [ ImagesConfig( name="similar_pairs", description="simliar pair dataset,item is a pair of similar images", ), ImagesConfig( name="image_prompt_pairs", description="image prompt pairs", ), ] def _info(self): if self.config.name == "similar_pairs": return datasets.Features( { "image1": datasets.features.Image(), "image2": datasets.features.Image(), "similarity": datasets.Value("float32"), } ) elif self.config.name == "image_prompt_pairs": return datasets.Features( {"image": datasets.features.Image(), "prompt": datasets.Value("string")} ) def _generate_examples(self, split): data_path = os.path.join(self.config.data_dir, "data") if self.config.name == "similar_pairs": prompts = {} with open(os.path.join(data_path ,"prompts.json"), "r") as f: prompts = json.load(f) with open(os.path.join(data_path, "similar_pairs.csv"), "r") as f: reader = csv.reader(f) for row in reader: image1_path, image2_path, similarity = row yield image1_path + ":" + image2_path + ":", { "image1": Image.open(image1_path), "prompt1": prompts[image1_path], "image2": Image.open(image2_path), "prompt2": prompts[image2_path], "similarity": float(similarity), } ``` Code that indicates an error: ```python from datasets import load_dataset import json import csv import ast import torch data_dir = "/home/aihao/workspace/DeepLearningContent/datasets/images" dataset = load_dataset(data_dir, data_dir=data_dir, name="similar_pairs") ``` ### Expected behavior The first execution gives an error, but it works fine ### Environment info - `datasets` version: 2.14.3 - Platform: Linux-6.2.0-26-generic-x86_64-with-glibc2.35 - Python version: 3.11.4 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 2.0.3
16
DatasetInfo.__init__() got an unexpected keyword argument '_column_requires_decoding' ### Describe the bug When I was in load_dataset, it said "DatasetInfo.__init__() got an unexpected keyword argument '_column_requires_decoding'". The second time I ran it, there was no error and the dataset object worked ### Steps to reproduce the bug /home/aihao/workspace/DeepLearningContent/datasets/images/images.py ```python from logging import config import datasets import os from PIL import Image import csv import json class ImagesConfig(datasets.BuilderConfig): def __init__(self, **kwargs): super(ImagesConfig, self).__init__(**kwargs) class Images(datasets.GeneratorBasedBuilder): def _split_generators(self, dl_manager: datasets.DownloadManager): return [ datasets.SplitGenerator( name=datasets.Split.TRAIN, gen_kwargs={"split": datasets.Split.TRAIN}, ) ] BUILDER_CONFIGS = [ ImagesConfig( name="similar_pairs", description="simliar pair dataset,item is a pair of similar images", ), ImagesConfig( name="image_prompt_pairs", description="image prompt pairs", ), ] def _info(self): if self.config.name == "similar_pairs": return datasets.Features( { "image1": datasets.features.Image(), "image2": datasets.features.Image(), "similarity": datasets.Value("float32"), } ) elif self.config.name == "image_prompt_pairs": return datasets.Features( {"image": datasets.features.Image(), "prompt": datasets.Value("string")} ) def _generate_examples(self, split): data_path = os.path.join(self.config.data_dir, "data") if self.config.name == "similar_pairs": prompts = {} with open(os.path.join(data_path ,"prompts.json"), "r") as f: prompts = json.load(f) with open(os.path.join(data_path, "similar_pairs.csv"), "r") as f: reader = csv.reader(f) for row in reader: image1_path, image2_path, similarity = row yield image1_path + ":" + image2_path + ":", { "image1": Image.open(image1_path), "prompt1": prompts[image1_path], "image2": Image.open(image2_path), "prompt2": prompts[image2_path], "similarity": float(similarity), } ``` Code that indicates an error: ```python from datasets import load_dataset import json import csv import ast import torch data_dir = "/home/aihao/workspace/DeepLearningContent/datasets/images" dataset = load_dataset(data_dir, data_dir=data_dir, name="similar_pairs") ``` ### Expected behavior The first execution gives an error, but it works fine ### Environment info - `datasets` version: 2.14.3 - Platform: Linux-6.2.0-26-generic-x86_64-with-glibc2.35 - Python version: 3.11.4 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 2.0.3 Does this error occur even if you change the cache directory (the `cache_dir` parameter in `load_dataset`)?
https://github.com/huggingface/datasets/issues/6156
Why not use self._epoch as seed to shuffle in distributed training with IterableDataset
`_effective_generator` returns a RNG that takes into account `self._epoch` and the current dataset's base shuffling RNG (which can be set by specifying `seed=` in `.shuffle() for example`). To fix your error you can pass `seed=` to `.shuffle()`. And the shuffling will depend on both this seed and `self._epoch`
### Describe the bug Currently, distributed training with `IterableDataset` needs to pass fixed seed to shuffle to keep each node use the same seed to avoid overlapping. https://github.com/huggingface/datasets/blob/a7f8d9019e7cb104eac4106bdc6ec0292f0dc61a/src/datasets/iterable_dataset.py#L1174-L1177 My question is why not directly use `self._epoch` which is set by `set_epoch` as seed? It's almost the same across nodes. https://github.com/huggingface/datasets/blob/a7f8d9019e7cb104eac4106bdc6ec0292f0dc61a/src/datasets/iterable_dataset.py#L1790-L1801 If not using `self._epoch` as shuffling seed, what does this method do to prepare an epoch seeded generator? https://github.com/huggingface/datasets/blob/a7f8d9019e7cb104eac4106bdc6ec0292f0dc61a/src/datasets/iterable_dataset.py#L1206 ### Steps to reproduce the bug As mentioned above. ### Expected behavior As mentioned above. ### Environment info Not related
48
Why not use self._epoch as seed to shuffle in distributed training with IterableDataset ### Describe the bug Currently, distributed training with `IterableDataset` needs to pass fixed seed to shuffle to keep each node use the same seed to avoid overlapping. https://github.com/huggingface/datasets/blob/a7f8d9019e7cb104eac4106bdc6ec0292f0dc61a/src/datasets/iterable_dataset.py#L1174-L1177 My question is why not directly use `self._epoch` which is set by `set_epoch` as seed? It's almost the same across nodes. https://github.com/huggingface/datasets/blob/a7f8d9019e7cb104eac4106bdc6ec0292f0dc61a/src/datasets/iterable_dataset.py#L1790-L1801 If not using `self._epoch` as shuffling seed, what does this method do to prepare an epoch seeded generator? https://github.com/huggingface/datasets/blob/a7f8d9019e7cb104eac4106bdc6ec0292f0dc61a/src/datasets/iterable_dataset.py#L1206 ### Steps to reproduce the bug As mentioned above. ### Expected behavior As mentioned above. ### Environment info Not related `_effective_generator` returns a RNG that takes into account `self._epoch` and the current dataset's base shuffling RNG (which can be set by specifying `seed=` in `.shuffle() for example`). To fix your error you can pass `seed=` to `.shuffle()`. And the shuffling will depend on both this seed and `self._epoch`
https://github.com/huggingface/datasets/issues/6152
FolderBase Dataset automatically resolves under current directory when data_dir is not specified
Makes sense, I guess this can be fixed in the load_dataset_builder method. It concerns every packaged builder I think (see values in `_PACKAGED_DATASETS_MODULES`)
### Describe the bug FolderBase Dataset automatically resolves under current directory when data_dir is not specified. For example: ``` load_dataset("audiofolder") ``` takes long time to resolve and collect data_files from current directory. But I think it should reach out to this line for error handling https://github.com/huggingface/datasets/blob/cb8c5de5145c7e7eee65391cb7f4d92f0d565d62/src/datasets/packaged_modules/folder_based_builder/folder_based_builder.py#L58-L59 ### Steps to reproduce the bug ``` load_dataset("audiofolder") ``` ### Expected behavior Error report ### Environment info - `datasets` version: 2.14.4 - Platform: Linux-5.15.0-78-generic-x86_64-with-glibc2.17 - Python version: 3.8.15 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 1.5.3
23
FolderBase Dataset automatically resolves under current directory when data_dir is not specified ### Describe the bug FolderBase Dataset automatically resolves under current directory when data_dir is not specified. For example: ``` load_dataset("audiofolder") ``` takes long time to resolve and collect data_files from current directory. But I think it should reach out to this line for error handling https://github.com/huggingface/datasets/blob/cb8c5de5145c7e7eee65391cb7f4d92f0d565d62/src/datasets/packaged_modules/folder_based_builder/folder_based_builder.py#L58-L59 ### Steps to reproduce the bug ``` load_dataset("audiofolder") ``` ### Expected behavior Error report ### Environment info - `datasets` version: 2.14.4 - Platform: Linux-5.15.0-78-generic-x86_64-with-glibc2.17 - Python version: 3.8.15 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 1.5.3 Makes sense, I guess this can be fixed in the load_dataset_builder method. It concerns every packaged builder I think (see values in `_PACKAGED_DATASETS_MODULES`)
https://github.com/huggingface/datasets/issues/6152
FolderBase Dataset automatically resolves under current directory when data_dir is not specified
I think the behavior is related to these lines, which short circuited the error handling. https://github.com/huggingface/datasets/blob/664a1cb72ea1e6ef7c47e671e2686ca4a35e8d63/src/datasets/load.py#L946-L952 So should data_dir be checked here or still delegating to actual `DatasetModule`? In that case, how to properly set `data_files` here.
### Describe the bug FolderBase Dataset automatically resolves under current directory when data_dir is not specified. For example: ``` load_dataset("audiofolder") ``` takes long time to resolve and collect data_files from current directory. But I think it should reach out to this line for error handling https://github.com/huggingface/datasets/blob/cb8c5de5145c7e7eee65391cb7f4d92f0d565d62/src/datasets/packaged_modules/folder_based_builder/folder_based_builder.py#L58-L59 ### Steps to reproduce the bug ``` load_dataset("audiofolder") ``` ### Expected behavior Error report ### Environment info - `datasets` version: 2.14.4 - Platform: Linux-5.15.0-78-generic-x86_64-with-glibc2.17 - Python version: 3.8.15 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 1.5.3
37
FolderBase Dataset automatically resolves under current directory when data_dir is not specified ### Describe the bug FolderBase Dataset automatically resolves under current directory when data_dir is not specified. For example: ``` load_dataset("audiofolder") ``` takes long time to resolve and collect data_files from current directory. But I think it should reach out to this line for error handling https://github.com/huggingface/datasets/blob/cb8c5de5145c7e7eee65391cb7f4d92f0d565d62/src/datasets/packaged_modules/folder_based_builder/folder_based_builder.py#L58-L59 ### Steps to reproduce the bug ``` load_dataset("audiofolder") ``` ### Expected behavior Error report ### Environment info - `datasets` version: 2.14.4 - Platform: Linux-5.15.0-78-generic-x86_64-with-glibc2.17 - Python version: 3.8.15 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 1.5.3 I think the behavior is related to these lines, which short circuited the error handling. https://github.com/huggingface/datasets/blob/664a1cb72ea1e6ef7c47e671e2686ca4a35e8d63/src/datasets/load.py#L946-L952 So should data_dir be checked here or still delegating to actual `DatasetModule`? In that case, how to properly set `data_files` here.
https://github.com/huggingface/datasets/issues/6152
FolderBase Dataset automatically resolves under current directory when data_dir is not specified
This is location in PackagedDatasetModuleFactory.get_module seems the be the right place to check if at least data_dir or data_files are passed
### Describe the bug FolderBase Dataset automatically resolves under current directory when data_dir is not specified. For example: ``` load_dataset("audiofolder") ``` takes long time to resolve and collect data_files from current directory. But I think it should reach out to this line for error handling https://github.com/huggingface/datasets/blob/cb8c5de5145c7e7eee65391cb7f4d92f0d565d62/src/datasets/packaged_modules/folder_based_builder/folder_based_builder.py#L58-L59 ### Steps to reproduce the bug ``` load_dataset("audiofolder") ``` ### Expected behavior Error report ### Environment info - `datasets` version: 2.14.4 - Platform: Linux-5.15.0-78-generic-x86_64-with-glibc2.17 - Python version: 3.8.15 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 1.5.3
21
FolderBase Dataset automatically resolves under current directory when data_dir is not specified ### Describe the bug FolderBase Dataset automatically resolves under current directory when data_dir is not specified. For example: ``` load_dataset("audiofolder") ``` takes long time to resolve and collect data_files from current directory. But I think it should reach out to this line for error handling https://github.com/huggingface/datasets/blob/cb8c5de5145c7e7eee65391cb7f4d92f0d565d62/src/datasets/packaged_modules/folder_based_builder/folder_based_builder.py#L58-L59 ### Steps to reproduce the bug ``` load_dataset("audiofolder") ``` ### Expected behavior Error report ### Environment info - `datasets` version: 2.14.4 - Platform: Linux-5.15.0-78-generic-x86_64-with-glibc2.17 - Python version: 3.8.15 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 1.5.3 This is location in PackagedDatasetModuleFactory.get_module seems the be the right place to check if at least data_dir or data_files are passed
https://github.com/huggingface/datasets/issues/6151
Faster sorting for single key items
`Dataset.sort` essentially does the same thing except it uses `pyarrow.compute.sort_indices` which doesn't involve copying the data into python objects (saving memory) ```python sort_keys = [(col, "ascending") for col in column_names] indices = pc.sort_indices(self.data, sort_keys=sort_keys) return self.select(indices) ```
### Feature request A faster way to sort a dataset which contains a large number of rows. ### Motivation The current sorting implementations took significantly longer than expected when I was running on a dataset trying to sort by timestamps. **Code snippet:** ```python ds = datasets.load_dataset( "json", **{"data_files": {"train": "path-to-jsonlines"}, "split": "train"}, num_proc=os.cpu_count(), keep_in_memory=True) sorted_ds = ds.sort("pubDate", keep_in_memory=True) ``` However, once I switched to a different method which 1. unpacked to a list of tuples 2. sorted tuples by key 3. run `.select` with the sorted list of indices It was significantly faster (orders of magnitude, especially with M's of rows) ### Your contribution I'd be happy to implement a crude single key sorting algorithm so that other users can benefit from this trick. Broadly, this would take a `Dataset` and perform; ```python # ds is a Dataset object # key_name is the sorting key class Dataset: ... def _sort(key_name: str) -> Dataset: index_keys = [(i,x) for i,x in enumerate(self[key_name])] sorted_rows = sorted(row_pubdate, key=lambda x: x[1]) sorted_indicies = [x[0] for x in sorted_rows] return self.select(sorted_indicies) ```
37
Faster sorting for single key items ### Feature request A faster way to sort a dataset which contains a large number of rows. ### Motivation The current sorting implementations took significantly longer than expected when I was running on a dataset trying to sort by timestamps. **Code snippet:** ```python ds = datasets.load_dataset( "json", **{"data_files": {"train": "path-to-jsonlines"}, "split": "train"}, num_proc=os.cpu_count(), keep_in_memory=True) sorted_ds = ds.sort("pubDate", keep_in_memory=True) ``` However, once I switched to a different method which 1. unpacked to a list of tuples 2. sorted tuples by key 3. run `.select` with the sorted list of indices It was significantly faster (orders of magnitude, especially with M's of rows) ### Your contribution I'd be happy to implement a crude single key sorting algorithm so that other users can benefit from this trick. Broadly, this would take a `Dataset` and perform; ```python # ds is a Dataset object # key_name is the sorting key class Dataset: ... def _sort(key_name: str) -> Dataset: index_keys = [(i,x) for i,x in enumerate(self[key_name])] sorted_rows = sorted(row_pubdate, key=lambda x: x[1]) sorted_indicies = [x[0] for x in sorted_rows] return self.select(sorted_indicies) ``` `Dataset.sort` essentially does the same thing except it uses `pyarrow.compute.sort_indices` which doesn't involve copying the data into python objects (saving memory) ```python sort_keys = [(col, "ascending") for col in column_names] indices = pc.sort_indices(self.data, sort_keys=sort_keys) return self.select(indices) ```
https://github.com/huggingface/datasets/issues/6150
Allow dataset implement .take
``` dataset = IterableDataset(dataset) if type(dataset) != IterableDataset else dataset # to force dataset.take(batch_size) to work in non-streaming mode ```
### Feature request I want to do: ``` dataset.take(512) ``` but it only works with streaming = True ### Motivation uniform interface to data sets. Really surprising the above only works with streaming = True. ### Your contribution Should be trivial to copy paste the IterableDataset .take to use the local path in the data (when streaming = False)
20
Allow dataset implement .take ### Feature request I want to do: ``` dataset.take(512) ``` but it only works with streaming = True ### Motivation uniform interface to data sets. Really surprising the above only works with streaming = True. ### Your contribution Should be trivial to copy paste the IterableDataset .take to use the local path in the data (when streaming = False) ``` dataset = IterableDataset(dataset) if type(dataset) != IterableDataset else dataset # to force dataset.take(batch_size) to work in non-streaming mode ```
https://github.com/huggingface/datasets/issues/6150
Allow dataset implement .take
Feel free to work on this. In addition, `IterableDataset` supports `skip`, so we should also add this method to `Dataset`.
### Feature request I want to do: ``` dataset.take(512) ``` but it only works with streaming = True ### Motivation uniform interface to data sets. Really surprising the above only works with streaming = True. ### Your contribution Should be trivial to copy paste the IterableDataset .take to use the local path in the data (when streaming = False)
20
Allow dataset implement .take ### Feature request I want to do: ``` dataset.take(512) ``` but it only works with streaming = True ### Motivation uniform interface to data sets. Really surprising the above only works with streaming = True. ### Your contribution Should be trivial to copy paste the IterableDataset .take to use the local path in the data (when streaming = False) Feel free to work on this. In addition, `IterableDataset` supports `skip`, so we should also add this method to `Dataset`.
https://github.com/huggingface/datasets/issues/6149
Dataset.from_parquet cannot load subset of columns
Looks like this regression was introduced in `datasets==2.13.0` (`2.12.0` could load a subset of columns) This does not appear to be fixed by https://github.com/huggingface/datasets/pull/6045 (bug still exists on `main`)
### Describe the bug When using `Dataset.from_parquet(path_or_paths, columns=[...])` and a subset of columns, loading fails with a variant of the following ``` ValueError: Couldn't cast a: int64 -- schema metadata -- pandas: '{"index_columns": [], "column_indexes": [], "columns": [{"name":' + 273 to {'a': Value(dtype='int64', id=None), 'b': Value(dtype='int64', id=None)} because column names don't match The above exception was the direct cause of the following exception: ``` Looks to be triggered by https://github.com/huggingface/datasets/blob/c02a44715c036b5261686669727394b1308a3a4b/src/datasets/table.py#L2285-L2286 ### Steps to reproduce the bug ``` import pandas as pd from datasets import Dataset pd.DataFrame([{"a": 1, "b": 2}]).to_parquet("test.pq") Dataset.from_parquet("test.pq", columns=["a"]) ``` ### Expected behavior A subset of columns should be loaded without error ### Environment info - `datasets` version: 2.14.4 - Platform: Linux-5.10.0-23-cloud-amd64-x86_64-with-glibc2.2.5 - Python version: 3.8.16 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 2.0.3
29
Dataset.from_parquet cannot load subset of columns ### Describe the bug When using `Dataset.from_parquet(path_or_paths, columns=[...])` and a subset of columns, loading fails with a variant of the following ``` ValueError: Couldn't cast a: int64 -- schema metadata -- pandas: '{"index_columns": [], "column_indexes": [], "columns": [{"name":' + 273 to {'a': Value(dtype='int64', id=None), 'b': Value(dtype='int64', id=None)} because column names don't match The above exception was the direct cause of the following exception: ``` Looks to be triggered by https://github.com/huggingface/datasets/blob/c02a44715c036b5261686669727394b1308a3a4b/src/datasets/table.py#L2285-L2286 ### Steps to reproduce the bug ``` import pandas as pd from datasets import Dataset pd.DataFrame([{"a": 1, "b": 2}]).to_parquet("test.pq") Dataset.from_parquet("test.pq", columns=["a"]) ``` ### Expected behavior A subset of columns should be loaded without error ### Environment info - `datasets` version: 2.14.4 - Platform: Linux-5.10.0-23-cloud-amd64-x86_64-with-glibc2.2.5 - Python version: 3.8.16 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 2.0.3 Looks like this regression was introduced in `datasets==2.13.0` (`2.12.0` could load a subset of columns) This does not appear to be fixed by https://github.com/huggingface/datasets/pull/6045 (bug still exists on `main`)
https://github.com/huggingface/datasets/issues/6147
ValueError when running BeamBasedBuilder with GCS path in cache_dir
The cause of the error seems to be that `datasets` adds "gcs://" as a schema, while `beam` checks only "gs://". datasets: https://github.com/huggingface/datasets/blob/c02a44715c036b5261686669727394b1308a3a4b/src/datasets/builder.py#L822 beam: [link](https://github.com/apache/beam/blob/25e1a64641b1c8a3c0a6c75c6e86031b87307f22/sdks/python/apache_beam/io/filesystems.py#L98-L101) ``` systems = [ fs for fs in FileSystem.get_all_subclasses() if fs.scheme() == path_scheme ] ```
### Describe the bug When running the BeamBasedBuilder with a GCS path specified in the cache_dir, the following ValueError occurs: ``` ValueError: Unable to get filesystem from specified path, please use the correct path or ensure the required dependency is installed, e.g., pip install apache-beam[gcp]. Path specified: gcs://my-bucket/huggingface_datasets/my_beam_dataset/default/0.0.0/my_beam_dataset-train [while running 'train/Save to parquet/Write/WriteImpl/InitializeWrite'] ``` Same error occurs after running `pip install apache-beam[gcp]` as instructed. ### Steps to reproduce the bug Put `my_beam_dataset.py`: ```python import datasets class MyBeamDataset(datasets.BeamBasedBuilder): def _info(self): features = datasets.Features({"value": datasets.Value("int64")}) return datasets.DatasetInfo(features=features) def _split_generators(self, dl_manager, pipeline): return [datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={})] def _build_pcollection(self, pipeline): import apache_beam as beam return pipeline | beam.Create([{"value": i} for i in range(10)]) ``` Run: ```bash datasets-cli run_beam my_beam_dataset.py --cache_dir=gs://my-bucket/huggingface_datasets/ --beam_pipeline_options="runner=DirectRunner" ``` ### Expected behavior Running the BeamBasedBuilder with a GCS cache path without any errors. ### Environment info - `datasets` version: 2.14.4 - Platform: macOS-13.4-arm64-arm-64bit - Python version: 3.9.17 - Huggingface_hub version: 0.16.4 - PyArrow version: 9.0.0 - Pandas version: 2.0.3
39
ValueError when running BeamBasedBuilder with GCS path in cache_dir ### Describe the bug When running the BeamBasedBuilder with a GCS path specified in the cache_dir, the following ValueError occurs: ``` ValueError: Unable to get filesystem from specified path, please use the correct path or ensure the required dependency is installed, e.g., pip install apache-beam[gcp]. Path specified: gcs://my-bucket/huggingface_datasets/my_beam_dataset/default/0.0.0/my_beam_dataset-train [while running 'train/Save to parquet/Write/WriteImpl/InitializeWrite'] ``` Same error occurs after running `pip install apache-beam[gcp]` as instructed. ### Steps to reproduce the bug Put `my_beam_dataset.py`: ```python import datasets class MyBeamDataset(datasets.BeamBasedBuilder): def _info(self): features = datasets.Features({"value": datasets.Value("int64")}) return datasets.DatasetInfo(features=features) def _split_generators(self, dl_manager, pipeline): return [datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={})] def _build_pcollection(self, pipeline): import apache_beam as beam return pipeline | beam.Create([{"value": i} for i in range(10)]) ``` Run: ```bash datasets-cli run_beam my_beam_dataset.py --cache_dir=gs://my-bucket/huggingface_datasets/ --beam_pipeline_options="runner=DirectRunner" ``` ### Expected behavior Running the BeamBasedBuilder with a GCS cache path without any errors. ### Environment info - `datasets` version: 2.14.4 - Platform: macOS-13.4-arm64-arm-64bit - Python version: 3.9.17 - Huggingface_hub version: 0.16.4 - PyArrow version: 9.0.0 - Pandas version: 2.0.3 The cause of the error seems to be that `datasets` adds "gcs://" as a schema, while `beam` checks only "gs://". datasets: https://github.com/huggingface/datasets/blob/c02a44715c036b5261686669727394b1308a3a4b/src/datasets/builder.py#L822 beam: [link](https://github.com/apache/beam/blob/25e1a64641b1c8a3c0a6c75c6e86031b87307f22/sdks/python/apache_beam/io/filesystems.py#L98-L101) ``` systems = [ fs for fs in FileSystem.get_all_subclasses() if fs.scheme() == path_scheme ] ```
https://github.com/huggingface/datasets/issues/6146
DatasetGenerationError when load glue benchmark datasets from `load_dataset`
This issue can happen if there is a directory named "glue" relative to the Python script with the `load_dataset` call (similar issue to this one: https://github.com/huggingface/datasets/issues/5228). Is this the case?
### Describe the bug Package version: datasets-2.14.4 When I run the codes: ``` from datasets import load_dataset dataset = load_dataset("glue", "ax") ``` I got the following errors: --------------------------------------------------------------------------- SchemaInferenceError Traceback (most recent call last) File ~/anaconda3/envs/python3/lib/python3.10/site-packages/datasets/builder.py:1949, in ArrowBasedBuilder._prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, job_id) 1948 num_shards = shard_id + 1 -> 1949 num_examples, num_bytes = writer.finalize() 1950 writer.close() File ~/anaconda3/envs/python3/lib/python3.10/site-packages/datasets/arrow_writer.py:598, in ArrowWriter.finalize(self, close_stream) 597 self.stream.close() --> 598 raise SchemaInferenceError("Please pass `features` or at least one example when writing data") 599 logger.debug( 600 f"Done writing {self._num_examples} {self.unit} in {self._num_bytes} bytes {self._path if self._path else ''}." 601 ) SchemaInferenceError: Please pass `features` or at least one example when writing data The above exception was the direct cause of the following exception: DatasetGenerationError Traceback (most recent call last) Cell In[5], line 3 1 from datasets import load_dataset ----> 3 dataset = load_dataset("glue", "ax") File ~/anaconda3/envs/python3/lib/python3.10/site-packages/datasets/load.py:2136, 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, **config_kwargs) 2133 try_from_hf_gcs = path not in _PACKAGED_DATASETS_MODULES 2135 # Download and prepare data -> 2136 builder_instance.download_and_prepare( 2137 download_config=download_config, 2138 download_mode=download_mode, 2139 verification_mode=verification_mode, 2140 try_from_hf_gcs=try_from_hf_gcs, 2141 num_proc=num_proc, 2142 storage_options=storage_options, 2143 ) 2145 # Build dataset for splits 2146 keep_in_memory = ( 2147 keep_in_memory if keep_in_memory is not None else is_small_dataset(builder_instance.info.dataset_size) 2148 ) File ~/anaconda3/envs/python3/lib/python3.10/site-packages/datasets/builder.py:954, 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) 952 if num_proc is not None: 953 prepare_split_kwargs["num_proc"] = num_proc --> 954 self._download_and_prepare( 955 dl_manager=dl_manager, 956 verification_mode=verification_mode, 957 **prepare_split_kwargs, 958 **download_and_prepare_kwargs, 959 ) 960 # Sync info 961 self.info.dataset_size = sum(split.num_bytes for split in self.info.splits.values()) File ~/anaconda3/envs/python3/lib/python3.10/site-packages/datasets/builder.py:1049, in DatasetBuilder._download_and_prepare(self, dl_manager, verification_mode, **prepare_split_kwargs) 1045 split_dict.add(split_generator.split_info) 1047 try: 1048 # Prepare split will record examples associated to the split -> 1049 self._prepare_split(split_generator, **prepare_split_kwargs) 1050 except OSError as e: 1051 raise OSError( 1052 "Cannot find data file. " 1053 + (self.manual_download_instructions or "") 1054 + "\nOriginal error:\n" 1055 + str(e) 1056 ) from None File ~/anaconda3/envs/python3/lib/python3.10/site-packages/datasets/builder.py:1813, in ArrowBasedBuilder._prepare_split(self, split_generator, file_format, num_proc, max_shard_size) 1811 job_id = 0 1812 with pbar: -> 1813 for job_id, done, content in self._prepare_split_single( 1814 gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args 1815 ): 1816 if done: 1817 result = content File ~/anaconda3/envs/python3/lib/python3.10/site-packages/datasets/builder.py:1958, in ArrowBasedBuilder._prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, job_id) 1956 if isinstance(e, SchemaInferenceError) and e.__context__ is not None: 1957 e = e.__context__ -> 1958 raise DatasetGenerationError("An error occurred while generating the dataset") from e 1960 yield job_id, True, (total_num_examples, total_num_bytes, writer._features, num_shards, shard_lengths) DatasetGenerationError: An error occurred while generating the dataset ### Steps to reproduce the bug from datasets import load_dataset dataset = load_dataset("glue", "ax") ### Expected behavior When generating the train split: Generating train split: 0/0 [00:00<?, ? examples/s] It raise the error: DatasetGenerationError: An error occurred while generating the dataset ### Environment info datasets-2.14.4. Python 3.10
30
DatasetGenerationError when load glue benchmark datasets from `load_dataset` ### Describe the bug Package version: datasets-2.14.4 When I run the codes: ``` from datasets import load_dataset dataset = load_dataset("glue", "ax") ``` I got the following errors: --------------------------------------------------------------------------- SchemaInferenceError Traceback (most recent call last) File ~/anaconda3/envs/python3/lib/python3.10/site-packages/datasets/builder.py:1949, in ArrowBasedBuilder._prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, job_id) 1948 num_shards = shard_id + 1 -> 1949 num_examples, num_bytes = writer.finalize() 1950 writer.close() File ~/anaconda3/envs/python3/lib/python3.10/site-packages/datasets/arrow_writer.py:598, in ArrowWriter.finalize(self, close_stream) 597 self.stream.close() --> 598 raise SchemaInferenceError("Please pass `features` or at least one example when writing data") 599 logger.debug( 600 f"Done writing {self._num_examples} {self.unit} in {self._num_bytes} bytes {self._path if self._path else ''}." 601 ) SchemaInferenceError: Please pass `features` or at least one example when writing data The above exception was the direct cause of the following exception: DatasetGenerationError Traceback (most recent call last) Cell In[5], line 3 1 from datasets import load_dataset ----> 3 dataset = load_dataset("glue", "ax") File ~/anaconda3/envs/python3/lib/python3.10/site-packages/datasets/load.py:2136, 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, **config_kwargs) 2133 try_from_hf_gcs = path not in _PACKAGED_DATASETS_MODULES 2135 # Download and prepare data -> 2136 builder_instance.download_and_prepare( 2137 download_config=download_config, 2138 download_mode=download_mode, 2139 verification_mode=verification_mode, 2140 try_from_hf_gcs=try_from_hf_gcs, 2141 num_proc=num_proc, 2142 storage_options=storage_options, 2143 ) 2145 # Build dataset for splits 2146 keep_in_memory = ( 2147 keep_in_memory if keep_in_memory is not None else is_small_dataset(builder_instance.info.dataset_size) 2148 ) File ~/anaconda3/envs/python3/lib/python3.10/site-packages/datasets/builder.py:954, 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) 952 if num_proc is not None: 953 prepare_split_kwargs["num_proc"] = num_proc --> 954 self._download_and_prepare( 955 dl_manager=dl_manager, 956 verification_mode=verification_mode, 957 **prepare_split_kwargs, 958 **download_and_prepare_kwargs, 959 ) 960 # Sync info 961 self.info.dataset_size = sum(split.num_bytes for split in self.info.splits.values()) File ~/anaconda3/envs/python3/lib/python3.10/site-packages/datasets/builder.py:1049, in DatasetBuilder._download_and_prepare(self, dl_manager, verification_mode, **prepare_split_kwargs) 1045 split_dict.add(split_generator.split_info) 1047 try: 1048 # Prepare split will record examples associated to the split -> 1049 self._prepare_split(split_generator, **prepare_split_kwargs) 1050 except OSError as e: 1051 raise OSError( 1052 "Cannot find data file. " 1053 + (self.manual_download_instructions or "") 1054 + "\nOriginal error:\n" 1055 + str(e) 1056 ) from None File ~/anaconda3/envs/python3/lib/python3.10/site-packages/datasets/builder.py:1813, in ArrowBasedBuilder._prepare_split(self, split_generator, file_format, num_proc, max_shard_size) 1811 job_id = 0 1812 with pbar: -> 1813 for job_id, done, content in self._prepare_split_single( 1814 gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args 1815 ): 1816 if done: 1817 result = content File ~/anaconda3/envs/python3/lib/python3.10/site-packages/datasets/builder.py:1958, in ArrowBasedBuilder._prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, job_id) 1956 if isinstance(e, SchemaInferenceError) and e.__context__ is not None: 1957 e = e.__context__ -> 1958 raise DatasetGenerationError("An error occurred while generating the dataset") from e 1960 yield job_id, True, (total_num_examples, total_num_bytes, writer._features, num_shards, shard_lengths) DatasetGenerationError: An error occurred while generating the dataset ### Steps to reproduce the bug from datasets import load_dataset dataset = load_dataset("glue", "ax") ### Expected behavior When generating the train split: Generating train split: 0/0 [00:00<?, ? examples/s] It raise the error: DatasetGenerationError: An error occurred while generating the dataset ### Environment info datasets-2.14.4. Python 3.10 This issue can happen if there is a directory named "glue" relative to the Python script with the `load_dataset` call (similar issue to this one: https://github.com/huggingface/datasets/issues/5228). Is this the case?
https://github.com/huggingface/datasets/issues/6153
custom load dataset to hub
> This is an issue for the [Datasets repo](https://github.com/huggingface/datasets). Thanks @sgugger , I guess I will wait for them to address the issue . Looking forward to hearing from them
### System Info kaggle notebook i transformed dataset: ``` dataset = load_dataset("Dahoas/first-instruct-human-assistant-prompt") ``` to formatted_dataset: ``` Dataset({ features: ['message_tree_id', 'message_tree_text'], num_rows: 33143 }) ``` but would like to know how to upload to hub ### Who can help? @ArthurZucker @younesbelkada ### Information - [ ] The official example scripts - [ ] My own modified scripts ### Tasks - [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...) - [ ] My own task or dataset (give details below) ### Reproduction shared above ### Expected behavior load dataset to hub
30
custom load dataset to hub ### System Info kaggle notebook i transformed dataset: ``` dataset = load_dataset("Dahoas/first-instruct-human-assistant-prompt") ``` to formatted_dataset: ``` Dataset({ features: ['message_tree_id', 'message_tree_text'], num_rows: 33143 }) ``` but would like to know how to upload to hub ### Who can help? @ArthurZucker @younesbelkada ### Information - [ ] The official example scripts - [ ] My own modified scripts ### Tasks - [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...) - [ ] My own task or dataset (give details below) ### Reproduction shared above ### Expected behavior load dataset to hub > This is an issue for the [Datasets repo](https://github.com/huggingface/datasets). Thanks @sgugger , I guess I will wait for them to address the issue . Looking forward to hearing from them
https://github.com/huggingface/datasets/issues/6144
NIH exporter file not found
another file not found: ``` Traceback (most recent call last): File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/implementations/http.py", line 417, in _info await _file_info( File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/implementations/http.py", line 837, in _file_info r.raise_for_status() File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1005, in raise_for_status raise ClientResponseError( aiohttp.client_exceptions.ClientResponseError: 404, message='Not Found', url=URL('https://the-eye.eu/public/AI/pile_preliminary_components/pile_uspto.tar') The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/lfs/ampere1/0/brando9/.vscode-server-insiders/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module> cli.main() File "/lfs/ampere1/0/brando9/.vscode-server-insiders/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main run() File "/lfs/ampere1/0/brando9/.vscode-server-insiders/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file runpy.run_path(target, run_name="__main__") File "/lfs/ampere1/0/brando9/.vscode-server-insiders/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path return _run_module_code(code, init_globals, run_name, File "/lfs/ampere1/0/brando9/.vscode-server-insiders/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code _run_code(code, mod_globals, init_globals, File "/lfs/ampere1/0/brando9/.vscode-server-insiders/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code exec(code, run_globals) File "/lfs/ampere1/0/brando9/beyond-scale-language-data-diversity/src/diversity/div_coeff.py", line 526, in <module> experiment_compute_diveristy_coeff_single_dataset_then_combined_datasets_with_domain_weights() File "/lfs/ampere1/0/brando9/beyond-scale-language-data-diversity/src/diversity/div_coeff.py", line 475, in experiment_compute_diveristy_coeff_single_dataset_then_combined_datasets_with_domain_weights column_names = next(iter(dataset)).keys() File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/iterable_dataset.py", line 1353, in __iter__ for key, example in ex_iterable: File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/iterable_dataset.py", line 207, in __iter__ yield from self.generate_examples_fn(**self.kwargs) File "/lfs/ampere1/0/brando9/.cache/huggingface/modules/datasets_modules/datasets/EleutherAI--pile/ebea56d358e91cf4d37b0fde361d563bed1472fbd8221a21b38fc8bb4ba554fb/pile.py", line 257, in _generate_examples for path, file in files[subset]: File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/download/streaming_download_manager.py", line 840, in __iter__ yield from self.generator(*self.args, **self.kwargs) File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/download/streaming_download_manager.py", line 891, in _iter_from_urlpath with xopen(urlpath, "rb", download_config=download_config) as f: File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/download/streaming_download_manager.py", line 496, in xopen file_obj = fsspec.open(file, mode=mode, *args, **kwargs).open() File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/core.py", line 134, in open return self.__enter__() File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/core.py", line 102, in __enter__ f = self.fs.open(self.path, mode=mode) File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/spec.py", line 1241, in open f = self._open( File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/implementations/http.py", line 356, in _open size = size or self.info(path, **kwargs)["size"] File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/asyn.py", line 121, in wrapper return sync(self.loop, func, *args, **kwargs) File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/asyn.py", line 106, in sync raise return_result File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/asyn.py", line 61, in _runner result[0] = await coro File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/implementations/http.py", line 430, in _info raise FileNotFoundError(url) from exc FileNotFoundError: https://the-eye.eu/public/AI/pile_preliminary_components/pile_uspto.tar ```
### Describe the bug can't use or download the nih exporter pile data. ``` 15 experiment_compute_diveristy_coeff_single_dataset_then_combined_datasets_with_domain_weights() 16 File "/lfs/ampere1/0/brando9/beyond-scale-language-data-diversity/src/diversity/div_coeff.py", line 474, in experiment_compute_diveristy_coeff_single_dataset_then_combined_datasets_with_domain_weights 17 column_names = next(iter(dataset)).keys() 18 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/iterable_dataset.py", line 1353, in __iter__ 19 for key, example in ex_iterable: 20 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/iterable_dataset.py", line 207, in __iter__ 21 yield from self.generate_examples_fn(**self.kwargs) 22 File "/lfs/ampere1/0/brando9/.cache/huggingface/modules/datasets_modules/datasets/EleutherAI--pile/ebea56d358e91cf4d37b0fde361d563bed1472fbd8221a21b38fc8bb4ba554fb/pile.py", line 236, in _generate_examples 23 with zstd.open(open(files[subset], "rb"), "rt", encoding="utf-8") as f: 24 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/streaming.py", line 74, in wrapper 25 return function(*args, download_config=download_config, **kwargs) 26 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/download/streaming_download_manager.py", line 496, in xopen 27 file_obj = fsspec.open(file, mode=mode, *args, **kwargs).open() 28 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/core.py", line 134, in open 29 return self.__enter__() 30 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/core.py", line 102, in __enter__ 31 f = self.fs.open(self.path, mode=mode) 32 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/spec.py", line 1241, in open 33 f = self._open( 34 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/implementations/http.py", line 356, in _open 35 size = size or self.info(path, **kwargs)["size"] 36 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/asyn.py", line 121, in wrapper 37 return sync(self.loop, func, *args, **kwargs) 38 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/asyn.py", line 106, in sync 39 raise return_result 40 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/asyn.py", line 61, in _runner 41 result[0] = await coro 42 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/implementations/http.py", line 430, in _info 43 raise FileNotFoundError(url) from exc 44 FileNotFoundError: https://the-eye.eu/public/AI/pile_preliminary_components/NIH_ExPORTER_awarded_grant_text.jsonl.zst ``` ### Steps to reproduce the bug run this: ``` from datasets import load_dataset path, name = 'EleutherAI/pile', 'nih_exporter' # -- Get data set dataset = load_dataset(path, name, streaming=True, split="train").with_format("torch") batch = dataset.take(512) print(f'{batch=}') ``` ### Expected behavior print the batch ### Environment info ``` (beyond_scale) brando9@ampere1:~/beyond-scale-language-data-diversity$ datasets-cli env Copy-and-paste the text below in your GitHub issue. - `datasets` version: 2.14.4 - Platform: Linux-5.4.0-122-generic-x86_64-with-glibc2.31 - Python version: 3.10.11 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 2.0.3 ```
283
NIH exporter file not found ### Describe the bug can't use or download the nih exporter pile data. ``` 15 experiment_compute_diveristy_coeff_single_dataset_then_combined_datasets_with_domain_weights() 16 File "/lfs/ampere1/0/brando9/beyond-scale-language-data-diversity/src/diversity/div_coeff.py", line 474, in experiment_compute_diveristy_coeff_single_dataset_then_combined_datasets_with_domain_weights 17 column_names = next(iter(dataset)).keys() 18 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/iterable_dataset.py", line 1353, in __iter__ 19 for key, example in ex_iterable: 20 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/iterable_dataset.py", line 207, in __iter__ 21 yield from self.generate_examples_fn(**self.kwargs) 22 File "/lfs/ampere1/0/brando9/.cache/huggingface/modules/datasets_modules/datasets/EleutherAI--pile/ebea56d358e91cf4d37b0fde361d563bed1472fbd8221a21b38fc8bb4ba554fb/pile.py", line 236, in _generate_examples 23 with zstd.open(open(files[subset], "rb"), "rt", encoding="utf-8") as f: 24 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/streaming.py", line 74, in wrapper 25 return function(*args, download_config=download_config, **kwargs) 26 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/download/streaming_download_manager.py", line 496, in xopen 27 file_obj = fsspec.open(file, mode=mode, *args, **kwargs).open() 28 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/core.py", line 134, in open 29 return self.__enter__() 30 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/core.py", line 102, in __enter__ 31 f = self.fs.open(self.path, mode=mode) 32 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/spec.py", line 1241, in open 33 f = self._open( 34 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/implementations/http.py", line 356, in _open 35 size = size or self.info(path, **kwargs)["size"] 36 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/asyn.py", line 121, in wrapper 37 return sync(self.loop, func, *args, **kwargs) 38 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/asyn.py", line 106, in sync 39 raise return_result 40 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/asyn.py", line 61, in _runner 41 result[0] = await coro 42 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/implementations/http.py", line 430, in _info 43 raise FileNotFoundError(url) from exc 44 FileNotFoundError: https://the-eye.eu/public/AI/pile_preliminary_components/NIH_ExPORTER_awarded_grant_text.jsonl.zst ``` ### Steps to reproduce the bug run this: ``` from datasets import load_dataset path, name = 'EleutherAI/pile', 'nih_exporter' # -- Get data set dataset = load_dataset(path, name, streaming=True, split="train").with_format("torch") batch = dataset.take(512) print(f'{batch=}') ``` ### Expected behavior print the batch ### Environment info ``` (beyond_scale) brando9@ampere1:~/beyond-scale-language-data-diversity$ datasets-cli env Copy-and-paste the text below in your GitHub issue. - `datasets` version: 2.14.4 - Platform: Linux-5.4.0-122-generic-x86_64-with-glibc2.31 - Python version: 3.10.11 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 2.0.3 ``` another file not found: ``` Traceback (most recent call last): File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/implementations/http.py", line 417, in _info await _file_info( File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/implementations/http.py", line 837, in _file_info r.raise_for_status() File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1005, in raise_for_status raise ClientResponseError( aiohttp.client_exceptions.ClientResponseError: 404, message='Not Found', url=URL('https://the-eye.eu/public/AI/pile_preliminary_components/pile_uspto.tar') The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/lfs/ampere1/0/brando9/.vscode-server-insiders/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module> cli.main() File "/lfs/ampere1/0/brando9/.vscode-server-insiders/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main run() File "/lfs/ampere1/0/brando9/.vscode-server-insiders/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file runpy.run_path(target, run_name="__main__") File "/lfs/ampere1/0/brando9/.vscode-server-insiders/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path return _run_module_code(code, init_globals, run_name, File "/lfs/ampere1/0/brando9/.vscode-server-insiders/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code _run_code(code, mod_globals, init_globals, File "/lfs/ampere1/0/brando9/.vscode-server-insiders/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code exec(code, run_globals) File "/lfs/ampere1/0/brando9/beyond-scale-language-data-diversity/src/diversity/div_coeff.py", line 526, in <module> experiment_compute_diveristy_coeff_single_dataset_then_combined_datasets_with_domain_weights() File "/lfs/ampere1/0/brando9/beyond-scale-language-data-diversity/src/diversity/div_coeff.py", line 475, in experiment_compute_diveristy_coeff_single_dataset_then_combined_datasets_with_domain_weights column_names = next(iter(dataset)).keys() File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/iterable_dataset.py", line 1353, in __iter__ for key, example in ex_iterable: File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/iterable_dataset.py", line 207, in __iter__ yield from self.generate_examples_fn(**self.kwargs) File "/lfs/ampere1/0/brando9/.cache/huggingface/modules/datasets_modules/datasets/EleutherAI--pile/ebea56d358e91cf4d37b0fde361d563bed1472fbd8221a21b38fc8bb4ba554fb/pile.py", line 257, in _generate_examples for path, file in files[subset]: File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/download/streaming_download_manager.py", line 840, in __iter__ yield from self.generator(*self.args, **self.kwargs) File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/download/streaming_download_manager.py", line 891, in _iter_from_urlpath with xopen(urlpath, "rb", download_config=download_config) as f: File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/download/streaming_download_manager.py", line 496, in xopen file_obj = fsspec.open(file, mode=mode, *args, **kwargs).open() File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/core.py", line 134, in open return self.__enter__() File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/core.py", line 102, in __enter__ f = self.fs.open(self.path, mode=mode) File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/spec.py", line 1241, in open f = self._open( File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/implementations/http.py", line 356, in _open size = size or self.info(path, **kwargs)["size"] File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/asyn.py", line 121, in wrapper return sync(self.loop, func, *args, **kwargs) File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/asyn.py", line 106, in sync raise return_result File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/asyn.py", line 61, in _runner result[0] = await coro File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/implementations/http.py", line 430, in _info raise FileNotFoundError(url) from exc FileNotFoundError: https://the-eye.eu/public/AI/pile_preliminary_components/pile_uspto.tar ```
https://github.com/huggingface/datasets/issues/6144
NIH exporter file not found
this seems to work but it's rather annoying. Summary of how to make it work: 1. get urls to parquet files into a list 2. load list to load_dataset via `load_dataset('parquet', data_files=urls)` (note api names to hf are really confusing sometimes) 3. then it should work, print a batch of text. presudo code ```python urls_hacker_news = [ "https://huggingface.co/datasets/EleutherAI/pile/resolve/refs%2Fconvert%2Fparquet/hacker_news/pile-train-00000-of-00004.parquet", "https://huggingface.co/datasets/EleutherAI/pile/resolve/refs%2Fconvert%2Fparquet/hacker_news/pile-train-00001-of-00004.parquet", "https://huggingface.co/datasets/EleutherAI/pile/resolve/refs%2Fconvert%2Fparquet/hacker_news/pile-train-00002-of-00004.parquet", "https://huggingface.co/datasets/EleutherAI/pile/resolve/refs%2Fconvert%2Fparquet/hacker_news/pile-train-00003-of-00004.parquet" ] ... # streaming = False from diversity.pile_subset_urls import urls_hacker_news path, name, data_files = 'parquet', 'hacker_news', urls_hacker_news # not changing batch_size = 512 today = datetime.datetime.now().strftime('%Y-m%m-d%d-t%Hh_%Mm_%Ss') run_name = f'{path} div_coeff_{num_batches=} ({today=} ({name=}) {data_mixture_name=} {probabilities=})' print(f'{run_name=}') # - Init wandb debug: bool = mode == 'dryrun' run = wandb.init(mode=mode, project="beyond-scale", name=run_name, save_code=True) wandb.config.update({"num_batches": num_batches, "path": path, "name": name, "today": today, 'probabilities': probabilities, 'batch_size': batch_size, 'debug': debug, 'data_mixture_name': data_mixture_name, 'streaming': streaming, 'data_files': data_files}) # run.notify_on_failure() # https://community.wandb.ai/t/how-do-i-set-the-wandb-alert-programatically-for-my-current-run/4891 print(f'{debug=}') print(f'{wandb.config=}') # -- Get probe network from datasets import load_dataset import torch from transformers import GPT2Tokenizer, GPT2LMHeadModel tokenizer = GPT2Tokenizer.from_pretrained("gpt2") if tokenizer.pad_token_id is None: tokenizer.pad_token = tokenizer.eos_token probe_network = GPT2LMHeadModel.from_pretrained("gpt2") device = torch.device(f"cuda:{0}" if torch.cuda.is_available() else "cpu") probe_network = probe_network.to(device) # -- Get data set def my_load_dataset(path, name): print(f'{path=} {name=} {streaming=}') if path == 'json' or path == 'bin' or path == 'csv': print(f'{data_files_prefix+name=}') return load_dataset(path, data_files=data_files_prefix+name, streaming=streaming, split="train").with_format("torch") elif path == 'parquet': print(f'{data_files=}') return load_dataset(path, data_files=data_files, streaming=streaming, split="train").with_format("torch") else: return load_dataset(path, name, streaming=streaming, split="train").with_format("torch") # - get data set for real now if isinstance(path, str): dataset = my_load_dataset(path, name) else: print('-- interleaving datasets') datasets = [my_load_dataset(path, name).with_format("torch") for path, name in zip(path, name)] [print(f'{dataset.description=}') for dataset in datasets] dataset = interleave_datasets(datasets, probabilities) print(f'{dataset=}') batch = dataset.take(batch_size) print(f'{next(iter(batch))=}') column_names = next(iter(batch)).keys() print(f'{column_names=}') # - Prepare functions to tokenize batch def preprocess(examples): return tokenizer(examples["text"], padding="max_length", max_length=128, truncation=True, return_tensors="pt") remove_columns = column_names # remove all keys that are not tensors to avoid bugs in collate function in task2vec's pytorch data loader def map(batch): return batch.map(preprocess, batched=True, remove_columns=remove_columns) tokenized_batch = map(batch) print(f'{next(iter(tokenized_batch))=}') ``` https://stackoverflow.com/questions/76891189/how-to-download-data-from-hugging-face-that-is-visible-on-the-data-viewer-but-th/76902681#76902681 https://discuss.huggingface.co/t/how-to-download-data-from-hugging-face-that-is-visible-on-the-data-viewer-but-the-files-are-not-available/50555/5?u=severo
### Describe the bug can't use or download the nih exporter pile data. ``` 15 experiment_compute_diveristy_coeff_single_dataset_then_combined_datasets_with_domain_weights() 16 File "/lfs/ampere1/0/brando9/beyond-scale-language-data-diversity/src/diversity/div_coeff.py", line 474, in experiment_compute_diveristy_coeff_single_dataset_then_combined_datasets_with_domain_weights 17 column_names = next(iter(dataset)).keys() 18 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/iterable_dataset.py", line 1353, in __iter__ 19 for key, example in ex_iterable: 20 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/iterable_dataset.py", line 207, in __iter__ 21 yield from self.generate_examples_fn(**self.kwargs) 22 File "/lfs/ampere1/0/brando9/.cache/huggingface/modules/datasets_modules/datasets/EleutherAI--pile/ebea56d358e91cf4d37b0fde361d563bed1472fbd8221a21b38fc8bb4ba554fb/pile.py", line 236, in _generate_examples 23 with zstd.open(open(files[subset], "rb"), "rt", encoding="utf-8") as f: 24 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/streaming.py", line 74, in wrapper 25 return function(*args, download_config=download_config, **kwargs) 26 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/download/streaming_download_manager.py", line 496, in xopen 27 file_obj = fsspec.open(file, mode=mode, *args, **kwargs).open() 28 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/core.py", line 134, in open 29 return self.__enter__() 30 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/core.py", line 102, in __enter__ 31 f = self.fs.open(self.path, mode=mode) 32 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/spec.py", line 1241, in open 33 f = self._open( 34 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/implementations/http.py", line 356, in _open 35 size = size or self.info(path, **kwargs)["size"] 36 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/asyn.py", line 121, in wrapper 37 return sync(self.loop, func, *args, **kwargs) 38 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/asyn.py", line 106, in sync 39 raise return_result 40 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/asyn.py", line 61, in _runner 41 result[0] = await coro 42 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/implementations/http.py", line 430, in _info 43 raise FileNotFoundError(url) from exc 44 FileNotFoundError: https://the-eye.eu/public/AI/pile_preliminary_components/NIH_ExPORTER_awarded_grant_text.jsonl.zst ``` ### Steps to reproduce the bug run this: ``` from datasets import load_dataset path, name = 'EleutherAI/pile', 'nih_exporter' # -- Get data set dataset = load_dataset(path, name, streaming=True, split="train").with_format("torch") batch = dataset.take(512) print(f'{batch=}') ``` ### Expected behavior print the batch ### Environment info ``` (beyond_scale) brando9@ampere1:~/beyond-scale-language-data-diversity$ datasets-cli env Copy-and-paste the text below in your GitHub issue. - `datasets` version: 2.14.4 - Platform: Linux-5.4.0-122-generic-x86_64-with-glibc2.31 - Python version: 3.10.11 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 2.0.3 ```
319
NIH exporter file not found ### Describe the bug can't use or download the nih exporter pile data. ``` 15 experiment_compute_diveristy_coeff_single_dataset_then_combined_datasets_with_domain_weights() 16 File "/lfs/ampere1/0/brando9/beyond-scale-language-data-diversity/src/diversity/div_coeff.py", line 474, in experiment_compute_diveristy_coeff_single_dataset_then_combined_datasets_with_domain_weights 17 column_names = next(iter(dataset)).keys() 18 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/iterable_dataset.py", line 1353, in __iter__ 19 for key, example in ex_iterable: 20 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/iterable_dataset.py", line 207, in __iter__ 21 yield from self.generate_examples_fn(**self.kwargs) 22 File "/lfs/ampere1/0/brando9/.cache/huggingface/modules/datasets_modules/datasets/EleutherAI--pile/ebea56d358e91cf4d37b0fde361d563bed1472fbd8221a21b38fc8bb4ba554fb/pile.py", line 236, in _generate_examples 23 with zstd.open(open(files[subset], "rb"), "rt", encoding="utf-8") as f: 24 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/streaming.py", line 74, in wrapper 25 return function(*args, download_config=download_config, **kwargs) 26 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/datasets/download/streaming_download_manager.py", line 496, in xopen 27 file_obj = fsspec.open(file, mode=mode, *args, **kwargs).open() 28 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/core.py", line 134, in open 29 return self.__enter__() 30 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/core.py", line 102, in __enter__ 31 f = self.fs.open(self.path, mode=mode) 32 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/spec.py", line 1241, in open 33 f = self._open( 34 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/implementations/http.py", line 356, in _open 35 size = size or self.info(path, **kwargs)["size"] 36 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/asyn.py", line 121, in wrapper 37 return sync(self.loop, func, *args, **kwargs) 38 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/asyn.py", line 106, in sync 39 raise return_result 40 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/asyn.py", line 61, in _runner 41 result[0] = await coro 42 File "/lfs/ampere1/0/brando9/miniconda/envs/beyond_scale/lib/python3.10/site-packages/fsspec/implementations/http.py", line 430, in _info 43 raise FileNotFoundError(url) from exc 44 FileNotFoundError: https://the-eye.eu/public/AI/pile_preliminary_components/NIH_ExPORTER_awarded_grant_text.jsonl.zst ``` ### Steps to reproduce the bug run this: ``` from datasets import load_dataset path, name = 'EleutherAI/pile', 'nih_exporter' # -- Get data set dataset = load_dataset(path, name, streaming=True, split="train").with_format("torch") batch = dataset.take(512) print(f'{batch=}') ``` ### Expected behavior print the batch ### Environment info ``` (beyond_scale) brando9@ampere1:~/beyond-scale-language-data-diversity$ datasets-cli env Copy-and-paste the text below in your GitHub issue. - `datasets` version: 2.14.4 - Platform: Linux-5.4.0-122-generic-x86_64-with-glibc2.31 - Python version: 3.10.11 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 2.0.3 ``` this seems to work but it's rather annoying. Summary of how to make it work: 1. get urls to parquet files into a list 2. load list to load_dataset via `load_dataset('parquet', data_files=urls)` (note api names to hf are really confusing sometimes) 3. then it should work, print a batch of text. presudo code ```python urls_hacker_news = [ "https://huggingface.co/datasets/EleutherAI/pile/resolve/refs%2Fconvert%2Fparquet/hacker_news/pile-train-00000-of-00004.parquet", "https://huggingface.co/datasets/EleutherAI/pile/resolve/refs%2Fconvert%2Fparquet/hacker_news/pile-train-00001-of-00004.parquet", "https://huggingface.co/datasets/EleutherAI/pile/resolve/refs%2Fconvert%2Fparquet/hacker_news/pile-train-00002-of-00004.parquet", "https://huggingface.co/datasets/EleutherAI/pile/resolve/refs%2Fconvert%2Fparquet/hacker_news/pile-train-00003-of-00004.parquet" ] ... # streaming = False from diversity.pile_subset_urls import urls_hacker_news path, name, data_files = 'parquet', 'hacker_news', urls_hacker_news # not changing batch_size = 512 today = datetime.datetime.now().strftime('%Y-m%m-d%d-t%Hh_%Mm_%Ss') run_name = f'{path} div_coeff_{num_batches=} ({today=} ({name=}) {data_mixture_name=} {probabilities=})' print(f'{run_name=}') # - Init wandb debug: bool = mode == 'dryrun' run = wandb.init(mode=mode, project="beyond-scale", name=run_name, save_code=True) wandb.config.update({"num_batches": num_batches, "path": path, "name": name, "today": today, 'probabilities': probabilities, 'batch_size': batch_size, 'debug': debug, 'data_mixture_name': data_mixture_name, 'streaming': streaming, 'data_files': data_files}) # run.notify_on_failure() # https://community.wandb.ai/t/how-do-i-set-the-wandb-alert-programatically-for-my-current-run/4891 print(f'{debug=}') print(f'{wandb.config=}') # -- Get probe network from datasets import load_dataset import torch from transformers import GPT2Tokenizer, GPT2LMHeadModel tokenizer = GPT2Tokenizer.from_pretrained("gpt2") if tokenizer.pad_token_id is None: tokenizer.pad_token = tokenizer.eos_token probe_network = GPT2LMHeadModel.from_pretrained("gpt2") device = torch.device(f"cuda:{0}" if torch.cuda.is_available() else "cpu") probe_network = probe_network.to(device) # -- Get data set def my_load_dataset(path, name): print(f'{path=} {name=} {streaming=}') if path == 'json' or path == 'bin' or path == 'csv': print(f'{data_files_prefix+name=}') return load_dataset(path, data_files=data_files_prefix+name, streaming=streaming, split="train").with_format("torch") elif path == 'parquet': print(f'{data_files=}') return load_dataset(path, data_files=data_files, streaming=streaming, split="train").with_format("torch") else: return load_dataset(path, name, streaming=streaming, split="train").with_format("torch") # - get data set for real now if isinstance(path, str): dataset = my_load_dataset(path, name) else: print('-- interleaving datasets') datasets = [my_load_dataset(path, name).with_format("torch") for path, name in zip(path, name)] [print(f'{dataset.description=}') for dataset in datasets] dataset = interleave_datasets(datasets, probabilities) print(f'{dataset=}') batch = dataset.take(batch_size) print(f'{next(iter(batch))=}') column_names = next(iter(batch)).keys() print(f'{column_names=}') # - Prepare functions to tokenize batch def preprocess(examples): return tokenizer(examples["text"], padding="max_length", max_length=128, truncation=True, return_tensors="pt") remove_columns = column_names # remove all keys that are not tensors to avoid bugs in collate function in task2vec's pytorch data loader def map(batch): return batch.map(preprocess, batched=True, remove_columns=remove_columns) tokenized_batch = map(batch) print(f'{next(iter(tokenized_batch))=}') ``` https://stackoverflow.com/questions/76891189/how-to-download-data-from-hugging-face-that-is-visible-on-the-data-viewer-but-th/76902681#76902681 https://discuss.huggingface.co/t/how-to-download-data-from-hugging-face-that-is-visible-on-the-data-viewer-but-the-files-are-not-available/50555/5?u=severo
https://github.com/huggingface/datasets/issues/6142
the-stack-dedup fails to generate
It seems that some parquet files have additional columns. I ran a scan and found that two files have the additional `__id__` column: 1. `hf://datasets/bigcode/the-stack-dedup/data/numpy/data-00000-of-00001.parquet` 2. `hf://datasets/bigcode/the-stack-dedup/data/omgrofl/data-00000-of-00001.parquet` We should open a PR to fix those two files
### Describe the bug I'm getting an error generating the-stack-dedup with datasets 2.13.1, and with 2.14.4 nothing happens. ### Steps to reproduce the bug My code: ``` import os import datasets as ds MY_CACHE_DIR = "/home/ubuntu/the-stack-dedup-local" MY_TOKEN="my-token" the_stack_ds = ds.load_dataset("bigcode/the-stack-dedup", split="train", download_mode="reuse_cache_if_exists", cache_dir=MY_CACHE_DIR, use_auth_token=MY_TOKEN, num_proc=64) ``` The exception: ``` Generating train split: 233248251 examples [54:31, 57280.00 examples/s] multiprocess.pool.RemoteTraceback: """ Traceback (most recent call last): File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/build er.py", line 1879, in _prepare_split_single for _, table in generator: File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/packa ged_modules/parquet/parquet.py", line 82, in _generate_tables yield f"{file_idx}_{batch_idx}", self._cast_table(pa_table) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/packa ged_modules/parquet/parquet.py", line 61, in _cast_table pa_table = table_cast(pa_table, self.info.features.arrow_schema) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/table .py", line 2324, in table_cast return cast_table_to_schema(table, schema) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/table .py", line 2282, in cast_table_to_schema raise ValueError(f"Couldn't cast\n{table.schema}\nto\n{features}\nb ecause column names don't match") ValueError: Couldn't cast hexsha: string size: int64 ext: string lang: string max_stars_repo_path: string max_stars_repo_name: string max_stars_repo_head_hexsha: string max_stars_repo_licenses: list<item: string> child 0, item: string max_stars_count: int64 max_stars_repo_stars_event_min_datetime: string max_stars_repo_stars_event_max_datetime: string max_issues_repo_path: string max_issues_repo_name: string max_issues_repo_head_hexsha: string max_issues_repo_licenses: list<item: string> child 0, item: string max_issues_count: int64 max_issues_repo_issues_event_min_datetime: string max_issues_repo_issues_event_max_datetime: string max_forks_repo_path: string max_forks_repo_name: string max_forks_repo_head_hexsha: string max_forks_repo_licenses: list<item: string> child 0, item: string max_forks_count: int64 max_forks_repo_forks_event_min_datetime: string max_forks_repo_forks_event_max_datetime: string content: string avg_line_length: double max_line_length: int64 alphanum_fraction: double __id__: int64 -- schema metadata -- huggingface: '{"info": {"features": {"hexsha": {"dtype": "string", "_type' + 1979 to {'hexsha': Value(dtype='string', id=None), 'size': Value(dtype='int64', id=None), 'ext': Value(dtype='string', id=None), 'lang': Value(dtype='string', id=None), 'max_stars_repo_path': Value(dtype='string', id=None), 'max_stars_repo_name': Value(dtype='string', id=None), 'max_stars_repo_head_hexsha': Value(dtype='string', id=None), 'max_stars_repo_licenses': Sequence(feature=Value(dtype='string', id=None), length=-1, id=None), 'max_stars_count': Value(dtype='int64', id=None), 'max_stars_repo_stars_event_min_datetime': Value(dtype='string', id=None), 'max_stars_repo_stars_event_max_datetime': Value(dtype='string', id=None), 'max_issues_repo_path': Value(dtype='string', id=None), 'max_issues_repo_name': Value(dtype='string', id=None), 'max_issues_repo_head_hexsha': Value(dtype='string', id=None), 'max_issues_repo_licenses': Sequence(feature=Value(dtype='string', id=None), length=-1, id=None), 'max_issues_count': Value(dtype='int64', id=None), 'max_issues_repo_issues_event_min_datetime': Value(dtype='string', id=None), 'max_issues_repo_issues_event_max_datetime': Value(dtype='string', id=None), 'max_forks_repo_path': Value(dtype='string', id=None), 'max_forks_repo_name': Value(dtype='string', id=None), 'max_forks_repo_head_hexsha': Value(dtype='string', id=None), 'max_forks_repo_licenses': Sequence(feature=Value(dtype='string', id=None), length=-1, id=None), 'max_forks_count': Value(dtype='int64', id=None), 'max_forks_repo_forks_event_min_datetime': Value(dtype='string', id=None), 'max_forks_repo_forks_event_max_datetime': Value(dtype='string', id=None), 'content': Value(dtype='string', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'alphanum_fraction': Value(dtype='float64', id=None)} because column names don't match The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/ubuntu/.local/lib/python3.10/site-packages/multiprocess/p ool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/utils /py_utils.py", line 1328, in _write_generator_to_queue for i, result in enumerate(func(**kwargs)): File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/build er.py", line 1912, in _prepare_split_single raise DatasetGenerationError("An error occurred while generating th e dataset") from e datasets.builder.DatasetGenerationError: An error occurred while genera ting the dataset """ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/ubuntu/download_the_stack.py", line 7, in <module> the_stack_ds = ds.load_dataset("bigcode/the-stack-dedup", split="tr ain", download_mode="reuse_cache_if_exists", cache_dir=MY_CACHE_DIR, us e_auth_token=MY_TOKEN, num_proc=64) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/load. py", line 1809, in load_dataset builder_instance.download_and_prepare( File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/build er.py", line 909, in download_and_prepare self._download_and_prepare( File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/build er.py", line 1004, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/build er.py", line 1796, in _prepare_split for job_id, done, content in iflatmap_unordered( File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/utils /py_utils.py", line 1354, in iflatmap_unordered [async_result.get(timeout=0.05) for async_result in async_results] File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/utils /py_utils.py", line 1354, in <listcomp> [async_result.get(timeout=0.05) for async_result in async_results] File "/home/ubuntu/.local/lib/python3.10/site-packages/multiprocess/p ool.py", line 774, in get raise self._value datasets.builder.DatasetGenerationError: An error occurred while generating the dataset ``` ### Expected behavior The dataset downloads properly. @lhoestq @loub ### Environment info Datasets 2.13.1, large VM with 2TB RAM, Ubuntu 20.04
37
the-stack-dedup fails to generate ### Describe the bug I'm getting an error generating the-stack-dedup with datasets 2.13.1, and with 2.14.4 nothing happens. ### Steps to reproduce the bug My code: ``` import os import datasets as ds MY_CACHE_DIR = "/home/ubuntu/the-stack-dedup-local" MY_TOKEN="my-token" the_stack_ds = ds.load_dataset("bigcode/the-stack-dedup", split="train", download_mode="reuse_cache_if_exists", cache_dir=MY_CACHE_DIR, use_auth_token=MY_TOKEN, num_proc=64) ``` The exception: ``` Generating train split: 233248251 examples [54:31, 57280.00 examples/s] multiprocess.pool.RemoteTraceback: """ Traceback (most recent call last): File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/build er.py", line 1879, in _prepare_split_single for _, table in generator: File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/packa ged_modules/parquet/parquet.py", line 82, in _generate_tables yield f"{file_idx}_{batch_idx}", self._cast_table(pa_table) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/packa ged_modules/parquet/parquet.py", line 61, in _cast_table pa_table = table_cast(pa_table, self.info.features.arrow_schema) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/table .py", line 2324, in table_cast return cast_table_to_schema(table, schema) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/table .py", line 2282, in cast_table_to_schema raise ValueError(f"Couldn't cast\n{table.schema}\nto\n{features}\nb ecause column names don't match") ValueError: Couldn't cast hexsha: string size: int64 ext: string lang: string max_stars_repo_path: string max_stars_repo_name: string max_stars_repo_head_hexsha: string max_stars_repo_licenses: list<item: string> child 0, item: string max_stars_count: int64 max_stars_repo_stars_event_min_datetime: string max_stars_repo_stars_event_max_datetime: string max_issues_repo_path: string max_issues_repo_name: string max_issues_repo_head_hexsha: string max_issues_repo_licenses: list<item: string> child 0, item: string max_issues_count: int64 max_issues_repo_issues_event_min_datetime: string max_issues_repo_issues_event_max_datetime: string max_forks_repo_path: string max_forks_repo_name: string max_forks_repo_head_hexsha: string max_forks_repo_licenses: list<item: string> child 0, item: string max_forks_count: int64 max_forks_repo_forks_event_min_datetime: string max_forks_repo_forks_event_max_datetime: string content: string avg_line_length: double max_line_length: int64 alphanum_fraction: double __id__: int64 -- schema metadata -- huggingface: '{"info": {"features": {"hexsha": {"dtype": "string", "_type' + 1979 to {'hexsha': Value(dtype='string', id=None), 'size': Value(dtype='int64', id=None), 'ext': Value(dtype='string', id=None), 'lang': Value(dtype='string', id=None), 'max_stars_repo_path': Value(dtype='string', id=None), 'max_stars_repo_name': Value(dtype='string', id=None), 'max_stars_repo_head_hexsha': Value(dtype='string', id=None), 'max_stars_repo_licenses': Sequence(feature=Value(dtype='string', id=None), length=-1, id=None), 'max_stars_count': Value(dtype='int64', id=None), 'max_stars_repo_stars_event_min_datetime': Value(dtype='string', id=None), 'max_stars_repo_stars_event_max_datetime': Value(dtype='string', id=None), 'max_issues_repo_path': Value(dtype='string', id=None), 'max_issues_repo_name': Value(dtype='string', id=None), 'max_issues_repo_head_hexsha': Value(dtype='string', id=None), 'max_issues_repo_licenses': Sequence(feature=Value(dtype='string', id=None), length=-1, id=None), 'max_issues_count': Value(dtype='int64', id=None), 'max_issues_repo_issues_event_min_datetime': Value(dtype='string', id=None), 'max_issues_repo_issues_event_max_datetime': Value(dtype='string', id=None), 'max_forks_repo_path': Value(dtype='string', id=None), 'max_forks_repo_name': Value(dtype='string', id=None), 'max_forks_repo_head_hexsha': Value(dtype='string', id=None), 'max_forks_repo_licenses': Sequence(feature=Value(dtype='string', id=None), length=-1, id=None), 'max_forks_count': Value(dtype='int64', id=None), 'max_forks_repo_forks_event_min_datetime': Value(dtype='string', id=None), 'max_forks_repo_forks_event_max_datetime': Value(dtype='string', id=None), 'content': Value(dtype='string', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'alphanum_fraction': Value(dtype='float64', id=None)} because column names don't match The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/ubuntu/.local/lib/python3.10/site-packages/multiprocess/p ool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/utils /py_utils.py", line 1328, in _write_generator_to_queue for i, result in enumerate(func(**kwargs)): File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/build er.py", line 1912, in _prepare_split_single raise DatasetGenerationError("An error occurred while generating th e dataset") from e datasets.builder.DatasetGenerationError: An error occurred while genera ting the dataset """ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/ubuntu/download_the_stack.py", line 7, in <module> the_stack_ds = ds.load_dataset("bigcode/the-stack-dedup", split="tr ain", download_mode="reuse_cache_if_exists", cache_dir=MY_CACHE_DIR, us e_auth_token=MY_TOKEN, num_proc=64) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/load. py", line 1809, in load_dataset builder_instance.download_and_prepare( File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/build er.py", line 909, in download_and_prepare self._download_and_prepare( File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/build er.py", line 1004, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/build er.py", line 1796, in _prepare_split for job_id, done, content in iflatmap_unordered( File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/utils /py_utils.py", line 1354, in iflatmap_unordered [async_result.get(timeout=0.05) for async_result in async_results] File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/utils /py_utils.py", line 1354, in <listcomp> [async_result.get(timeout=0.05) for async_result in async_results] File "/home/ubuntu/.local/lib/python3.10/site-packages/multiprocess/p ool.py", line 774, in get raise self._value datasets.builder.DatasetGenerationError: An error occurred while generating the dataset ``` ### Expected behavior The dataset downloads properly. @lhoestq @loub ### Environment info Datasets 2.13.1, large VM with 2TB RAM, Ubuntu 20.04 It seems that some parquet files have additional columns. I ran a scan and found that two files have the additional `__id__` column: 1. `hf://datasets/bigcode/the-stack-dedup/data/numpy/data-00000-of-00001.parquet` 2. `hf://datasets/bigcode/the-stack-dedup/data/omgrofl/data-00000-of-00001.parquet` We should open a PR to fix those two files
https://github.com/huggingface/datasets/issues/6142
the-stack-dedup fails to generate
The files have been fixed ! I'm closing this one but feel free to re-open if you still have the issue
### Describe the bug I'm getting an error generating the-stack-dedup with datasets 2.13.1, and with 2.14.4 nothing happens. ### Steps to reproduce the bug My code: ``` import os import datasets as ds MY_CACHE_DIR = "/home/ubuntu/the-stack-dedup-local" MY_TOKEN="my-token" the_stack_ds = ds.load_dataset("bigcode/the-stack-dedup", split="train", download_mode="reuse_cache_if_exists", cache_dir=MY_CACHE_DIR, use_auth_token=MY_TOKEN, num_proc=64) ``` The exception: ``` Generating train split: 233248251 examples [54:31, 57280.00 examples/s] multiprocess.pool.RemoteTraceback: """ Traceback (most recent call last): File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/build er.py", line 1879, in _prepare_split_single for _, table in generator: File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/packa ged_modules/parquet/parquet.py", line 82, in _generate_tables yield f"{file_idx}_{batch_idx}", self._cast_table(pa_table) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/packa ged_modules/parquet/parquet.py", line 61, in _cast_table pa_table = table_cast(pa_table, self.info.features.arrow_schema) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/table .py", line 2324, in table_cast return cast_table_to_schema(table, schema) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/table .py", line 2282, in cast_table_to_schema raise ValueError(f"Couldn't cast\n{table.schema}\nto\n{features}\nb ecause column names don't match") ValueError: Couldn't cast hexsha: string size: int64 ext: string lang: string max_stars_repo_path: string max_stars_repo_name: string max_stars_repo_head_hexsha: string max_stars_repo_licenses: list<item: string> child 0, item: string max_stars_count: int64 max_stars_repo_stars_event_min_datetime: string max_stars_repo_stars_event_max_datetime: string max_issues_repo_path: string max_issues_repo_name: string max_issues_repo_head_hexsha: string max_issues_repo_licenses: list<item: string> child 0, item: string max_issues_count: int64 max_issues_repo_issues_event_min_datetime: string max_issues_repo_issues_event_max_datetime: string max_forks_repo_path: string max_forks_repo_name: string max_forks_repo_head_hexsha: string max_forks_repo_licenses: list<item: string> child 0, item: string max_forks_count: int64 max_forks_repo_forks_event_min_datetime: string max_forks_repo_forks_event_max_datetime: string content: string avg_line_length: double max_line_length: int64 alphanum_fraction: double __id__: int64 -- schema metadata -- huggingface: '{"info": {"features": {"hexsha": {"dtype": "string", "_type' + 1979 to {'hexsha': Value(dtype='string', id=None), 'size': Value(dtype='int64', id=None), 'ext': Value(dtype='string', id=None), 'lang': Value(dtype='string', id=None), 'max_stars_repo_path': Value(dtype='string', id=None), 'max_stars_repo_name': Value(dtype='string', id=None), 'max_stars_repo_head_hexsha': Value(dtype='string', id=None), 'max_stars_repo_licenses': Sequence(feature=Value(dtype='string', id=None), length=-1, id=None), 'max_stars_count': Value(dtype='int64', id=None), 'max_stars_repo_stars_event_min_datetime': Value(dtype='string', id=None), 'max_stars_repo_stars_event_max_datetime': Value(dtype='string', id=None), 'max_issues_repo_path': Value(dtype='string', id=None), 'max_issues_repo_name': Value(dtype='string', id=None), 'max_issues_repo_head_hexsha': Value(dtype='string', id=None), 'max_issues_repo_licenses': Sequence(feature=Value(dtype='string', id=None), length=-1, id=None), 'max_issues_count': Value(dtype='int64', id=None), 'max_issues_repo_issues_event_min_datetime': Value(dtype='string', id=None), 'max_issues_repo_issues_event_max_datetime': Value(dtype='string', id=None), 'max_forks_repo_path': Value(dtype='string', id=None), 'max_forks_repo_name': Value(dtype='string', id=None), 'max_forks_repo_head_hexsha': Value(dtype='string', id=None), 'max_forks_repo_licenses': Sequence(feature=Value(dtype='string', id=None), length=-1, id=None), 'max_forks_count': Value(dtype='int64', id=None), 'max_forks_repo_forks_event_min_datetime': Value(dtype='string', id=None), 'max_forks_repo_forks_event_max_datetime': Value(dtype='string', id=None), 'content': Value(dtype='string', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'alphanum_fraction': Value(dtype='float64', id=None)} because column names don't match The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/ubuntu/.local/lib/python3.10/site-packages/multiprocess/p ool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/utils /py_utils.py", line 1328, in _write_generator_to_queue for i, result in enumerate(func(**kwargs)): File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/build er.py", line 1912, in _prepare_split_single raise DatasetGenerationError("An error occurred while generating th e dataset") from e datasets.builder.DatasetGenerationError: An error occurred while genera ting the dataset """ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/ubuntu/download_the_stack.py", line 7, in <module> the_stack_ds = ds.load_dataset("bigcode/the-stack-dedup", split="tr ain", download_mode="reuse_cache_if_exists", cache_dir=MY_CACHE_DIR, us e_auth_token=MY_TOKEN, num_proc=64) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/load. py", line 1809, in load_dataset builder_instance.download_and_prepare( File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/build er.py", line 909, in download_and_prepare self._download_and_prepare( File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/build er.py", line 1004, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/build er.py", line 1796, in _prepare_split for job_id, done, content in iflatmap_unordered( File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/utils /py_utils.py", line 1354, in iflatmap_unordered [async_result.get(timeout=0.05) for async_result in async_results] File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/utils /py_utils.py", line 1354, in <listcomp> [async_result.get(timeout=0.05) for async_result in async_results] File "/home/ubuntu/.local/lib/python3.10/site-packages/multiprocess/p ool.py", line 774, in get raise self._value datasets.builder.DatasetGenerationError: An error occurred while generating the dataset ``` ### Expected behavior The dataset downloads properly. @lhoestq @loub ### Environment info Datasets 2.13.1, large VM with 2TB RAM, Ubuntu 20.04
21
the-stack-dedup fails to generate ### Describe the bug I'm getting an error generating the-stack-dedup with datasets 2.13.1, and with 2.14.4 nothing happens. ### Steps to reproduce the bug My code: ``` import os import datasets as ds MY_CACHE_DIR = "/home/ubuntu/the-stack-dedup-local" MY_TOKEN="my-token" the_stack_ds = ds.load_dataset("bigcode/the-stack-dedup", split="train", download_mode="reuse_cache_if_exists", cache_dir=MY_CACHE_DIR, use_auth_token=MY_TOKEN, num_proc=64) ``` The exception: ``` Generating train split: 233248251 examples [54:31, 57280.00 examples/s] multiprocess.pool.RemoteTraceback: """ Traceback (most recent call last): File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/build er.py", line 1879, in _prepare_split_single for _, table in generator: File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/packa ged_modules/parquet/parquet.py", line 82, in _generate_tables yield f"{file_idx}_{batch_idx}", self._cast_table(pa_table) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/packa ged_modules/parquet/parquet.py", line 61, in _cast_table pa_table = table_cast(pa_table, self.info.features.arrow_schema) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/table .py", line 2324, in table_cast return cast_table_to_schema(table, schema) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/table .py", line 2282, in cast_table_to_schema raise ValueError(f"Couldn't cast\n{table.schema}\nto\n{features}\nb ecause column names don't match") ValueError: Couldn't cast hexsha: string size: int64 ext: string lang: string max_stars_repo_path: string max_stars_repo_name: string max_stars_repo_head_hexsha: string max_stars_repo_licenses: list<item: string> child 0, item: string max_stars_count: int64 max_stars_repo_stars_event_min_datetime: string max_stars_repo_stars_event_max_datetime: string max_issues_repo_path: string max_issues_repo_name: string max_issues_repo_head_hexsha: string max_issues_repo_licenses: list<item: string> child 0, item: string max_issues_count: int64 max_issues_repo_issues_event_min_datetime: string max_issues_repo_issues_event_max_datetime: string max_forks_repo_path: string max_forks_repo_name: string max_forks_repo_head_hexsha: string max_forks_repo_licenses: list<item: string> child 0, item: string max_forks_count: int64 max_forks_repo_forks_event_min_datetime: string max_forks_repo_forks_event_max_datetime: string content: string avg_line_length: double max_line_length: int64 alphanum_fraction: double __id__: int64 -- schema metadata -- huggingface: '{"info": {"features": {"hexsha": {"dtype": "string", "_type' + 1979 to {'hexsha': Value(dtype='string', id=None), 'size': Value(dtype='int64', id=None), 'ext': Value(dtype='string', id=None), 'lang': Value(dtype='string', id=None), 'max_stars_repo_path': Value(dtype='string', id=None), 'max_stars_repo_name': Value(dtype='string', id=None), 'max_stars_repo_head_hexsha': Value(dtype='string', id=None), 'max_stars_repo_licenses': Sequence(feature=Value(dtype='string', id=None), length=-1, id=None), 'max_stars_count': Value(dtype='int64', id=None), 'max_stars_repo_stars_event_min_datetime': Value(dtype='string', id=None), 'max_stars_repo_stars_event_max_datetime': Value(dtype='string', id=None), 'max_issues_repo_path': Value(dtype='string', id=None), 'max_issues_repo_name': Value(dtype='string', id=None), 'max_issues_repo_head_hexsha': Value(dtype='string', id=None), 'max_issues_repo_licenses': Sequence(feature=Value(dtype='string', id=None), length=-1, id=None), 'max_issues_count': Value(dtype='int64', id=None), 'max_issues_repo_issues_event_min_datetime': Value(dtype='string', id=None), 'max_issues_repo_issues_event_max_datetime': Value(dtype='string', id=None), 'max_forks_repo_path': Value(dtype='string', id=None), 'max_forks_repo_name': Value(dtype='string', id=None), 'max_forks_repo_head_hexsha': Value(dtype='string', id=None), 'max_forks_repo_licenses': Sequence(feature=Value(dtype='string', id=None), length=-1, id=None), 'max_forks_count': Value(dtype='int64', id=None), 'max_forks_repo_forks_event_min_datetime': Value(dtype='string', id=None), 'max_forks_repo_forks_event_max_datetime': Value(dtype='string', id=None), 'content': Value(dtype='string', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'alphanum_fraction': Value(dtype='float64', id=None)} because column names don't match The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/ubuntu/.local/lib/python3.10/site-packages/multiprocess/p ool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/utils /py_utils.py", line 1328, in _write_generator_to_queue for i, result in enumerate(func(**kwargs)): File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/build er.py", line 1912, in _prepare_split_single raise DatasetGenerationError("An error occurred while generating th e dataset") from e datasets.builder.DatasetGenerationError: An error occurred while genera ting the dataset """ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/ubuntu/download_the_stack.py", line 7, in <module> the_stack_ds = ds.load_dataset("bigcode/the-stack-dedup", split="tr ain", download_mode="reuse_cache_if_exists", cache_dir=MY_CACHE_DIR, us e_auth_token=MY_TOKEN, num_proc=64) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/load. py", line 1809, in load_dataset builder_instance.download_and_prepare( File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/build er.py", line 909, in download_and_prepare self._download_and_prepare( File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/build er.py", line 1004, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/build er.py", line 1796, in _prepare_split for job_id, done, content in iflatmap_unordered( File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/utils /py_utils.py", line 1354, in iflatmap_unordered [async_result.get(timeout=0.05) for async_result in async_results] File "/home/ubuntu/.local/lib/python3.10/site-packages/datasets/utils /py_utils.py", line 1354, in <listcomp> [async_result.get(timeout=0.05) for async_result in async_results] File "/home/ubuntu/.local/lib/python3.10/site-packages/multiprocess/p ool.py", line 774, in get raise self._value datasets.builder.DatasetGenerationError: An error occurred while generating the dataset ``` ### Expected behavior The dataset downloads properly. @lhoestq @loub ### Environment info Datasets 2.13.1, large VM with 2TB RAM, Ubuntu 20.04 The files have been fixed ! I'm closing this one but feel free to re-open if you still have the issue

Dataset Card for "my-issues-dataset"

More Information needed

Downloads last month
0
Edit dataset card