id
int64
599M
3.26B
number
int64
1
7.7k
title
stringlengths
1
290
body
stringlengths
0
228k
state
stringclasses
2 values
html_url
stringlengths
46
51
created_at
timestamp[s]date
2020-04-14 10:18:02
2025-07-23 08:04:53
updated_at
timestamp[s]date
2020-04-27 16:04:17
2025-07-23 18:53:44
closed_at
timestamp[s]date
2020-04-14 12:01:40
2025-07-23 16:44:42
user
dict
labels
listlengths
0
4
is_pull_request
bool
2 classes
comments
listlengths
0
0
1,961,869,203
6,350
Different objects are returned from calls that should be returning the same kind of object.
### Describe the bug 1. dataset = load_dataset("togethercomputer/RedPajama-Data-1T-Sample", cache_dir=training_args.cache_dir, split='train[:1%]') 2. dataset = load_dataset("togethercomputer/RedPajama-Data-1T-Sample", cache_dir=training_args.cache_dir) The only difference I would expect these calls to have is the size of the dataset. But, while 2. returns a dictionary with "train" key in it, 1. returns a dataset WITHOUT any initial "train" keyword. Both calls are to be used within exactly the same context. They should return identically structured datasets of different size. ### Steps to reproduce the bug See above. ### Expected behavior Expect both calls to return the same structured Dataset structure but with different number of elements, i.e. call 1. should have 1% of the data of the call 2.0 ### Environment info Ubuntu 20.04 gcc 9.x.x. It is really irrelevant.
open
https://github.com/huggingface/datasets/issues/6350
2023-10-25T17:08:39
2023-10-26T21:03:06
null
{ "login": "phalexo", "id": 4603365, "type": "User" }
[]
false
[]
1,961,435,673
6,349
Can't load ds = load_dataset("imdb")
### Describe the bug I did `from datasets import load_dataset, load_metric` and then `ds = load_dataset("imdb")` and it gave me the error: ExpectedMoreDownloadedFiles: {'http://ai.stanford.edu/~amaas/data/sentiment/aclImdb_v1.tar.gz'} I tried doing `ds = load_dataset("imdb",download_mode="force_redownload")` as well as reinstalling dataset. I still face this problem. ### Steps to reproduce the bug 1. from datasets import load_dataset, load_metric 2. ds = load_dataset("imdb") ### Expected behavior It should load and give me this when I run `ds` DatasetDict({ train: Dataset({ features: ['text', 'label'], num_rows: 25000 }) test: Dataset({ features: ['text', 'label'], num_rows: 25000 }) unsupervised: Dataset({ features: ['text', 'label'], num_rows: 50000 }) }) ### Environment info - `datasets` version: 2.14.6 - Platform: Linux-5.4.0-164-generic-x86_64-with-glibc2.17 - Python version: 3.8.18 - Huggingface_hub version: 0.16.2 - PyArrow version: 13.0.0 - Pandas version: 2.0.2
closed
https://github.com/huggingface/datasets/issues/6349
2023-10-25T13:29:51
2024-03-20T15:09:53
2023-10-31T19:59:35
{ "login": "vivianc2", "id": 86415736, "type": "User" }
[]
false
[]
1,961,268,504
6,348
Parquet stream-conversion fails to embed images/audio files from gated repos
it seems to be an issue with datasets not passing the token to embed_table_storage when generating a dataset See https://github.com/huggingface/datasets-server/issues/2010
open
https://github.com/huggingface/datasets/issues/6348
2023-10-25T12:12:44
2025-04-17T12:21:43
null
{ "login": "severo", "id": 1676121, "type": "User" }
[ { "name": "bug", "color": "d73a4a" } ]
false
[]
1,959,004,835
6,347
Incorrect example code in 'Create a dataset' docs
### Describe the bug On [this](https://huggingface.co/docs/datasets/create_dataset) page, the example code for loading in images and audio is incorrect. Currently, examples are: ``` python from datasets import ImageFolder dataset = load_dataset("imagefolder", data_dir="/path/to/pokemon") ``` and ``` python from datasets import AudioFolder dataset = load_dataset("audiofolder", data_dir="/path/to/folder") ``` I'm pretty sure the imports are wrong and should be: ``` python from datasets import load_dataset dataset = load_dataset("audiofolder", data_dir="/path/to/folder") ``` I am happy to update this if this is right but just wanted to check before making any changes. ### Steps to reproduce the bug Go to https://huggingface.co/docs/datasets/create_dataset ### Expected behavior N/A ### Environment info N/A
closed
https://github.com/huggingface/datasets/issues/6347
2023-10-24T11:01:21
2023-10-25T13:05:21
2023-10-25T13:05:21
{ "login": "rwood-97", "id": 72076688, "type": "User" }
[]
false
[]
1,958,777,076
6,346
Fix UnboundLocalError if preprocessing returns an empty list
If this tokenization function is used with IterableDatasets and no sample is as big as the context length, `input_batch` will be an empty list. ``` def tokenize(batch, tokenizer, context_length): outputs = tokenizer( batch["text"], truncation=True, max_length=context_length, return_overflowing_tokens=True, return_length=True ) input_batch = [] for length, input_ids in zip(outputs["length"], outputs["input_ids"]): if length == context_length: input_batch.append(input_ids) return {"input_ids": input_batch} dataset.map(tokenize, batched=True, batch_size=batch_size, fn_kwargs={"context_length": context_length, "tokenizer": tokenizer}, remove_columns=dataset.column_names) ``` This will throw the following error: UnboundLocalError: local variable 'batch_idx' referenced before assignment, because the for loop was not executed a single time ``` for batch_idx, example in enumerate(_batch_to_examples(transformed_batch)): yield new_key, example current_idx += batch_idx + 1 ``` Some of the possible solutions ``` for batch_idx, example in enumerate(_batch_to_examples(transformed_batch)): yield new_key, example try: current_idx += batch_idx + 1 except: current_idx += 1 ``` or ``` batch_idx = 0 for batch_idx, example in enumerate(_batch_to_examples(transformed_batch)): yield new_key, example current_idx += batch_idx + 1 ```
closed
https://github.com/huggingface/datasets/pull/6346
2023-10-24T08:38:43
2023-10-25T17:39:17
2023-10-25T16:36:38
{ "login": "cwallenwein", "id": 40916592, "type": "User" }
[]
true
[]
1,957,707,870
6,345
support squad structure datasets using a YAML parameter
### Feature request Since the squad structure is widely used, I think it could be beneficial to support it using a YAML parameter. could you implement automatic data loading of squad-like data using squad JSON format, to read it from JSON files and view it in the correct squad structure. The dataset structure should be like this: https://huggingface.co/datasets/squad Columns:id,title,context,question,answers ### Motivation Dataset repo requires arbitrary Python code execution ### Your contribution The dataset structure should be like this: https://huggingface.co/datasets/squad Columns:id,title,context,question,answers train and dev sets in squad structure JSON files
open
https://github.com/huggingface/datasets/issues/6345
2023-10-23T17:55:37
2023-10-23T17:55:37
null
{ "login": "MajdTannous1", "id": 138524319, "type": "User" }
[ { "name": "enhancement", "color": "a2eeef" } ]
false
[]
1,957,412,169
6,344
set dev version
null
closed
https://github.com/huggingface/datasets/pull/6344
2023-10-23T15:13:28
2023-10-23T15:24:31
2023-10-23T15:13:38
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,957,370,711
6,343
Remove unused argument in `_get_data_files_patterns`
null
closed
https://github.com/huggingface/datasets/pull/6343
2023-10-23T14:54:18
2023-11-16T09:09:42
2023-11-16T09:03:39
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,957,344,445
6,342
Release: 2.14.6
null
closed
https://github.com/huggingface/datasets/pull/6342
2023-10-23T14:43:26
2023-10-23T15:21:54
2023-10-23T15:07:25
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,956,917,893
6,340
Release 2.14.5
(wrong release number - I was continuing the 2.14 branch but 2.14.5 was released from `main`)
closed
https://github.com/huggingface/datasets/pull/6340
2023-10-23T11:10:22
2023-10-23T14:20:46
2023-10-23T11:12:40
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,956,912,627
6,339
minor release step improvement
null
closed
https://github.com/huggingface/datasets/pull/6339
2023-10-23T11:07:04
2023-11-07T10:38:54
2023-11-07T10:32:41
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,956,886,072
6,338
pin fsspec before it switches to glob.glob
null
closed
https://github.com/huggingface/datasets/pull/6338
2023-10-23T10:50:54
2024-01-11T06:32:56
2023-10-23T10:51:52
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,956,875,259
6,337
Pin supported upper version of fsspec
Pin upper version of `fsspec` to avoid disruptions introduced by breaking changes (and the need of urgent patch releases with hotfixes) on each release on their side. See: - #6331 - #6210 - #5731 - #5617 - #5447 I propose that we explicitly test, introduce fixes and support each new `fsspec` version release. CC: @LysandreJik
closed
https://github.com/huggingface/datasets/pull/6337
2023-10-23T10:44:16
2023-10-23T12:13:20
2023-10-23T12:04:36
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
true
[]
1,956,827,232
6,336
unpin-fsspec
Close #6333.
closed
https://github.com/huggingface/datasets/pull/6336
2023-10-23T10:16:46
2024-02-07T12:41:35
2023-10-23T10:17:48
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,956,740,818
6,335
Support fsspec 2023.10.0
Fix #6333.
closed
https://github.com/huggingface/datasets/pull/6335
2023-10-23T09:29:17
2024-01-11T06:33:35
2023-11-14T14:17:40
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
true
[]
1,956,719,774
6,334
datasets.filesystems: fix is_remote_filesystems
Close #6330, close #6333. `fsspec.implementations.LocalFilesystem.protocol` was changed from `str` "file" to `tuple[str,...]` ("file", "local") in `fsspec>=2023.10.0` This commit supports both styles.
closed
https://github.com/huggingface/datasets/pull/6334
2023-10-23T09:17:54
2024-02-07T12:41:15
2023-10-23T10:14:10
{ "login": "ap--", "id": 1463443, "type": "User" }
[]
true
[]
1,956,714,423
6,333
Support fsspec 2023.10.0
Once root issue is fixed, remove temporary pin of fsspec < 2023.10.0 introduced by: - #6331 Related to issue: - #6330 As @ZachNagengast suggested, the issue might be related to: - https://github.com/fsspec/filesystem_spec/pull/1381
closed
https://github.com/huggingface/datasets/issues/6333
2023-10-23T09:14:53
2024-02-07T12:39:58
2024-02-07T12:39:58
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
false
[]
1,956,697,328
6,332
Replace deprecated license_file in setup.cfg
Replace deprecated license_file in `setup.cfg`. See: https://github.com/huggingface/datasets/actions/runs/6610930650/job/17953825724?pr=6331 ``` /tmp/pip-build-env-a51hls20/overlay/lib/python3.8/site-packages/setuptools/config/setupcfg.py:293: _DeprecatedConfig: Deprecated config in `setup.cfg` !! ******************************************************************************** The license_file parameter is deprecated, use license_files instead. By 2023-Oct-30, you need to update your project and remove deprecated calls or your builds will no longer be supported. See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details. ******************************************************************************** !! ```
closed
https://github.com/huggingface/datasets/pull/6332
2023-10-23T09:05:26
2023-11-07T08:23:10
2023-11-07T08:09:06
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
true
[]
1,956,671,256
6,331
Temporarily pin fsspec < 2023.10.0
Temporarily pin fsspec < 2023.10.0 until permanent solution is found. Hot fix #6330. See: https://github.com/huggingface/datasets/actions/runs/6610904287/job/17953774987 ``` ... ERROR tests/test_iterable_dataset.py::test_iterable_dataset_from_file - NotImplementedError: Loading a dataset cached in a LocalFileSystem is not supported. = 373 failed, 2055 passed, 17 skipped, 8 warnings, 6 errors in 228.14s (0:03:48) = ```
closed
https://github.com/huggingface/datasets/pull/6331
2023-10-23T08:51:50
2023-10-23T09:26:42
2023-10-23T09:17:55
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
true
[]
1,956,053,294
6,330
Latest fsspec==2023.10.0 issue with streaming datasets
### Describe the bug Loading a streaming dataset with this version of fsspec fails with the following error: `NotImplementedError: Loading a streaming dataset cached in a LocalFileSystem is not supported yet.` I suspect the issue is with this PR https://github.com/fsspec/filesystem_spec/pull/1381 ### Steps to reproduce the bug 1. Upgrade fsspec to version `2023.10.0` 2. Attempt to load a streaming dataset e.g. `load_dataset("laion/gpt4v-emotion-dataset", split="train", streaming=True)` 3. Observe the following exception: ``` File "/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/datasets/load.py", line 2146, in load_dataset return builder_instance.as_streaming_dataset(split=split) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/datasets/builder.py", line 1318, in as_streaming_dataset raise NotImplementedError( NotImplementedError: Loading a streaming dataset cached in a LocalFileSystem is not supported yet. ``` ### Expected behavior Should stream the dataset as normal. ### Environment info datasets@main fsspec==2023.10.0
closed
https://github.com/huggingface/datasets/issues/6330
2023-10-22T20:57:10
2025-06-09T22:00:16
2023-10-23T09:17:56
{ "login": "ZachNagengast", "id": 1981179, "type": "User" }
[]
false
[]
1,955,858,020
6,329
شبکه های متن به گفتار ابتدا متن داده شده را به بازنمایی میانی
شبکه های متن به گفتار ابتدا متن داده شده را به بازنمایی میانی
closed
https://github.com/huggingface/datasets/issues/6329
2023-10-22T11:07:46
2023-10-23T09:22:58
2023-10-23T09:22:58
{ "login": "shabnam706", "id": 147399213, "type": "User" }
[]
false
[]
1,955,857,904
6,328
شبکه های متن به گفتار ابتدا متن داده شده را به بازنمایی میانی
null
closed
https://github.com/huggingface/datasets/issues/6328
2023-10-22T11:07:21
2023-10-23T09:22:38
2023-10-23T09:22:38
{ "login": "shabnam706", "id": 147399213, "type": "User" }
[]
false
[]
1,955,470,755
6,327
FileNotFoundError when trying to load the downloaded dataset with `load_dataset(..., streaming=True)`
### Describe the bug Hi, I'm trying to load the dataset `togethercomputer/RedPajama-Data-1T-Sample` with `load_dataset` in streaming mode, i.e., `streaming=True`, but `FileNotFoundError` occurs. ### Steps to reproduce the bug I've downloaded the dataset and save it to the cache dir in advance. My hope is loading the files in offline environment and without taking too much hours to prepross the entire data before running into the training process. So I try the following code to load the files streamingly ```py dataset = load_dataset('togethercomputer/RedPajama-Data-1T-Sample', streaming=True) print(next(iter(dataset['train']))) ``` Sadly, it raises the following: ``` FileNotFoundError: [Errno 2] No such file or directory: 'CURRENT_CODE_PATH/arxiv_sample.jsonl' ``` I've noticed that the dataset can be properly found in the begining ``` Using the latest cached version of the module from /root/.cache/huggingface/modules/datasets_modules/datasets/togethercomputer--RedPajama-Data-1T-Sample/6ea3bc8ec2e84ec6d2df1930942e9028ace8c5b9d9143823cf911c50bbd92039 (last modified on Sat Oct 21 20:12:57 2023) since it couldn't be found locally at togethercomputer/RedPajama-Data-1T-Sample., or remotely on the Hugging Face Hub. ``` But it seems that the paths couldn't be properly parsed when loading iteratively. How should I fix this error. I've tried specifying `data_files` or `data_dir` as `.../arxiv_sample.jsonl` but none of them works. Thanks. ### Expected behavior Properly load the dataset. ### Environment info `datasets==2.14.5`
closed
https://github.com/huggingface/datasets/issues/6327
2023-10-21T12:27:03
2023-10-23T18:50:07
2023-10-23T18:50:07
{ "login": "yzhangcs", "id": 18402347, "type": "User" }
[]
false
[]
1,955,420,536
6,326
Create battery_analysis.py
null
closed
https://github.com/huggingface/datasets/pull/6326
2023-10-21T10:07:48
2023-10-23T14:56:20
2023-10-23T14:56:20
{ "login": "vinitkm", "id": 130216732, "type": "User" }
[]
true
[]
1,955,420,178
6,325
Create battery_analysis.py
null
closed
https://github.com/huggingface/datasets/pull/6325
2023-10-21T10:06:37
2023-10-23T14:55:58
2023-10-23T14:55:58
{ "login": "vinitkm", "id": 130216732, "type": "User" }
[]
true
[]
1,955,126,687
6,324
Conversion to Arrow fails due to wrong type heuristic
### Describe the bug I have a list of dictionaries with valid/JSON-serializable values. One key is the denominator for a paragraph. In 99.9% of cases its a number, but there are some occurences of '1a', '2b' and so on. If trying to convert this list to a dataset with `Dataset.from_list()`, I always get `ArrowInvalid: Could not convert '1' with type str: tried to convert to int64`, presumably because pyarrow tries to convert the keys to integers. Is there any way to circumvent this and fix dtypes? I didn't find anything in the documentation. ### Steps to reproduce the bug * create a list of dicts with one key being a string of an integer for the first few thousand occurences and try to convert to dataset. ### Expected behavior There shouldn't be an error (e.g. some flag to turn off automatic str to numeric conversion). ### Environment info - `datasets` version: 2.14.5 - Platform: Linux-5.15.0-84-generic-x86_64-with-glibc2.35 - Python version: 3.9.18 - Huggingface_hub version: 0.17.3 - PyArrow version: 13.0.0 - Pandas version: 2.1.1
closed
https://github.com/huggingface/datasets/issues/6324
2023-10-20T23:20:58
2023-10-23T20:52:57
2023-10-23T20:52:57
{ "login": "jphme", "id": 2862336, "type": "User" }
[]
false
[]
1,954,245,980
6,323
Loading dataset from large GCS bucket very slow since 2.14
### Describe the bug Since updating to >2.14 we have very slow access to our parquet files on GCS when loading a dataset (>30 min vs 3s). Our GCS bucket has many objects and resolving globs is very slow. I could track down the problem to this change: https://github.com/huggingface/datasets/blame/bade7af74437347a760830466eb74f7a8ce0d799/src/datasets/data_files.py#L348 The underlying implementation with gcsfs is really slow. Could you go back to the old way if we are simply giving the parquet files and no glob pattern? Thank you. ### Steps to reproduce the bug Load a dataset from a GCS bucket that has many files. ### Expected behavior Used to be fast (3s) in 2.13 ### Environment info datasets==2.14.5
open
https://github.com/huggingface/datasets/issues/6323
2023-10-20T12:59:55
2024-09-03T18:42:33
null
{ "login": "jbcdnr", "id": 6209990, "type": "User" }
[]
false
[]
1,952,947,461
6,322
Fix regex `get_data_files` formatting for base paths
With this pr https://github.com/huggingface/datasets/pull/6309, it is formatting the entire base path into regex, which results in the undesired formatting error `doesn't match the pattern` because of the line in `glob_pattern_to_regex`: `.replace("//", "/")`: - Input: `hf://datasets/...` - Output: `hf:/datasets/...` This fix will only convert the `split_pattern` to regex and keep the `base_path` unchanged. cc @albertvillanova hopefully this still works with your implementation
closed
https://github.com/huggingface/datasets/pull/6322
2023-10-19T19:45:10
2023-10-23T14:40:45
2023-10-23T14:31:21
{ "login": "ZachNagengast", "id": 1981179, "type": "User" }
[]
true
[]
1,952,643,483
6,321
Fix typos
null
closed
https://github.com/huggingface/datasets/pull/6321
2023-10-19T16:24:35
2023-10-19T17:18:00
2023-10-19T17:07:35
{ "login": "python273", "id": 3097956, "type": "User" }
[]
true
[]
1,952,618,316
6,320
Dataset slice splits can't load training and validation at the same time
### Describe the bug According to the [documentation](https://huggingface.co/docs/datasets/v2.14.5/loading#slice-splits) is should be possible to run the following command: `train_test_ds = datasets.load_dataset("bookcorpus", split="train+test")` to load the train and test sets from the dataset. However executing the equivalent code: `speech_commands_v1 = load_dataset("superb", "ks", split="train+test")` only yields the following output: > Dataset({ > features: ['file', 'audio', 'label'], > num_rows: 54175 > }) Where loading the dataset without the split argument yields: > DatasetDict({ > train: Dataset({ > features: ['file', 'audio', 'label'], > num_rows: 51094 > }) > validation: Dataset({ > features: ['file', 'audio', 'label'], > num_rows: 6798 > }) > test: Dataset({ > features: ['file', 'audio', 'label'], > num_rows: 3081 > }) > }) Thus, the API seems to be broken in this regard. This is a bit annoying since I want to be able to use the split argument with `split="train[:10%]+test[:10%]"` to have smaller dataset to work with when validating my model is working correctly. ### Steps to reproduce the bug `speech_commands_v1 = load_dataset("superb", "ks", split="train+test")` ### Expected behavior > DatasetDict({ > train: Dataset({ > features: ['file', 'audio', 'label'], > num_rows: 51094 > }) > test: Dataset({ > features: ['file', 'audio', 'label'], > num_rows: 3081 > }) > }) ### Environment info ``` import datasets print(datasets.__version__) ``` > 2.14.5 ``` import sys print(sys.version) ``` > 3.9.17 (main, Jul 5 2023, 20:41:20) > [GCC 11.2.0]
closed
https://github.com/huggingface/datasets/issues/6320
2023-10-19T16:09:22
2023-11-30T16:21:15
2023-11-30T16:21:15
{ "login": "timlac", "id": 32488097, "type": "User" }
[]
false
[]
1,952,101,717
6,319
Datasets.map is severely broken
### Describe the bug Regardless of how many cores I used, I have 16 or 32 threads, map slows down to a crawl at around 80% done, lingers maybe until 97% extremely slowly and NEVER finishes the job. It just hangs. After watching this for 27 hours I control-C out of it. Until the end one process appears to be doing something, but it never ends. I saw some comments about fast tokenizers using Rust and all and tried different variations. NOTHING works. ### Steps to reproduce the bug Running it without breaking the dataset into parts results in the same behavior. The loop was an attempt to see if this was a RAM issue. for idx in range(100): dataset = load_dataset("togethercomputer/RedPajama-Data-1T-Sample", cache_dir=cache_dir, split=f'train[{idx}%:{idx+1}%]') dataset = dataset.map(partial(tokenize_fn, tokenizer), batched=False, num_proc=1, remove_columns=["text", "meta"]) dataset.save_to_disk(training_args.cache_dir + f"/training_data_{idx}") ### Expected behavior I expect map to run at more or less the same speed it starts with and FINISH its processing. ### Environment info Python 3.8, same with 3.10 makes no difference. Ubuntu 20.04,
open
https://github.com/huggingface/datasets/issues/6319
2023-10-19T12:19:33
2024-08-08T17:05:08
null
{ "login": "phalexo", "id": 4603365, "type": "User" }
[]
false
[]
1,952,100,706
6,318
Deterministic set hash
Sort the items in a set according to their `datasets.fingerprint.Hasher.hash` hash to get a deterministic hash of sets. This is useful to get deterministic hashes of tokenizers that use a trie based on python sets. reported in https://github.com/huggingface/datasets/issues/3847
closed
https://github.com/huggingface/datasets/pull/6318
2023-10-19T12:19:13
2023-10-19T16:27:20
2023-10-19T16:16:31
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,951,965,668
6,317
sentiment140 dataset unavailable
### Describe the bug loading the dataset using load_dataset("sentiment140") returns the following error ConnectionError: Couldn't reach http://cs.stanford.edu/people/alecmgo/trainingandtestdata.zip (error 403) ### Steps to reproduce the bug Run the following code (version should not matter). ``` from datasets import load_dataset data = load_dataset("sentiment140") ``` ### Expected behavior The dataset should be loaded just like any other. The main issue is that it is no longer hosted by stanford. It is still available from a [Google Drive Link](https://docs.google.com/file/d/0B04GJPshIjmPRnZManQwWEdTZjg/edit). ### Environment info - `datasets` version: 2.14.5 - Platform: Windows-10-10.0.19045-SP0 - Python version: 3.10.8 - Huggingface_hub version: 0.17.3 - PyArrow version: 13.0.0 - Pandas version: 2.1.1
closed
https://github.com/huggingface/datasets/issues/6317
2023-10-19T11:25:21
2023-10-19T13:04:56
2023-10-19T13:04:56
{ "login": "AndreasKarasenko", "id": 52670382, "type": "User" }
[]
false
[]
1,951,819,869
6,316
Fix loading Hub datasets with CSV metadata file
Currently, the reading of the metadata file infers the file extension (.jsonl or .csv) from the passed filename. However, downloaded files from the Hub don't have file extension. For example: - the original file: `hf://datasets/__DUMMY_TRANSFORMERS_USER__/test-dataset-5916a4-16977085077831/metadata.jsonl` - corresponds to the downloaded path: `/tmp/pytest-of-username/pytest-46/cache/datasets/downloads/9f5374dbb470f711f6b89d66a5eec1f19cc96324b26bcbebe29138bda6cb20e6`, which does not have extension In the case where the metadata file does not have an extension, the reader assumes it is a JSONL file, thus the reported error when trying to read a CSV file as a JSONL one: `ArrowInvalid: JSON parse error: Invalid value. in row 0` This behavior was introduced by: - #4837 This PR extracts the metadata file extension from the original filename (instead of the downloaded one) and passes it as a parameter to the read_metadata function. Fix #6315.
closed
https://github.com/huggingface/datasets/pull/6316
2023-10-19T10:21:34
2023-10-20T06:23:21
2023-10-20T06:14:09
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
true
[]
1,951,800,819
6,315
Hub datasets with CSV metadata raise ArrowInvalid: JSON parse error: Invalid value. in row 0
When trying to load a Hub dataset that contains a CSV metadata file, it raises an `ArrowInvalid` error: ``` E pyarrow.lib.ArrowInvalid: JSON parse error: Invalid value. in row 0 pyarrow/error.pxi:100: ArrowInvalid ``` See: https://huggingface.co/datasets/lukarape/public_small_papers/discussions/1
closed
https://github.com/huggingface/datasets/issues/6315
2023-10-19T10:11:29
2023-10-20T06:14:10
2023-10-20T06:14:10
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[ { "name": "bug", "color": "d73a4a" } ]
false
[]
1,951,684,763
6,314
Support creating new branch in push_to_hub
This adds support for creating a new branch when pushing a dataset to the hub. Tested both methods locally and branches are created.
closed
https://github.com/huggingface/datasets/pull/6314
2023-10-19T09:12:39
2023-10-19T09:20:06
2023-10-19T09:19:48
{ "login": "jmif", "id": 1000442, "type": "User" }
[]
true
[]
1,951,527,712
6,313
Fix commit message formatting in multi-commit uploads
Currently, the commit message keeps on adding: - `Upload dataset (part 00000-of-00002)` - `Upload dataset (part 00000-of-00002) (part 00001-of-00002)` Introduced in https://github.com/huggingface/datasets/pull/6269 This PR fixes this issue to have - `Upload dataset (part 00000-of-00002)` - `Upload dataset (part 00001-of-00002)`
closed
https://github.com/huggingface/datasets/pull/6313
2023-10-19T07:53:56
2023-10-20T14:06:13
2023-10-20T13:57:39
{ "login": "qgallouedec", "id": 45557362, "type": "User" }
[]
true
[]
1,950,128,416
6,312
docs: resolving namespace conflict, refactored variable
In docs of about_arrow.md, in the below example code ![image](https://github.com/huggingface/datasets/assets/74114936/fc70e152-e15f-422e-949a-1c4c4c9aa116) The variable name 'time' was being used in a way that could potentially lead to a namespace conflict with Python's built-in 'time' module. It is not a good convention and can lead to unintended variable shadowing for any user re-using the example code. To ensure code clarity, and prevent potential naming conflicts renamed the variable 'time' to 'elapsed_time' in the example code.
closed
https://github.com/huggingface/datasets/pull/6312
2023-10-18T16:10:59
2023-10-19T16:31:59
2023-10-19T16:23:07
{ "login": "smty2018", "id": 74114936, "type": "User" }
[]
true
[]
1,949,304,993
6,311
cast_column to Sequence with length=4 occur exception raise in datasets/table.py:2146
### Describe the bug i load a dataset from local csv file which has 187383612 examples, then use `map` to generate new columns for test. here is my code : ``` import os from datasets import load_dataset from datasets.features import Sequence, Value def add_new_path(example): example["ais_bbox"] = [100,100,200,200] example["ais_image_path"] = os.path.join("images", example["image_path"]) if example["image_path"] else "" return example ais_dataset = load_dataset("/data/ryan.gao/ais_dataset_cache/raw/1749/") hf_ds = ais_dataset.map(add_new_path, batched=False, num_proc=32) ds = hf_ds.cast_column("ais_bbox", Sequence(Value("int32"), length=4)) ``` and the `cast_column` raise an exception ``` Casting the dataset: 3%|███▉ ... File "/home/protoss.gao/.local/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 2110, in cast_column return self.cast(features) File "/home/protoss.gao/.local/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 2055, in cast dataset = dataset.map( File "/home/protoss.gao/.local/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 592, in wrapper out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs) File "/home/protoss.gao/.local/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 557, in wrapper out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs) File "/home/protoss.gao/.local/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 3097, in map for rank, done, content in Dataset._map_single(**dataset_kwargs): File "/home/protoss.gao/.local/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 3474, in _map_single batch = apply_function_on_filtered_inputs( File "/home/protoss.gao/.local/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 3353, in apply_function_on_filtered_inputs processed_inputs = function(*fn_args, *additional_args, **fn_kwargs) File "/home/protoss.gao/.local/lib/python3.9/site-packages/datasets/table.py", line 2329, in table_cast return cast_table_to_schema(table, schema) File "/home/protoss.gao/.local/lib/python3.9/site-packages/datasets/table.py", line 2288, in cast_table_to_schema arrays = [cast_array_to_feature(table[name], feature) for name, feature in features.items()] File "/home/protoss.gao/.local/lib/python3.9/site-packages/datasets/table.py", line 2288, in <listcomp> arrays = [cast_array_to_feature(table[name], feature) for name, feature in features.items()] File "/home/protoss.gao/.local/lib/python3.9/site-packages/datasets/table.py", line 1831, in wrapper return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks]) File "/home/protoss.gao/.local/lib/python3.9/site-packages/datasets/table.py", line 1831, in <listcomp> return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks]) File "/home/protoss.gao/.local/lib/python3.9/site-packages/datasets/table.py", line 2145, in cast_array_to_feature raise TypeError(f"Couldn't cast array of type\n{array.type}\nto\n{feature}") TypeError: Couldn't cast array of type list<item: int64> to Sequence(feature=Value(dtype='int32', id=None), length=4, id=None) ``` i check the source code and make debug info: in datasets/table.py:2092 ``` 2091 if feature.length > -1: 2092 if feature.length * len(array) == len(array.values): 2093 return pa.FixedSizeListArray.from_arrays(_c(array.values, feature.feature), feature.length) 2094 print(len(array)) 2095 print(len(array.values)) ``` my feature.length is 4. but feature.length * len(array) == len(array.values) is false. print(len(array)) is 262 print(len(array.values)) is 4000 then I use "for item in array" to print each item then get 262 * [100,100,200,200] and use "for item in array.values" to print each item and get 4000 int32 which are 1000 * [100,100,200,200] i'm wondering the `chunk` in each `array.chunks`, the "chunk.values" may get all the chunks's value rather than single chunk? but i check the pyarrow's doc seems chunk.values is chunk's value not all. ### Steps to reproduce the bug code provided above. ### Expected behavior feature.length * len(array) == len(array.values) should be true. and there should not has Exception. ### Environment info python3.9 x86_64 datasets: 2.14.4 pyarrow: 13.0.0 or 10.0.0
closed
https://github.com/huggingface/datasets/issues/6311
2023-10-18T09:38:05
2024-02-06T19:24:20
2024-02-06T19:24:20
{ "login": "neiblegy", "id": 16574677, "type": "User" }
[]
false
[]
1,947,457,988
6,310
Add return_file_name in load_dataset
Proposition to fix #5806. Added an optional parameter `return_file_name` in the dataset builder config. When set to `True`, the function will include the file name corresponding to the sample in the returned output. There is a difference between arrow-based and folder-based datasets to return the file name: - for arrow-based: a column is concatenated after the table is cast. - for folder-based: `dataset.info.features` has the entry `file_name` and the original file name is passed to the `sample_metadata` dictionary. The difference in behavior might be a concern, also I do not know whether the `file_name` should return the original file path or the downloaded one for folder-based datasets. I added some tests for the datasets that already had a test file.
closed
https://github.com/huggingface/datasets/pull/6310
2023-10-17T13:36:57
2024-08-09T11:51:55
2024-07-31T13:56:50
{ "login": "juliendenize", "id": 40604584, "type": "User" }
[]
true
[]
1,946,916,969
6,309
Fix get_data_patterns for directories with the word data twice
Before the fix, `get_data_patterns` inferred wrongly the split name for paths with the word "data" twice: - For the URL path: `hf://datasets/piuba-bigdata/articles_and_comments@f328d536425ae8fcac5d098c8408f437bffdd357/data/train-00001-of-00009.parquet` (note the org name `piuba-bigdata/` ending with `data/`) - The inferred split name was: `articles_and_comments@f328d536425ae8fcac5d098c8408f437bffdd357/data/train` instead of `train` This PR fixes this issue by passing the `base_path` (`hf://datasets/piuba-bigdata/articles_and_comments@f328d536425ae8fcac5d098c8408f437bffdd357`) to `_get_data_files_patterns` and prepending it to the regex split pattern (`data/{split}-[0-9][0-9][0-9][0-9][0-9]-of-[0-9][0-9][0-9][0-9][0-9].*\\..*`). Fix #6305. Fix https://huggingface.co/datasets/piuba-bigdata/articles_and_comments/discussions/1
closed
https://github.com/huggingface/datasets/pull/6309
2023-10-17T09:00:39
2023-10-18T14:01:52
2023-10-18T13:50:35
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
true
[]
1,946,810,625
6,308
module 'resource' has no attribute 'error'
### Describe the bug just run import: `from datasets import load_dataset` and then: ``` File "C:\ProgramData\anaconda3\envs\py310\lib\site-packages\datasets\__init__.py", line 22, in <module> from .arrow_dataset import Dataset File "C:\ProgramData\anaconda3\envs\py310\lib\site-packages\datasets\arrow_dataset.py", line 66, in <module> from .arrow_reader import ArrowReader File "C:\ProgramData\anaconda3\envs\py310\lib\site-packages\datasets\arrow_reader.py", line 30, in <module> from .download.download_config import DownloadConfig File "C:\ProgramData\anaconda3\envs\py310\lib\site-packages\datasets\download\__init__.py", line 10, in <module> from .streaming_download_manager import StreamingDownloadManager File "C:\ProgramData\anaconda3\envs\py310\lib\site-packages\datasets\download\streaming_download_manager.py", line 21, in <module> from ..filesystems import COMPRESSION_FILESYSTEMS File "C:\ProgramData\anaconda3\envs\py310\lib\site-packages\datasets\filesystems\__init__.py", line 8, in <module> import fsspec.asyn File "C:\ProgramData\anaconda3\envs\py310\lib\site-packages\fsspec\asyn.py", line 157, in <module> ResourceEror = resource.error AttributeError: module 'resource' has no attribute 'error' Process finished with exit code 1 ``` and the error codes are: ``` try: import resource except ImportError: resource = None ResourceError = OSError else: ResourceEror = resource.error ``` 1. miss spelling : "ResourceEror " should be "ResourceErorr" 2. module 'resource' has no attribute 'error' ### Steps to reproduce the bug only one step: `from datasets import load_dataset` ### Expected behavior slove error: module 'resource' has no attribute 'error' ### Environment info python=3.10 datasets==2.14.5
closed
https://github.com/huggingface/datasets/issues/6308
2023-10-17T08:08:54
2023-10-25T17:09:22
2023-10-25T17:09:22
{ "login": "NeoWang9999", "id": 48009681, "type": "User" }
[]
false
[]
1,946,414,808
6,307
Fix typo in code example in docs
null
closed
https://github.com/huggingface/datasets/pull/6307
2023-10-17T02:28:50
2023-10-17T12:59:26
2023-10-17T06:36:19
{ "login": "bryant1410", "id": 3905501, "type": "User" }
[]
true
[]
1,946,363,452
6,306
pyinstaller : OSError: could not get source code
### Describe the bug I ran a package with pyinstaller and got the following error: ### Steps to reproduce the bug ``` ... File "datasets\__init__.py", line 52, in <module> File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 688, in _load_unlocked File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module File "datasets\inspect.py", line 30, in <module> File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 688, in _load_unlocked File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module File "datasets\load.py", line 58, in <module> File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 688, in _load_unlocked File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module File "datasets\packaged_modules\__init__.py", line 31, in <module> File "inspect.py", line 1147, in getsource File "inspect.py", line 1129, in getsourcelines File "inspect.py", line 958, in findsource OSError: could not get source code ``` ### Expected behavior I have looked up the relevant information, but I can't find a suitable reason ### Environment info ```python python 3.10 datasets 2.14.4 pyinstaller 5.6.2 ```
closed
https://github.com/huggingface/datasets/issues/6306
2023-10-17T01:41:51
2023-11-02T07:24:51
2023-10-18T14:03:42
{ "login": "dusk877647949", "id": 57702070, "type": "User" }
[]
false
[]
1,946,010,912
6,305
Cannot load dataset with `2.14.5`: `FileNotFound` error
### Describe the bug I'm trying to load [piuba-bigdata/articles_and_comments] and I'm stumbling with this error on `2.14.5`. However, this works on `2.10.0`. ### Steps to reproduce the bug [Colab link](https://colab.research.google.com/drive/1SAftFMQnFE708ikRnJJHIXZV7R5IBOCE#scrollTo=r2R2ipCCDmsg) ```python Downloading readme: 100% 1.19k/1.19k [00:00<00:00, 30.9kB/s] --------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) [<ipython-input-2-807c3583d297>](https://localhost:8080/#) in <cell line: 3>() 1 from datasets import load_dataset 2 ----> 3 load_dataset("piuba-bigdata/articles_and_comments", split="train") 2 frames [/usr/local/lib/python3.10/dist-packages/datasets/load.py](https://localhost:8080/#) 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) 2127 2128 # Create a dataset builder -> 2129 builder_instance = load_dataset_builder( 2130 path=path, 2131 name=name, [/usr/local/lib/python3.10/dist-packages/datasets/load.py](https://localhost:8080/#) in load_dataset_builder(path, name, data_dir, data_files, cache_dir, features, download_config, download_mode, revision, token, use_auth_token, storage_options, **config_kwargs) 1813 download_config = download_config.copy() if download_config else DownloadConfig() 1814 download_config.storage_options.update(storage_options) -> 1815 dataset_module = dataset_module_factory( 1816 path, 1817 revision=revision, [/usr/local/lib/python3.10/dist-packages/datasets/load.py](https://localhost:8080/#) in dataset_module_factory(path, revision, download_config, download_mode, dynamic_modules_path, data_dir, data_files, **download_kwargs) 1506 raise e1 from None 1507 if isinstance(e1, FileNotFoundError): -> 1508 raise FileNotFoundError( 1509 f"Couldn't find a dataset script at {relative_to_absolute_path(combined_path)} or any data file in the same directory. " 1510 f"Couldn't find '{path}' on the Hugging Face Hub either: {type(e1).__name__}: {e1}" FileNotFoundError: Couldn't find a dataset script at /content/piuba-bigdata/articles_and_comments/articles_and_comments.py or any data file in the same directory. Couldn't find 'piuba-bigdata/articles_and_comments' on the Hugging Face Hub either: FileNotFoundError: No (supported) data files or dataset script found in piuba-bigdata/articles_and_comments. ``` ### Expected behavior It should load normally. ### Environment info ``` - `datasets` version: 2.14.5 - Platform: Linux-5.15.120+-x86_64-with-glibc2.35 - Python version: 3.10.12 - Huggingface_hub version: 0.18.0 - PyArrow version: 9.0.0 - Pandas version: 1.5.3 ```
closed
https://github.com/huggingface/datasets/issues/6305
2023-10-16T20:11:27
2023-10-18T13:50:36
2023-10-18T13:50:36
{ "login": "finiteautomata", "id": 167943, "type": "User" }
[]
false
[]
1,945,913,521
6,304
Update README.md
Fixed typos in ReadMe and added punctuation marks Tensorflow --> TensorFlow
closed
https://github.com/huggingface/datasets/pull/6304
2023-10-16T19:10:39
2023-10-17T15:13:37
2023-10-17T15:04:52
{ "login": "smty2018", "id": 74114936, "type": "User" }
[]
true
[]
1,943,466,532
6,303
Parquet uploads off-by-one naming scheme
### Describe the bug I noticed this numbering scheme not matching up in a different project and wanted to raise it as an issue for discussion, what is the actual proper way to have these stored? <img width="425" alt="image" src="https://github.com/huggingface/datasets/assets/1981179/3ffa2144-7c9a-446f-b521-a5e9db71e7ce"> The `-SSSSS-of-NNNNN` seems to be used widely across the codebase. The section that creates the part in my screenshot is here https://github.com/huggingface/datasets/blob/main/src/datasets/arrow_dataset.py#L5287 There are also some edits to this section in the single commit branch. ### Steps to reproduce the bug 1. Upload a dataset that requires at least two parquet files in it 2. Observe the naming scheme ### Expected behavior The couple options here are of course **1. keeping it as is** **2. Starting the index at 1:** train-00001-of-00002-{hash}.parquet train-00002-of-00002-{hash}.parquet **3. My preferred option** (which would solve my specific issue), dropping the total entirely: train-00000-{hash}.parquet train-00001-{hash}.parquet This also solves an issue that will occur with an `append` variable for `push_to_hub` (see https://github.com/huggingface/datasets/issues/6290) where as you add a new parquet file, you need to rename everything in the repo as well. However, I know there are parts of the repo that use 0 as the starting file or may require the total, so raising the question for discussion. ### Environment info - `datasets` version: 2.14.6.dev0 - Platform: macOS-14.0-arm64-arm-64bit - Python version: 3.10.12 - Huggingface_hub version: 0.18.0 - PyArrow version: 12.0.1 - Pandas version: 1.5.3
open
https://github.com/huggingface/datasets/issues/6303
2023-10-14T18:31:03
2023-10-16T16:33:21
null
{ "login": "ZachNagengast", "id": 1981179, "type": "User" }
[]
false
[]
1,942,096,078
6,302
ArrowWriter/ParquetWriter `write` method does not increase `_num_bytes` and hence datasets not sharding at `max_shard_size`
### Describe the bug An example from [1], does not work when limiting shards with `max_shard_size`. Try the following example with low `max_shard_size`, such as: ```python builder.download_and_prepare(output_dir, storage_options=storage_options, file_format="parquet", max_shard_size="10MB") ``` The reason for this is that, in line [2] `writer._num_bytes > max_shard_size` is never true, because the `write` method of `ArrowWriter` [3] does not increase `self._num_bytes`. Such that respective Arrow/Parquet shards are only written to file based on the `writer_batch_size` or `config.DEFAULT_MAX_BATCH_SIZE`, but not based on `max_shard_size`. [1] https://huggingface.co/docs/datasets/filesystems#download-and-prepare-a-dataset-into-a-cloud-storage [2] https://github.com/huggingface/datasets/blob/3e8d420808718c9a1453a2e7ee3484ca12c9c70d/src/datasets/builder.py#L1677 [3] https://github.com/huggingface/datasets/blob/3e8d420808718c9a1453a2e7ee3484ca12c9c70d/src/datasets/arrow_writer.py#L459 ### Steps to reproduce the bug Get example from: https://huggingface.co/docs/datasets/filesystems#download-and-prepare-a-dataset-into-a-cloud-storage Call `builder.download_and_prepare` with low `max_shard_size` such as `10MB`, e.g.: ```python builder.download_and_prepare(output_dir, storage_options=storage_options, file_format="parquet", max_shard_size="10MB") ``` ### Expected behavior Shards should be written based on `max_shard_size` instead of batch size. ### Environment info ``` >>> import datasets >>> datasets.__version__ '2.14.6.dev0 ```
closed
https://github.com/huggingface/datasets/issues/6302
2023-10-13T14:43:36
2023-10-17T06:52:12
2023-10-17T06:52:11
{ "login": "Rassibassi", "id": 2855550, "type": "User" }
[]
false
[]
1,940,183,999
6,301
Unpin `tensorflow` maximum version
Removes the temporary pin introduced in #6264
closed
https://github.com/huggingface/datasets/pull/6301
2023-10-12T14:58:07
2023-10-12T15:58:20
2023-10-12T15:49:54
{ "login": "mariosasko", "id": 47462742, "type": "User" }
[]
true
[]
1,940,153,432
6,300
Unpin `jax` maximum version
fix #6299 fix #6202
closed
https://github.com/huggingface/datasets/pull/6300
2023-10-12T14:42:40
2023-10-12T16:37:55
2023-10-12T16:28:57
{ "login": "mariosasko", "id": 47462742, "type": "User" }
[]
true
[]
1,939,649,238
6,299
Support for newer versions of JAX
### Feature request Hi, I like your idea of adapting the datasets library to be usable with JAX. Thank you for that. However, in your [setup.py](https://github.com/huggingface/datasets/blob/main/setup.py), you enforce old versions of JAX <= 0.3... It is very cumbersome ! What is the rationale for such a limitation ? Can you remove it please ? Thanks, ### Motivation This library is unusable with new versions of JAX ? ### Your contribution Yes.
closed
https://github.com/huggingface/datasets/issues/6299
2023-10-12T10:03:46
2023-10-12T16:28:59
2023-10-12T16:28:59
{ "login": "ddrous", "id": 25456859, "type": "User" }
[ { "name": "enhancement", "color": "a2eeef" } ]
false
[]
1,938,797,389
6,298
Doc readme improvements
Changes in the doc READMe: * adds two new sections (to be aligned with `transformers` and `hfh`): "Previewing the documentation" and "Writing documentation examples" * replaces the mentions of `transformers` with `datasets` * fixes some dead links
closed
https://github.com/huggingface/datasets/pull/6298
2023-10-11T21:51:12
2023-10-12T12:47:15
2023-10-12T12:38:19
{ "login": "mariosasko", "id": 47462742, "type": "User" }
[]
true
[]
1,938,752,707
6,297
Fix ArrayXD cast
Fix #6291
closed
https://github.com/huggingface/datasets/pull/6297
2023-10-11T21:14:59
2023-10-13T13:54:00
2023-10-13T13:45:30
{ "login": "mariosasko", "id": 47462742, "type": "User" }
[]
true
[]
1,938,453,845
6,296
Move `exceptions.py` to `utils/exceptions.py`
I didn't notice the path while reviewing the PR yesterday :(
closed
https://github.com/huggingface/datasets/pull/6296
2023-10-11T18:28:00
2024-09-03T16:00:04
2024-09-03T16:00:03
{ "login": "mariosasko", "id": 47462742, "type": "User" }
[]
true
[]
1,937,362,102
6,295
Fix parquet columns argument in streaming mode
It was failing when there's a DatasetInfo with non-None info.features from the YAML (therefore containing columns that should be ignored) Fix https://github.com/huggingface/datasets/issues/6293
closed
https://github.com/huggingface/datasets/pull/6295
2023-10-11T10:01:01
2023-10-11T16:30:24
2023-10-11T16:21:36
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,937,359,605
6,294
IndexError: Invalid key is out of bounds for size 0 despite having a populated dataset
### Describe the bug I am encountering an `IndexError` when trying to access data from a DataLoader which wraps around a dataset I've loaded using the `datasets` library. The error suggests that the dataset size is `0`, but when I check the length and print the dataset, it's clear that it has `1166` entries. ### Steps to reproduce the bug 1. Load a dataset with `1166` entries. 2. Create a DataLoader using this dataset. 3. Try iterating over the DataLoader. code: ```python def get_train_dataloader(self) -> DataLoader: if self.train_dataset is None: raise ValueError("Trainer: training requires a train_dataset.") train_dataset = self.train_dataset data_collator = self.data_collator print(len(train_dataset)) print(train_dataset) if is_datasets_available() and isinstance(train_dataset, datasets.Dataset): train_dataset = self._remove_unused_columns(train_dataset, description="training") else: data_collator = self._get_collator_with_removed_columns(data_collator, description="training") train_sampler = self._get_train_sampler() dl = DataLoader( train_dataset, batch_size=self._train_batch_size, sampler=train_sampler, collate_fn=data_collator, drop_last=self.args.dataloader_drop_last, num_workers=self.args.dataloader_num_workers, pin_memory=self.args.dataloader_pin_memory, worker_init_fn=seed_worker, ) print(dl) print(len(dl)) for i in dl: print(i) break return dl ``` output : ``` 1166 Dataset({ features: ['input_ids', 'special_tokens_mask'], num_rows: 1166 }) <torch.utils.data.dataloader.DataLoader object ...> 146 ``` Error: ``` Traceback (most recent call last): File "/home/dl/zym/llamaJP/TestUseContinuePretrainLlama.py", line 266, in <module> train() File "/home/dl/zym/llamaJP/TestUseContinuePretrainLlama.py", line 260, in train trainer.train() File "/root/miniconda3/envs/LLM/lib/python3.10/site-packages/transformers/trainer.py", line 1506, in train return inner_training_loop( File "/root/miniconda3/envs/LLM/lib/python3.10/site-packages/transformers/trainer.py", line 1520, in _inner_training_loop train_dataloader = self.get_train_dataloader() File "/home/dl/zym/llamaJP/TestUseContinuePretrainLlama.py", line 80, in get_train_dataloader for i in dl: File "/root/miniconda3/envs/LLM/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 630, in __next__ data = self._next_data() File "/root/miniconda3/envs/LLM/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 674, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/root/miniconda3/envs/LLM/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch data = self.dataset.__getitems__(possibly_batched_index) File "/root/miniconda3/envs/LLM/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 2807, in __getitems__ batch = self.__getitem__(keys) File "/root/miniconda3/envs/LLM/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 2803, in __getitem__ return self._getitem(key) File "/root/miniconda3/envs/LLM/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 2787, in _getitem pa_subtable = query_table(self._data, key, indices=self._indices if self._indices is not None else None) File "/root/miniconda3/envs/LLM/lib/python3.10/site-packages/datasets/formatting/formatting.py", line 583, in query_table _check_valid_index_key(key, size) File "/root/miniconda3/envs/LLM/lib/python3.10/site-packages/datasets/formatting/formatting.py", line 536, in _check_valid_index_key _check_valid_index_key(int(max(key)), size=size) File "/root/miniconda3/envs/LLM/lib/python3.10/site-packages/datasets/formatting/formatting.py", line 526, in _check_valid_index_key raise IndexError(f"Invalid key: {key} is out of bounds for size {size}") IndexError: Invalid key: 1116 is out of bounds for size 0 ``` ### Expected behavior I expect to be able to iterate over the DataLoader without encountering an IndexError since the dataset is populated. ### Environment info - `datasets` library version: [2.14.5] - Platform: [Linux] - Python version: 3.10 - Other libraries involved: HuggingFace Transformers
closed
https://github.com/huggingface/datasets/issues/6294
2023-10-11T09:59:38
2023-10-17T11:24:06
2023-10-17T11:24:06
{ "login": "ZYM66", "id": 61892155, "type": "User" }
[]
false
[]
1,937,238,047
6,293
Choose columns to stream parquet data in streaming mode
Currently passing columns= to load_dataset in streaming mode fails ``` Tried to load parquet data with columns '['link']' with mismatching features '{'caption': Value(dtype='string', id=None), 'image': {'bytes': Value(dtype='binary', id=None), 'path': Value(dtype='null', id=None)}, 'link': Value(dtype='string', id=None), 'message_id': Value(dtype='string', id=None), 'timestamp': Value(dtype='string', id=None)}' ``` similar to https://github.com/huggingface/datasets/issues/6039 reported at https://huggingface.co/datasets/laion/dalle-3-dataset/discussions/3#65259a09617407d4520f4ad9
closed
https://github.com/huggingface/datasets/issues/6293
2023-10-11T08:59:36
2023-10-11T16:21:38
2023-10-11T16:21:38
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[ { "name": "bug", "color": "d73a4a" } ]
false
[]
1,937,050,470
6,292
how to load the image of dtype float32 or float64
_FEATURES = datasets.Features( { "image": datasets.Image(), "text": datasets.Value("string"), }, ) The datasets builder seems only support the unit8 data. How to load the float dtype data?
open
https://github.com/huggingface/datasets/issues/6292
2023-10-11T07:27:16
2023-10-11T13:19:11
null
{ "login": "wanglaofei", "id": 26437644, "type": "User" }
[]
false
[]
1,936,129,871
6,291
Casting type from Array2D int to Array2D float crashes
### Describe the bug I am on a school project and the initial type for feature annotations are `Array2D(shape=(None, 4))`. I am trying to cast this type to a `float64` and pyarrow gives me this error : ``` Traceback (most recent call last): File "/home/alan/dev/ClassezDesImagesAvecDesAlgorithmesDeDeeplearning/src/sdd/data/dataset.py", line 141, in <module> dataset = StanfordDogsDataset(size, 5).original(True).demo() File "<attrs generated init __main__.StanfordDogsDataset>", line 4, in __init__ File "/home/alan/dev/ClassezDesImagesAvecDesAlgorithmesDeDeeplearning/src/sdd/data/dataset.py", line 33, in __attrs_post_init__ self.dataset = self.dataset.cast_column( File "/home/alan/.cache/pypoetry/virtualenvs/sdd-2XWLAjSi-py3.10/lib/python3.10/site-packages/datasets/fingerprint.py", line 511, in wrapper out = func(dataset, *args, **kwargs) File "/home/alan/.cache/pypoetry/virtualenvs/sdd-2XWLAjSi-py3.10/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 2110, in cast_column return self.cast(features) File "/home/alan/.cache/pypoetry/virtualenvs/sdd-2XWLAjSi-py3.10/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 2055, in cast dataset = dataset.map( File "/home/alan/.cache/pypoetry/virtualenvs/sdd-2XWLAjSi-py3.10/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 592, in wrapper out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs) File "/home/alan/.cache/pypoetry/virtualenvs/sdd-2XWLAjSi-py3.10/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 557, in wrapper out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs) File "/home/alan/.cache/pypoetry/virtualenvs/sdd-2XWLAjSi-py3.10/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3097, in map for rank, done, content in Dataset._map_single(**dataset_kwargs): File "/home/alan/.cache/pypoetry/virtualenvs/sdd-2XWLAjSi-py3.10/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3474, in _map_single batch = apply_function_on_filtered_inputs( File "/home/alan/.cache/pypoetry/virtualenvs/sdd-2XWLAjSi-py3.10/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3353, in apply_function_on_filtered_inputs processed_inputs = function(*fn_args, *additional_args, **fn_kwargs) File "/home/alan/.cache/pypoetry/virtualenvs/sdd-2XWLAjSi-py3.10/lib/python3.10/site-packages/datasets/table.py", line 2328, in table_cast return cast_table_to_schema(table, schema) File "/home/alan/.cache/pypoetry/virtualenvs/sdd-2XWLAjSi-py3.10/lib/python3.10/site-packages/datasets/table.py", line 2287, in cast_table_to_schema arrays = [cast_array_to_feature(table[name], feature) for name, feature in features.items()] File "/home/alan/.cache/pypoetry/virtualenvs/sdd-2XWLAjSi-py3.10/lib/python3.10/site-packages/datasets/table.py", line 2287, in <listcomp> arrays = [cast_array_to_feature(table[name], feature) for name, feature in features.items()] File "/home/alan/.cache/pypoetry/virtualenvs/sdd-2XWLAjSi-py3.10/lib/python3.10/site-packages/datasets/table.py", line 1831, in wrapper return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks]) File "/home/alan/.cache/pypoetry/virtualenvs/sdd-2XWLAjSi-py3.10/lib/python3.10/site-packages/datasets/table.py", line 1831, in <listcomp> return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks]) File "/home/alan/.cache/pypoetry/virtualenvs/sdd-2XWLAjSi-py3.10/lib/python3.10/site-packages/datasets/table.py", line 2143, in cast_array_to_feature return array_cast(array, feature(), allow_number_to_str=allow_number_to_str) File "/home/alan/.cache/pypoetry/virtualenvs/sdd-2XWLAjSi-py3.10/lib/python3.10/site-packages/datasets/table.py", line 1833, in wrapper return func(array, *args, **kwargs) File "/home/alan/.cache/pypoetry/virtualenvs/sdd-2XWLAjSi-py3.10/lib/python3.10/site-packages/datasets/table.py", line 1967, in array_cast return pa_type.wrap_array(array) File "pyarrow/types.pxi", line 1369, in pyarrow.lib.BaseExtensionType.wrap_array TypeError: Incompatible storage type for extension<arrow.py_extension_type<Array2DExtensionType>>: expected list<item: list<item: double>>, got list<item: list<item: int32>> ``` ### Steps to reproduce the bug ```python dataset = datasets.load_dataset("Alanox/stanford-dogs", split="full") dataset = dataset.cast_column("annotations", Array2D((None, 4), "float64")) ``` ### Expected behavior It should simply cast the column feature type to a `float64` without error ### Environment info datasets == 2.14.5
closed
https://github.com/huggingface/datasets/issues/6291
2023-10-10T20:10:10
2023-10-13T13:45:31
2023-10-13T13:45:31
{ "login": "AlanBlanchet", "id": 22567306, "type": "User" }
[]
false
[]
1,935,629,679
6,290
Incremental dataset (e.g. `.push_to_hub(..., append=True)`)
### Feature request Have the possibility to do `ds.push_to_hub(..., append=True)`. ### Motivation Requested in this [comment](https://huggingface.co/datasets/laion/dalle-3-dataset/discussions/3#65252597c4edc168202a5eaa) and this [comment](https://huggingface.co/datasets/laion/dalle-3-dataset/discussions/4#6524f675c9607bdffb208d8f). Discussed internally on [slack](https://huggingface.slack.com/archives/C02EMARJ65P/p1696950642610639?thread_ts=1690554266.830949&cid=C02EMARJ65P). ### Your contribution What I suggest to do for parquet datasets is to use `CommitOperationCopy` + `CommitOperationDelete` from `huggingface_hub`: 1. list files 2. copy files from parquet-0001-of-0004 to parquet-0001-of-0005 3. delete files like parquet-0001-of-0004 4. generate + add last parquet file parquet-0005-of-0005 => make a single commit with all commit operations at once I think it should be quite straightforward to implement. Happy to review a PR (maybe conflicting with the ongoing "1 commit push_to_hub" PR https://github.com/huggingface/datasets/pull/6269)
open
https://github.com/huggingface/datasets/issues/6290
2023-10-10T15:18:03
2025-03-12T13:41:26
null
{ "login": "Wauplin", "id": 11801849, "type": "User" }
[ { "name": "enhancement", "color": "a2eeef" } ]
false
[]
1,935,628,506
6,289
testing doc-builder
testing https://github.com/huggingface/doc-builder/pull/426
closed
https://github.com/huggingface/datasets/pull/6289
2023-10-10T15:17:29
2023-10-13T08:57:14
2023-10-13T08:56:48
{ "login": "mishig25", "id": 11827707, "type": "User" }
[]
true
[]
1,935,005,457
6,288
Dataset.from_pandas with a DataFrame of PIL.Images
Currently type inference doesn't know what to do with a Pandas Series of PIL.Image objects, though it would be nice to get a Dataset with the Image type this way
open
https://github.com/huggingface/datasets/issues/6288
2023-10-10T10:29:16
2024-11-29T16:35:30
null
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[ { "name": "enhancement", "color": "a2eeef" } ]
false
[]
1,932,758,192
6,287
map() not recognizing "text"
### Describe the bug The [map() documentation](https://huggingface.co/docs/datasets/v2.14.5/en/package_reference/main_classes#datasets.Dataset.map) reads: ` ds = ds.map(lambda x: tokenizer(x['text'], truncation=True, padding=True), batched=True)` I have been trying to reproduce it in my code as: `tokenizedDataset = dataset.map(lambda x: tokenizer(x['text']), batched=True)` But it doesn't work as it throws the error: > KeyError: 'text' Can you please guide me on how to fix it? ### Steps to reproduce the bug 1. `from datasets import load_dataset dataset = load_dataset("amazon_reviews_multi")` 2. Then this code: `from transformers import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("bert-base-cased")` 3. The line I quoted above (which I have been trying) ### Expected behavior As mentioned in the documentation, it should run without any error and map the tokenization on the whole dataset. ### Environment info Python 3.10.2
closed
https://github.com/huggingface/datasets/issues/6287
2023-10-09T10:27:30
2023-10-11T20:28:45
2023-10-11T20:28:45
{ "login": "EngineerKhan", "id": 5688359, "type": "User" }
[]
false
[]
1,932,640,128
6,286
Create DefunctDatasetError
Create `DefunctDatasetError` as a specific error to be raised when a dataset is defunct and no longer accessible. See Hub discussion: https://huggingface.co/datasets/the_pile_books3/discussions/7#6523c13a94f3a1a2092d251b
closed
https://github.com/huggingface/datasets/pull/6286
2023-10-09T09:23:23
2023-10-10T07:13:22
2023-10-10T07:03:04
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
true
[]
1,932,306,325
6,285
TypeError: expected str, bytes or os.PathLike object, not dict
### Describe the bug my dataset is in form : train- image /n -labels and tried the code: ``` from datasets import load_dataset data_files = { "train": "/content/datasets/PotholeDetectionYOLOv8-1/train/", "validation": "/content/datasets/PotholeDetectionYOLOv8-1/valid/", "test": "/content/datasets/PotholeDetectionYOLOv8-1/test/" } dataset = load_dataset("imagefolder", data_dir=data_files) dataset ``` got error: ``` --------------------------------------------------------------------------- TypeError Traceback (most recent call last) [<ipython-input-29-2ef1926f73d9>](https://localhost:8080/#) in <cell line: 8>() 6 "test": "/content/datasets/PotholeDetectionYOLOv8-1/test/" 7 } ----> 8 dataset = load_dataset("imagefolder", data_dir=data_files) 9 dataset 6 frames [/usr/lib/python3.10/pathlib.py](https://localhost:8080/#) in _parse_args(cls, args) 576 parts += a._parts 577 else: --> 578 a = os.fspath(a) 579 if isinstance(a, str): 580 # Force-cast str subclasses to str (issue #21127) TypeError: expected str, bytes or os.PathLike object, not dict ``` ### Steps to reproduce the bug as share above ### Expected behavior load images and labels , but my dataset only uploads images - https://huggingface.co/datasets/Andyrasika/potholes-dataset ### Environment info colab pro
open
https://github.com/huggingface/datasets/issues/6285
2023-10-09T04:56:26
2023-10-10T13:17:33
null
{ "login": "andysingal", "id": 20493493, "type": "User" }
[]
false
[]
1,929,551,712
6,284
Add Belebele multiple-choice machine reading comprehension (MRC) dataset
### Feature request Belebele is a multiple-choice machine reading comprehension (MRC) dataset spanning 122 language variants. This dataset enables the evaluation of mono- and multi-lingual models in high-, medium-, and low-resource languages. Each question has four multiple-choice answers and is linked to a short passage from the [FLORES-200](https://github.com/facebookresearch/flores/tree/main/flores200) dataset. The human annotation procedure was carefully curated to create questions that discriminate between different levels of generalizable language comprehension and is reinforced by extensive quality checks. While all questions directly relate to the passage, the English dataset on its own proves difficult enough to challenge state-of-the-art language models. Being fully parallel, this dataset enables direct comparison of model performance across all languages. Belebele opens up new avenues for evaluating and analyzing the multilingual abilities of language models and NLP systems. Please refer to paper for more details, [The Belebele Benchmark: a Parallel Reading Comprehension Dataset in 122 Language Variants](https://arxiv.org/abs/2308.16884). ## Composition - 900 questions per language variant - 488 distinct passages, there are 1-2 associated questions for each. - For each question, there is 4 multiple-choice answers, exactly 1 of which is correct. - 122 language/language variants (including English). - 900 x 122 = 109,800 total questions. ### Motivation official repo https://github.com/facebookresearch/belebele ### Your contribution -
closed
https://github.com/huggingface/datasets/issues/6284
2023-10-06T06:58:03
2023-10-06T13:26:51
2023-10-06T13:26:51
{ "login": "rajveer43", "id": 64583161, "type": "User" }
[ { "name": "enhancement", "color": "a2eeef" } ]
false
[]
1,928,552,257
6,283
Fix array cast/embed with null values
Fixes issues with casting/embedding PyArrow list arrays with null values. It also bumps the required PyArrow version to 12.0.0 (over 9 months old) to simplify the implementation. Fix #6280, fix #6311, fix #6360 (Also fixes https://github.com/huggingface/datasets/issues/5430 to make Beam compatible with PyArrow>=12.0.0)
closed
https://github.com/huggingface/datasets/pull/6283
2023-10-05T15:24:05
2024-07-04T07:24:20
2024-02-06T19:24:19
{ "login": "mariosasko", "id": 47462742, "type": "User" }
[]
true
[]
1,928,473,630
6,282
Drop data_files duplicates
I just added drop_duplicates=True to `.from_patterns`. I used a dict to deduplicate and preserve the order close https://github.com/huggingface/datasets/issues/6259 close https://github.com/huggingface/datasets/issues/6272
closed
https://github.com/huggingface/datasets/pull/6282
2023-10-05T14:43:08
2024-09-02T14:08:35
2024-09-02T14:08:35
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,928,456,959
6,281
Improve documentation of dataset.from_generator
Improve documentation to clarify sharding behavior (#6270)
closed
https://github.com/huggingface/datasets/pull/6281
2023-10-05T14:34:49
2023-10-05T19:09:07
2023-10-05T18:57:41
{ "login": "hartmans", "id": 53510, "type": "User" }
[]
true
[]
1,928,215,278
6,280
Couldn't cast array of type fixed_size_list to Sequence(Value(float64))
### Describe the bug I have a dataset with an embedding column, when I try to map that dataset I get the following exception: ``` Traceback (most recent call last): File "/Users/jmif/.virtualenvs/llm-training/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3189, in map for rank, done, content in iflatmap_unordered( File "/Users/jmif/.virtualenvs/llm-training/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 1387, in iflatmap_unordered [async_result.get(timeout=0.05) for async_result in async_results] File "/Users/jmif/.virtualenvs/llm-training/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 1387, in <listcomp> [async_result.get(timeout=0.05) for async_result in async_results] File "/Users/jmif/.virtualenvs/llm-training/lib/python3.10/site-packages/multiprocess/pool.py", line 774, in get raise self._value TypeError: Couldn't cast array of type fixed_size_list<item: float>[2] to Sequence(feature=Value(dtype='float32', id=None), length=2, id=None) ``` ### Steps to reproduce the bug Here's a simple repro script: ``` from datasets import Features, Value, Sequence, ClassLabel, Dataset dataset_features = Features({ 'text': Value('string'), 'embedding': Sequence(Value('double'), length=2), 'categories': Sequence(ClassLabel(names=sorted([ 'one', 'two', 'three' ]))), }) dataset = Dataset.from_dict( { 'text': ['A'] * 10000, 'embedding': [[0.0, 0.1]] * 10000, 'categories': [[0]] * 10000, }, features=dataset_features ) def test_mapper(r): r['text'] = list(map(lambda t: t + ' b', r['text'])) return r dataset = dataset.map(test_mapper, batched=True, batch_size=10, features=dataset_features, num_proc=2) ``` Removing the embedding column fixes the issue! ### Expected behavior The mapping completes successfully. ### Environment info - `datasets` version: 2.14.4 - Platform: macOS-14.0-arm64-arm-64bit - Python version: 3.10.12 - Huggingface_hub version: 0.17.1 - PyArrow version: 13.0.0 - Pandas version: 2.0.3
closed
https://github.com/huggingface/datasets/issues/6280
2023-10-05T12:48:31
2024-02-06T19:24:20
2024-02-06T19:24:20
{ "login": "jmif", "id": 1000442, "type": "User" }
[]
false
[]
1,928,028,226
6,279
Batched IterableDataset
### Feature request Hi, could you add an implementation of a batched `IterableDataset`. It already support an option to do batch iteration via `.iter(batch_size=...)` but this cannot be used in combination with a torch `DataLoader` since it just returns an iterator. ### Motivation The current implementation loads each element of a batch individually which can be very slow in cases of a big batch_size. I did some experiments [here](https://discuss.huggingface.co/t/slow-dataloader-with-big-batch-size/57224) and using a batched iteration would speed up data loading significantly. ### Your contribution N/A
open
https://github.com/huggingface/datasets/issues/6279
2023-10-05T11:12:49
2024-11-07T10:01:22
null
{ "login": "lneukom", "id": 7010688, "type": "User" }
[ { "name": "enhancement", "color": "a2eeef" } ]
false
[]
1,927,957,877
6,278
No data files duplicates
I added a new DataFilesSet class to disallow duplicate data files. I also deprecated DataFilesList. EDIT: actually I might just add drop_duplicates=True to `.from_patterns` close https://github.com/huggingface/datasets/issues/6259 close https://github.com/huggingface/datasets/issues/6272 TODO: - [ ] tests - [ ] preserve data files order
closed
https://github.com/huggingface/datasets/pull/6278
2023-10-05T10:31:58
2024-01-11T06:32:49
2023-10-05T14:43:17
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,927,044,546
6,277
FileNotFoundError: Couldn't find a module script at /content/paws-x/paws-x.py. Module 'paws-x' doesn't exist on the Hugging Face Hub either.
### Describe the bug I'm encountering a "FileNotFoundError" while attempting to use the "paws-x" dataset to retrain the DistilRoBERTa-base model. The error message is as follows: FileNotFoundError: Couldn't find a module script at /content/paws-x/paws-x.py. Module 'paws-x' doesn't exist on the Hugging Face Hub either. ### Steps to reproduce the bug https://colab.research.google.com/drive/11xUUFxloClpmqLvDy_Xxfmo3oUzjY5nx#scrollTo=kUn74FigzhHm ### Expected behavior The the trained model ### Environment info colab, "paws-x" dataset , DistilRoBERTa-base model
closed
https://github.com/huggingface/datasets/issues/6277
2023-10-04T22:01:25
2023-10-08T17:05:46
2023-10-08T17:05:46
{ "login": "diegogonzalezc", "id": 66733346, "type": "User" }
[]
false
[]
1,925,961,878
6,276
I'm trying to fine tune the openai/whisper model from huggingface using jupyter notebook and i keep getting this error
### Describe the bug I'm trying to fine tune the openai/whisper model from huggingface using jupyter notebook and i keep getting this error, i'm following the steps in this blog post https://huggingface.co/blog/fine-tune-whisper I tried google collab and it works but because I'm on the free version the training doesn't complete the error comes in jupyter notebook when i run this line `common_voice = common_voice.map(prepare_dataset, remove_columns=common_voice.column_names["train"], num_proc=4)` here is the error message ``` Map (num_proc=4): 0% 0/2506 [00:52<?, ? examples/s] The above exception was the direct cause of the following exception: NameError Traceback (most recent call last) Cell In[19], line 1 ----> 1 common_voice = common_voice.map(prepare_dataset, remove_columns=common_voice.column_names["train"], num_proc=4) File ~\anaconda\Lib\site-packages\datasets\dataset_dict.py:853, in DatasetDict.map(self, function, with_indices, with_rank, input_columns, batched, batch_size, drop_last_batch, remove_columns, keep_in_memory, load_from_cache_file, cache_file_names, writer_batch_size, features, disable_nullable, fn_kwargs, num_proc, desc) 850 if cache_file_names is None: 851 cache_file_names = {k: None for k in self} 852 return DatasetDict( --> 853 { 854 k: dataset.map( 855 function=function, 856 with_indices=with_indices, 857 with_rank=with_rank, 858 input_columns=input_columns, 859 batched=batched, 860 batch_size=batch_size, 861 drop_last_batch=drop_last_batch, 862 remove_columns=remove_columns, 863 keep_in_memory=keep_in_memory, 864 load_from_cache_file=load_from_cache_file, 865 cache_file_name=cache_file_names[k], 866 writer_batch_size=writer_batch_size, 867 features=features, 868 disable_nullable=disable_nullable, 869 fn_kwargs=fn_kwargs, 870 num_proc=num_proc, 871 desc=desc, 872 ) 873 for k, dataset in self.items() 874 } 875 ) File ~\anaconda\Lib\site-packages\datasets\dataset_dict.py:854, in <dictcomp>(.0) 850 if cache_file_names is None: 851 cache_file_names = {k: None for k in self} 852 return DatasetDict( 853 { --> 854 k: dataset.map( 855 function=function, 856 with_indices=with_indices, 857 with_rank=with_rank, 858 input_columns=input_columns, 859 batched=batched, 860 batch_size=batch_size, 861 drop_last_batch=drop_last_batch, 862 remove_columns=remove_columns, 863 keep_in_memory=keep_in_memory, 864 load_from_cache_file=load_from_cache_file, 865 cache_file_name=cache_file_names[k], 866 writer_batch_size=writer_batch_size, 867 features=features, 868 disable_nullable=disable_nullable, 869 fn_kwargs=fn_kwargs, 870 num_proc=num_proc, 871 desc=desc, 872 ) 873 for k, dataset in self.items() 874 } 875 ) File ~\anaconda\Lib\site-packages\datasets\arrow_dataset.py:592, in transmit_tasks.<locals>.wrapper(*args, **kwargs) 590 self: "Dataset" = kwargs.pop("self") 591 # apply actual function --> 592 out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs) 593 datasets: List["Dataset"] = list(out.values()) if isinstance(out, dict) else [out] 594 for dataset in datasets: 595 # Remove task templates if a column mapping of the template is no longer valid File ~\anaconda\Lib\site-packages\datasets\arrow_dataset.py:557, in transmit_format.<locals>.wrapper(*args, **kwargs) 550 self_format = { 551 "type": self._format_type, 552 "format_kwargs": self._format_kwargs, 553 "columns": self._format_columns, 554 "output_all_columns": self._output_all_columns, 555 } 556 # apply actual function --> 557 out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs) 558 datasets: List["Dataset"] = list(out.values()) if isinstance(out, dict) else [out] 559 # re-apply format to the output File ~\anaconda\Lib\site-packages\datasets\arrow_dataset.py:3189, in Dataset.map(self, function, with_indices, with_rank, input_columns, batched, batch_size, drop_last_batch, remove_columns, keep_in_memory, load_from_cache_file, cache_file_name, writer_batch_size, features, disable_nullable, fn_kwargs, num_proc, suffix_template, new_fingerprint, desc) 3182 logger.info(f"Spawning {num_proc} processes") 3183 with logging.tqdm( 3184 disable=not logging.is_progress_bar_enabled(), 3185 unit=" examples", 3186 total=pbar_total, 3187 desc=(desc or "Map") + f" (num_proc={num_proc})", 3188 ) as pbar: -> 3189 for rank, done, content in iflatmap_unordered( 3190 pool, Dataset._map_single, kwargs_iterable=kwargs_per_job 3191 ): 3192 if done: 3193 shards_done += 1 File ~\anaconda\Lib\site-packages\datasets\utils\py_utils.py:1394, in iflatmap_unordered(pool, func, kwargs_iterable) 1391 finally: 1392 if not pool_changed: 1393 # we get the result in case there's an error to raise -> 1394 [async_result.get(timeout=0.05) for async_result in async_results] File ~\anaconda\Lib\site-packages\datasets\utils\py_utils.py:1394, in <listcomp>(.0) 1391 finally: 1392 if not pool_changed: 1393 # we get the result in case there's an error to raise -> 1394 [async_result.get(timeout=0.05) for async_result in async_results] File ~\anaconda\Lib\site-packages\multiprocess\pool.py:774, in ApplyResult.get(self, timeout) 772 return self._value 773 else: --> 774 raise self._value NameError: name 'feature_extractor' is not defined ``` ### Steps to reproduce the bug 1. follow the steps in this blog post https://huggingface.co/blog/fine-tune-whisper 2. run this line of code `common_voice = common_voice.map(prepare_dataset, remove_columns=common_voice.column_names["train"], num_proc=4)` 3. I'm using jupyter notebook from anaconda ### Expected behavior No error message ### Environment info datasets version: 2.8.0 Python version: 3.11 Windows 10
open
https://github.com/huggingface/datasets/issues/6276
2023-10-04T11:03:41
2023-11-27T10:39:16
null
{ "login": "valaofficial", "id": 50768065, "type": "User" }
[]
false
[]
1,921,354,680
6,275
Would like to Contribute a dataset
I have a dataset of 2500 images that can be used for color-blind machine-learning algorithms. Since , there was no dataset available online , I made this dataset myself and would like to contribute this now to community
closed
https://github.com/huggingface/datasets/issues/6275
2023-10-02T07:00:21
2023-10-10T16:27:54
2023-10-10T16:27:54
{ "login": "vikas70607", "id": 97907750, "type": "User" }
[]
false
[]
1,921,036,328
6,274
FileNotFoundError for dataset with multiple builder config
### Describe the bug When there is only one config and only the dataset name is entered when using datasets.load_dataset(), it works fine. But if I create a second builder_config for my dataset and enter the config name when using datasets.load_dataset(), the following error will happen. FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/chenx/.cache/huggingface/datasets/my_dataset/0_shot_multiple_choice/1.0.0/97c3854a012cfd6b045e3be4c864739902af2d818bb9235b047baa94c302e9a2.incomplete/my_dataset-test-00000-00000-of-NNNNN.arrow' The "XXX.incomplete folder" in the cache folder of my dataset will disappear before "generating test split", which does not happen when config name is not entered and the config name is "default" C:\Users\chenx\.cache\huggingface\datasets\my_dataset\0_shot_multiple_choice\1.0.0 The folder that is supposed to remain under the above directory will disappear, and the data generator will not have a place to generate data into. ### Steps to reproduce the bug test = load_dataset('my_dataset', '0_shot_multiple_choice') ### Expected behavior FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/chenx/.cache/huggingface/datasets/my_dataset/0_shot_multiple_choice/1.0.0/97c3854a012cfd6b045e3be4c864739902af2d818bb9235b047baa94c302e9a2.incomplete/my_dataset-test-00000-00000-of-NNNNN.arrow' ### Environment info datasets 2.14.5 python 3.8.18
closed
https://github.com/huggingface/datasets/issues/6274
2023-10-01T23:45:56
2024-08-14T04:42:02
2023-10-02T20:09:38
{ "login": "LouisChen15", "id": 97120485, "type": "User" }
[]
false
[]
1,920,922,260
6,273
Broken Link to PubMed Abstracts dataset .
### Describe the bug The link provided for the dataset is broken, data_files = [https://the-eye.eu/public/AI/pile_preliminary_components/PUBMED_title_abstracts_2019_baseline.jsonl.zst](url) The ### Steps to reproduce the bug Steps to reproduce: 1) Head over to [https://huggingface.co/learn/nlp-course/chapter5/4?fw=pt#big-data-datasets-to-the-rescue](url) 2) In the Section "What is the Pile?", you can see a code snippet that contains the broken link. ### Expected behavior The link should Redirect to the "PubMed Abstracts dataset" as expected . ### Environment info .
open
https://github.com/huggingface/datasets/issues/6273
2023-10-01T19:08:48
2024-04-28T02:30:42
null
{ "login": "sameemqureshi", "id": 100606327, "type": "User" }
[]
false
[]
1,920,831,487
6,272
Duplicate `data_files` when named `<split>/<split>.parquet`
e.g. with `u23429/stock_1_minute_ticker` ```ipython In [1]: from datasets import * In [2]: b = load_dataset_builder("u23429/stock_1_minute_ticker") Downloading readme: 100%|██████████████████████████| 627/627 [00:00<00:00, 246kB/s] In [3]: b.config.data_files Out[3]: {NamedSplit('train'): ['hf://datasets/u23429/stock_1_minute_ticker@65c973cf4ec061f01a363b40da4c1bb128ba4166/train/train.parquet', 'hf://datasets/u23429/stock_1_minute_ticker@65c973cf4ec061f01a363b40da4c1bb128ba4166/train/train.parquet'], NamedSplit('validation'): ['hf://datasets/u23429/stock_1_minute_ticker@65c973cf4ec061f01a363b40da4c1bb128ba4166/validation/validation.parquet', 'hf://datasets/u23429/stock_1_minute_ticker@65c973cf4ec061f01a363b40da4c1bb128ba4166/validation/validation.parquet'], NamedSplit('test'): ['hf://datasets/u23429/stock_1_minute_ticker@65c973cf4ec061f01a363b40da4c1bb128ba4166/test/test.parquet', 'hf://datasets/u23429/stock_1_minute_ticker@65c973cf4ec061f01a363b40da4c1bb128ba4166/test/test.parquet']} ``` This bug issue is present in the current `datasets` 2.14.5 and also on `main` even after https://github.com/huggingface/datasets/pull/6244 cc @mariosasko
closed
https://github.com/huggingface/datasets/issues/6272
2023-10-01T15:43:56
2024-03-15T15:22:05
2024-03-15T15:22:05
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[ { "name": "bug", "color": "d73a4a" } ]
false
[]
1,920,420,295
6,271
Overwriting Split overwrites data but not metadata, corrupting dataset
### Describe the bug I want to be able to overwrite/update/delete splits in my dataset. Currently the only way to do is to manually go into the dataset and delete the split. If I try to overwrite programmatically I end up in an error state and (somewhat) corrupting the dataset. Read below. **Current Behavior** When I push to an existing split I get this error: `ValueError: Split complexRoofLocation_01Apr2023_to_31May2023test already present` This seems to suggest that the library doesn't support overwriting splits. **Potential Bug** What’s strange is that datasets, despite the operation erroring out with the ValueError above, does, in fact, overwrite the split: `Pushing dataset shards to the dataset hub: 100% [.....................] 1/1 [00:00<00:00, 55.04it/s]` Even though you got an error message and your code fails, your dataset is now changed. That seems like a bug. Either don't change the dataset, or don't throw the error and allow the script to proceed. Additional Bug While it overwrites the split, it doesn’t overwrite the split’s information. Because of this when you pull down the dataset you may end up getting a `NonMatchingSplitsSizesError` if the size of the dataset during the overwrite is different. For example, my original split had 5 rows, but on my overwrite, I only had 4. Then when I try to download the dataset, I get a `NonMatchingSplitsSizesError` because the dataset's data.json states there’s 5 but only 4 exist in the split. Expected Behavior This corrupts the dataset rendering it unusable (until you take manual intervention). Either the library should let the overwrite happen (which it does but should also update the metadata) or it shouldn’t do anything. ### Steps to reproduce the bug [Colab Notebook](https://colab.research.google.com/drive/1bqVkD06Ngs9MQNdSk_ygCG6y1UqXA4pC?usp=sharing) ### Expected behavior The split should be overwritten and I should be able to use the new version of the dataset without issue. ### Environment info - `datasets` version: 2.14.5 - Platform: Linux-5.15.120+-x86_64-with-glibc2.35 - Python version: 3.10.12 - Huggingface_hub version: 0.17.3 - PyArrow version: 9.0.0 - Pandas version: 1.5.3
closed
https://github.com/huggingface/datasets/issues/6271
2023-09-30T22:37:31
2023-10-16T13:30:50
2023-10-16T13:30:50
{ "login": "govindrai", "id": 13859249, "type": "User" }
[]
false
[]
1,920,329,373
6,270
Dataset.from_generator raises with sharded gen_args
### Describe the bug According to the docs of Datasets.from_generator: ``` gen_kwargs(`dict`, *optional*): Keyword arguments to be passed to the `generator` callable. You can define a sharded dataset by passing the list of shards in `gen_kwargs`. ``` So I'd expect that if gen_kwargs was a list, then my generator would be called once for each element in the list with the dict in the list for that element. It doesn't work that way though. ### Steps to reproduce the bug ```python #!/usr/bin/python from pathlib import Path import datasets def process_yaml(file): yield dict(example=42) if __name__ == '__main__': import sys dir = Path(sys.argv[0]).parent ds = datasets.Dataset.from_generator(process_yaml, gen_kwargs=[{'file':f} for f in dir.glob('*.yml')], ) ds.to_json('training.jsonl') ``` ``` Generating train split: 0 examples [00:00, ? examples/s] Traceback (most recent call last): File "/tmp/dataset_bug.py", line 13, in <module> ds = datasets.Dataset.from_generator(process_yaml, gen_kwargs=[{'file':f} for f in dir.glob('*.yml')], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/hartmans/ai/venv/lib/python3.11/site-packages/datasets/arrow_dataset.py", line 1072, in from_generator ).read() ^^^^^^ File "/home/hartmans/ai/venv/lib/python3.11/site-packages/datasets/io/generator.py", line 47, in read self.builder.download_and_prepare( File "/home/hartmans/ai/venv/lib/python3.11/site-packages/datasets/builder.py", line 954, in download_and_prepare self._download_and_prepare( File "/home/hartmans/ai/venv/lib/python3.11/site-packages/datasets/builder.py", line 1717, in _download_and_prepare super()._download_and_prepare( File "/home/hartmans/ai/venv/lib/python3.11/site-packages/datasets/builder.py", line 1049, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/hartmans/ai/venv/lib/python3.11/site-packages/datasets/builder.py", line 1555, in _prepare_split for job_id, done, content in self._prepare_split_single( File "/home/hartmans/ai/venv/lib/python3.11/site-packages/datasets/builder.py", line 1656, in _prepare_split_single generator = self._generate_examples(**gen_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: datasets.packaged_modules.generator.generator.Generator._generate_examples() argument after ** must be a ``` mapping, not list ### Expected behavior I would expect that process_yaml would be called once for each yaml file in the directory where the script is run. I also tried with the list being in gen_kwargs, but in that case process_yaml gets called with a list. ### Environment info - `datasets` version: 2.14.6.dev0 (git commit 0cc77d7f45c7369; also tested with 2.14.0) - Platform: Linux-6.1.0-10-amd64-x86_64-with-glibc2.36 - Python version: 3.11.2 - Huggingface_hub version: 0.16.4 - PyArrow version: 12.0.1 - Pandas version: 2.0.3
closed
https://github.com/huggingface/datasets/issues/6270
2023-09-30T16:50:06
2023-10-11T20:29:12
2023-10-11T20:29:11
{ "login": "hartmans", "id": 53510, "type": "User" }
[]
false
[]
1,919,572,790
6,269
Reduce the number of commits in `push_to_hub`
Reduces the number of commits in `push_to_hub` by using the `preupload` API from https://github.com/huggingface/huggingface_hub/pull/1699. Each commit contains a maximum of 50 uploaded files. A shard's fingerprint no longer needs to be added as a suffix to support resuming an upload, meaning the shards' naming scheme is the same as the initial one. Also, it adds support for the following params: `create_pr`, `commit_message` and `revision` (`branch` deprecated; unlike the previous implementation, this one creates a branch if the branch does not exist to be consistent with `transformers`). (Nit) This implementation keeps the markdown section of the generated README.md empty to enable importing the card template (when the card is accessed on the Hub). Fixes https://github.com/huggingface/datasets/issues/5492, fixes https://github.com/huggingface/datasets/issues/6257, fixes https://github.com/huggingface/datasets/issues/5045, fixes https://github.com/huggingface/datasets/issues/6271 TODO: - [x] set the minimal version to the next `hfh` release (once it's published)
closed
https://github.com/huggingface/datasets/pull/6269
2023-09-29T16:22:31
2023-10-16T16:03:18
2023-10-16T13:30:46
{ "login": "mariosasko", "id": 47462742, "type": "User" }
[]
true
[]
1,919,010,645
6,268
Add repo_id to DatasetInfo
```python from datasets import load_dataset ds = load_dataset("lhoestq/demo1", split="train") ds = ds.map(lambda x: {}, num_proc=2).filter(lambda x: True).remove_columns(["id"]) print(ds.repo_id) # lhoestq/demo1 ``` - repo_id is None when the dataset doesn't come from the Hub, e.g. from Dataset.from_dict - repo_id is set to None when concatenating datasets with different repo ids related to https://github.com/huggingface/datasets/issues/4129 TODO: - [ ] discuss if it's ok for now - [ ] tests
open
https://github.com/huggingface/datasets/pull/6268
2023-09-29T10:24:55
2023-10-01T15:29:45
null
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,916,443,262
6,267
Multi label class encoding
### Feature request I have a multi label dataset and I'd like to be able to class encode the column and store the mapping directly in the features just as I can with a single label column. `class_encode_column` currently does not support multi labels. Here's an example of what I'd like to encode: ``` data = { 'text': ['one', 'two', 'three', 'four'], 'labels': [['a', 'b'], ['b'], ['b', 'c'], ['a', 'd']] } dataset = Dataset.from_dict(data) dataset = dataset.class_encode_column('labels') ``` I did some digging into the code base to evaluate the feasibility of this (note I'm very new to this code base) and from what I noticed the `ClassLabel` feature is still stored as an underlying raw data type of int so I thought a `MultiLabel` feature could similarly be stored as a Sequence of ints, thus not requiring significant serialization / conversion work to / from arrow. I did a POC of this [here](https://github.com/huggingface/datasets/commit/15443098e9ce053943172f7ec6fce3769d7dff6e) and included a simple test case (please excuse all the commented out tests, going for speed of POC here and didn't want to fight IDE to debug a single test). In the test I just assert that `num_classes` is the same to show that things are properly serializing, but if you break after loading from disk you'll see the dataset correct and the dataset feature is as expected. After digging more I did notice a few issues - After loading from disk I noticed type of the `labels` class is `Sequence` not `MultiLabel` (though the added `feature` attribute came through). This doesn't happen for `ClassLabel` but I couldn't find the encode / decode code paths that handle this. - I subclass `Sequence` in `MultiLabel` to leverage existing serialization, but this does miss the custom encode logic that `ClassLabel` has. I'm not sure of the best way to approach this as I haven't fully understood the encode / decode flow for datasets. I suspect my simple implementation will need some improvement as it'll require a significant amount of repeated logic to mimic `ClassLabel` behavior. ### Motivation See above - would like to support multi label class encodings. ### Your contribution This would be a big help for us and we're open to contributing but I'll likely need some guidance on how to implement to fit the encode / decode flow. Some suggestions on tests / would be great too, I'm guessing in addition to the class encode tests (that I'll need to expand) we'll need encode / decode tests.
open
https://github.com/huggingface/datasets/issues/6267
2023-09-27T22:48:08
2023-10-26T18:46:08
null
{ "login": "jmif", "id": 1000442, "type": "User" }
[ { "name": "enhancement", "color": "a2eeef" } ]
false
[]
1,916,334,394
6,266
Use LibYAML with PyYAML if available
PyYAML, the YAML framework used in this library, allows the use of LibYAML to accelerate the methods `load` and `dump`. To use it, a user would need to first install a PyYAML version that uses LibYAML (not available in PyPI; needs to be manually installed). Then, to actually use them, PyYAML suggests importing the LibYAML version of the `Loader` and `Dumper` and falling back to the default ones. This PR implements this change. See [PyYAML docs](https://pyyaml.org/wiki/PyYAMLDocumentation) for more info. This change was motivated after trying to use any of [the SugarCREPE datasets in the Hub](https://huggingface.co/datasets?search=sugarcrepe) provided by [the org HuggingFaceM4](https://huggingface.co/datasets/HuggingFaceM4). Such datasets save a lot of information (~1MB) in the YAML metadata from the `README.md` file and I noticed this slowed down the data loading process. BTW, I also noticed cache files for it is also slow because it tries to hash an instance of `DatasetInfo`, which in turn has all this metadata. Also, I changed two list comprehensions into generator expressions to avoid allocating extra memory unnecessarily. And BTW, there's [an issue in PyYAML suggesting to make this automatic](https://github.com/yaml/pyyaml/issues/437).
open
https://github.com/huggingface/datasets/pull/6266
2023-09-27T21:13:36
2023-09-28T14:29:24
null
{ "login": "bryant1410", "id": 3905501, "type": "User" }
[]
true
[]
1,915,651,566
6,265
Remove `apache_beam` import in `BeamBasedBuilder._save_info`
... to avoid an `ImportError` raised in `BeamBasedBuilder._save_info` when `apache_beam` is not installed (e.g., when downloading the processed version of a dataset from the HF GCS) Fix https://github.com/huggingface/datasets/issues/6260
closed
https://github.com/huggingface/datasets/pull/6265
2023-09-27T13:56:34
2023-09-28T18:34:02
2023-09-28T18:23:35
{ "login": "mariosasko", "id": 47462742, "type": "User" }
[]
true
[]
1,914,958,781
6,264
Temporarily pin tensorflow < 2.14.0
Temporarily pin tensorflow < 2.14.0 until permanent solution is found. Hot fix #6263.
closed
https://github.com/huggingface/datasets/pull/6264
2023-09-27T08:16:06
2023-09-27T08:45:24
2023-09-27T08:36:39
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
true
[]
1,914,951,043
6,263
CI is broken: ImportError: cannot import name 'context' from 'tensorflow.python'
Python 3.10 CI is broken for `test_py310`. See: https://github.com/huggingface/datasets/actions/runs/6322990957/job/17169678812?pr=6262 ``` FAILED tests/test_py_utils.py::TempSeedTest::test_tensorflow - ImportError: cannot import name 'context' from 'tensorflow.python' (/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/tensorflow/python/__init__.py) ``` ``` _________________________ TempSeedTest.test_tensorflow _________________________ [gw1] linux -- Python 3.10.13 /opt/hostedtoolcache/Python/3.10.13/x64/bin/python self = <tests.test_py_utils.TempSeedTest testMethod=test_tensorflow> @require_tf def test_tensorflow(self): import tensorflow as tf from tensorflow.keras import layers model = layers.Dense(2) def gen_random_output(): x = tf.random.uniform((1, 3)) return model(x).numpy() > with temp_seed(42, set_tensorflow=True): tests/test_py_utils.py:155: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/contextlib.py:135: in __enter__ return next(self.gen) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ seed = 42, set_pytorch = False, set_tensorflow = True @contextmanager def temp_seed(seed: int, set_pytorch=False, set_tensorflow=False): """Temporarily set the random seed. This works for python numpy, pytorch and tensorflow.""" np_state = np.random.get_state() np.random.seed(seed) if set_pytorch and config.TORCH_AVAILABLE: import torch torch_state = torch.random.get_rng_state() torch.random.manual_seed(seed) if torch.cuda.is_available(): torch_cuda_states = torch.cuda.get_rng_state_all() torch.cuda.manual_seed_all(seed) if set_tensorflow and config.TF_AVAILABLE: import tensorflow as tf > from tensorflow.python import context as tfpycontext E ImportError: cannot import name 'context' from 'tensorflow.python' (/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/tensorflow/python/__init__.py) /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/datasets/utils/py_utils.py:257: ImportError ```
closed
https://github.com/huggingface/datasets/issues/6263
2023-09-27T08:12:05
2023-09-27T08:36:40
2023-09-27T08:36:40
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[ { "name": "bug", "color": "d73a4a" } ]
false
[]
1,914,895,459
6,262
Fix CI 404 errors
Currently our CI usually raises 404 errors when trying to delete temporary repositories. See, e.g.: https://github.com/huggingface/datasets/actions/runs/6314980985/job/17146507884 ``` FAILED tests/test_upstream_hub.py::TestPushToHub::test_push_dataset_dict_to_hub_multiple_files_with_max_shard_size - huggingface_hub.utils._errors.RepositoryNotFoundError: 404 Client Error. (Request ID: Root=1-6512fb99-4a52c561752ece3d77eb6d57;2b61cae4-613d-4a73-bbb1-2faf9e32b02d) Repository Not Found for url: https://hub-ci.huggingface.co/api/repos/delete. Please make sure you specified the correct `repo_id` and `repo_type`. If you are trying to access a private or gated repo, make sure you are authenticated. FAILED tests/test_upstream_hub.py::TestPushToHub::test_push_dataset_to_hub_custom_features_audio - huggingface_hub.utils._errors.RepositoryNotFoundError: 404 Client Error. (Request ID: Root=1-6512fbb2-0333dd666d42f0e173c2bb68;dfdc4271-b49b-4008-8c49-f05cf7c1d53d) Repository Not Found for url: https://hub-ci.huggingface.co/api/repos/delete. Please make sure you specified the correct `repo_id` and `repo_type`. If you are trying to access a private or gated repo, make sure you are authenticated. FAILED tests/test_upstream_hub.py::TestPushToHub::test_push_dataset_dict_to_hub_custom_splits - huggingface_hub.utils._errors.RepositoryNotFoundError: 404 Client Error. (Request ID: Root=1-6512fbca-167690694f39770a5b3a444e;baeaa905-0a57-4585-ac97-9aaae12dd47d) Repository Not Found for url: https://hub-ci.huggingface.co/api/repos/delete. Please make sure you specified the correct `repo_id` and `repo_type`. If you are trying to access a private or gated repo, make sure you are authenticated. ``` I think this can be caused by collisions in temporary repository IDs because we create them in multiprocessing: ```python with temporary_repo(f"{CI_HUB_USER}/test-{int(time.time() * 10e3)}") as ds_name: ``` This can also be caused when there is another issue that does not allow the creation of the repository, thus making it impossible to delete it. This PR tries to fix this issue by increasing the precision of the number on the repository ID: `10e6` instead of `10e3`. Additionally, this PR catches RepositoryNotFoundError.
closed
https://github.com/huggingface/datasets/pull/6262
2023-09-27T07:40:18
2023-09-28T15:39:16
2023-09-28T15:30:40
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
true
[]
1,913,813,178
6,261
Can't load a dataset
### Describe the bug Can't seem to load the JourneyDB dataset. It throws the following error: ``` --------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) Cell In[15], line 2 1 # If the dataset is gated/private, make sure you have run huggingface-cli login ----> 2 dataset = load_dataset("JourneyDB/JourneyDB", data_files="data", use_auth_token=True) File /opt/conda/lib/python3.10/site-packages/datasets/load.py:1664, in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, keep_in_memory, save_infos, revision, use_auth_token, task, streaming, **config_kwargs) 1661 ignore_verifications = ignore_verifications or save_infos 1663 # Create a dataset builder -> 1664 builder_instance = load_dataset_builder( 1665 path=path, 1666 name=name, 1667 data_dir=data_dir, 1668 data_files=data_files, 1669 cache_dir=cache_dir, 1670 features=features, 1671 download_config=download_config, 1672 download_mode=download_mode, 1673 revision=revision, 1674 use_auth_token=use_auth_token, 1675 **config_kwargs, 1676 ) 1678 # Return iterable dataset in case of streaming 1679 if streaming: File /opt/conda/lib/python3.10/site-packages/datasets/load.py:1490, in load_dataset_builder(path, name, data_dir, data_files, cache_dir, features, download_config, download_mode, revision, use_auth_token, **config_kwargs) 1488 download_config = download_config.copy() if download_config else DownloadConfig() 1489 download_config.use_auth_token = use_auth_token -> 1490 dataset_module = dataset_module_factory( 1491 path, 1492 revision=revision, 1493 download_config=download_config, 1494 download_mode=download_mode, 1495 data_dir=data_dir, 1496 data_files=data_files, 1497 ) 1499 # Get dataset builder class from the processing script 1500 builder_cls = import_main_class(dataset_module.module_path) File /opt/conda/lib/python3.10/site-packages/datasets/load.py:1238, in dataset_module_factory(path, revision, download_config, download_mode, force_local_path, dynamic_modules_path, data_dir, data_files, **download_kwargs) 1236 raise ConnectionError(f"Couln't reach the Hugging Face Hub for dataset '{path}': {e1}") from None 1237 if isinstance(e1, FileNotFoundError): -> 1238 raise FileNotFoundError( 1239 f"Couldn't find a dataset script at {relative_to_absolute_path(combined_path)} or any data file in the same directory. " 1240 f"Couldn't find '{path}' on the Hugging Face Hub either: {type(e1).__name__}: {e1}" 1241 ) from None 1242 raise e1 from None 1243 else: FileNotFoundError: Couldn't find a dataset script at /kaggle/working/JourneyDB/JourneyDB/JourneyDB.py or any data file in the same directory. Couldn't find 'JourneyDB/JourneyDB' on the Hugging Face Hub either: FileNotFoundError: Unable to find data in dataset repository JourneyDB/JourneyDB with any supported extension ['csv', 'tsv', 'json', 'jsonl', 'parquet', 'txt', 'blp', 'bmp', 'dib', 'bufr', 'cur', 'pcx', 'dcx', 'dds', 'ps', 'eps', 'fit', 'fits', 'fli', 'flc', 'ftc', 'ftu', 'gbr', 'gif', 'grib', 'h5', 'hdf', 'png', 'apng', 'jp2', 'j2k', 'jpc', 'jpf', 'jpx', 'j2c', 'icns', 'ico', 'im', 'iim', 'tif', 'tiff', 'jfif', 'jpe', 'jpg', 'jpeg', 'mpg', 'mpeg', 'msp', 'pcd', 'pxr', 'pbm', 'pgm', 'ppm', 'pnm', 'psd', 'bw', 'rgb', 'rgba', 'sgi', 'ras', 'tga', 'icb', 'vda', 'vst', 'webp', 'wmf', 'emf', 'xbm', 'xpm', 'zip'] ``` ### Steps to reproduce the bug 1) ``` from huggingface_hub import notebook_login notebook_login() ``` 2) ``` !pip install -q datasets from datasets import load_dataset ``` 3) `dataset = load_dataset("JourneyDB/JourneyDB", data_files="data", use_auth_token=True)` ### Expected behavior Load the dataset ### Environment info Notebook
closed
https://github.com/huggingface/datasets/issues/6261
2023-09-26T15:46:25
2023-10-05T10:23:23
2023-10-05T10:23:22
{ "login": "joaopedrosdmm", "id": 37955817, "type": "User" }
[]
false
[]
1,912,593,466
6,260
REUSE_DATASET_IF_EXISTS don't work
### Describe the bug I use the following code to download natural_question dataset. Even though I have completely download it, the next time I run this code, the new download procedure will start and cover the original /data/lxy/NQ config=datasets.DownloadConfig(resume_download=True,max_retries=100,cache_dir=r'/data/lxy/NQ',download_desc='NQ') data=datasets.load_dataset('natural_questions',cache_dir=r'/data/lxy/NQ',download_config=config,download_mode=DownloadMode.REUSE_DATASET_IF_EXISTS) --- Since I don't have apache_beam installed, it throw a exception. After I pip install apache_beam ,the download restart.. ![image](https://github.com/huggingface/datasets/assets/88258534/f28ce7fe-29ea-4348-b87f-e69182a8bd41) ### Steps to reproduce the bug run this two line code config=datasets.DownloadConfig(resume_download=True,max_retries=100,cache_dir=r'/data/lxy/NQ',download_desc='NQ') data=datasets.load_dataset('natural_questions',cache_dir=r'/data/lxy/NQ',download_config=config,download_mode=DownloadMode.REUSE_DATASET_IF_EXISTS) ### Expected behavior Download behavior can be correctly follow DownloadMode ### Environment info - `datasets` version: 2.14.4 - Platform: Linux-3.10.0-1160.88.1.el7.x86_64-x86_64-with-glibc2.17 - Python version: 3.9.17 - Huggingface_hub version: 0.16.4 - PyArrow version: 11.0.0 - Pandas version: 2.0.3
closed
https://github.com/huggingface/datasets/issues/6260
2023-09-26T03:02:16
2023-09-28T18:23:36
2023-09-28T18:23:36
{ "login": "rangehow", "id": 88258534, "type": "User" }
[]
false
[]
1,911,965,758
6,259
Duplicated Rows When Loading Parquet Files from Root Directory with Subdirectories
### Describe the bug When parquet files are saved in "train" and "val" subdirectories under a root directory, and datasets are then loaded using `load_dataset("parquet", data_dir="root_directory")`, the resulting dataset has duplicated rows for both the training and validation sets. ### Steps to reproduce the bug 1. Create a root directory, e.g., "testing123". 2. Under "testing123", create two subdirectories: "train" and "val". 3. Create and save a parquet file with 3 unique rows in the "train" subdirectory. 4. Create and save a parquet file with 4 unique rows in the "val" subdirectory. 5. Load the datasets from the root directory using `load_dataset("parquet", data_dir="testing123")` 6. Iterate through the datasets and print the rows Here's a collab reproducing these steps: https://colab.research.google.com/drive/11NEdImnQ3OqJlwKSHRMhr7jCBesNdLY4?usp=sharing ### Expected behavior - Training set should contain 3 unique rows. - Validation set should contain 4 unique rows. ### Environment info - `datasets` version: 2.14.5 - Platform: Linux-5.15.120+-x86_64-with-glibc2.35 - Python version: 3.10.12 - Huggingface_hub version: 0.17.2 - PyArrow version: 9.0.0 - Pandas version: 1.5.3
closed
https://github.com/huggingface/datasets/issues/6259
2023-09-25T17:20:54
2024-03-15T15:22:04
2024-03-15T15:22:04
{ "login": "MF-FOOM", "id": 141304309, "type": "User" }
[]
false
[]
1,911,445,373
6,258
[DOCS] Fix typo: Elasticsearch
Not ElasticSearch :)
closed
https://github.com/huggingface/datasets/pull/6258
2023-09-25T12:50:59
2023-09-26T14:55:35
2023-09-26T13:36:40
{ "login": "leemthompo", "id": 32779855, "type": "User" }
[]
true
[]
1,910,741,044
6,257
HfHubHTTPError - exceeded our hourly quotas for action: commit
### Describe the bug I try to upload a very large dataset of images, and get the following error: ``` File /fsx-multigen/yuvalkirstain/miniconda/envs/pickapic/lib/python3.10/site-packages/huggingface_hub/hf_api.py:2712, in HfApi.create_commit(self, repo_id, operations, commit_message, commit_description, token, repo_type, revision, create_pr, num_threads, parent_commit, run_as_future) 2710 try: 2711 commit_resp = get_session().post(url=commit_url, headers=headers, data=data, params=params) -> 2712 hf_raise_for_status(commit_resp, endpoint_name="commit") 2713 except RepositoryNotFoundError as e: 2714 e.append_to_message(_CREATE_COMMIT_NO_REPO_ERROR_MESSAGE) File /fsx-multigen/yuvalkirstain/miniconda/envs/pickapic/lib/python3.10/site-packages/huggingface_hub/utils/_errors.py:301, in hf_raise_for_status(response, endpoint_name) 297 raise BadRequestError(message, response=response) from e 299 # Convert `HTTPError` into a `HfHubHTTPError` to display request information 300 # as well (request id and/or server error message) --> 301 raise HfHubHTTPError(str(e), response=response) from e HfHubHTTPError: 429 Client Error: Too Many Requests for url: https://huggingface.co/api/datasets/yuvalkirstain/pickapic_v2/commit/main (Request ID: Root=1-65112399-12d63f7d7f28bfa40a36a0fd) You have exceeded our hourly quotas for action: commit. We invite you to retry later. ``` this makes it much less convenient to host large datasets on HF hub. ### Steps to reproduce the bug Upload a very large dataset of images ### Expected behavior the upload to work well ### Environment info - `datasets` version: 2.13.1 - Platform: Linux-5.15.0-1033-aws-x86_64-with-glibc2.31 - Python version: 3.10.11 - Huggingface_hub version: 0.15.1 - PyArrow version: 12.0.1 - Pandas version: 1.5.3
closed
https://github.com/huggingface/datasets/issues/6257
2023-09-25T06:11:43
2023-10-16T13:30:49
2023-10-16T13:30:48
{ "login": "yuvalkirstain", "id": 57996478, "type": "User" }
[]
false
[]
1,910,275,199
6,256
load_dataset() function's cache_dir does not seems to work
### Describe the bug datasets version: 2.14.5 when trying to run the following command trec = load_dataset('trec', split='train[:1000]', cache_dir='/path/to/my/dir') I keep getting error saying the command does not have permission to the default cache directory on my macbook pro machine. It seems the cache_dir parameter cannot change the dataset saving directory from the default what ever explained in the https://huggingface.co/docs/datasets/cache does not seem to work ### Steps to reproduce the bug datasets version: 2.14.5 when trying to run the following command trec = load_dataset('trec', split='train[:1000]', cache_dir='/path/to/my/dir') I keep getting error saying the command does not have permission to the default cache directory on my macbook pro machine. It seems the cache_dir parameter cannot change the dataset saving directory from the default what ever explained in the https://huggingface.co/docs/datasets/cache does not seem to work ### Expected behavior the dataset should be saved to the cache_dir points to ### Environment info datasets version: 2.14.5 macos X: Ventura 13.4.1 (c)
closed
https://github.com/huggingface/datasets/issues/6256
2023-09-24T15:34:06
2025-05-14T10:08:53
2024-10-08T15:45:18
{ "login": "andyzhu", "id": 171831, "type": "User" }
[]
false
[]
1,909,842,977
6,255
Parallelize builder configs creation
For datasets with lots of configs defined in YAML E.g. `load_dataset("uonlp/CulturaX", "fr", revision="refs/pr/6")` from >1min to 15sec
closed
https://github.com/huggingface/datasets/pull/6255
2023-09-23T11:56:20
2024-01-11T06:32:34
2023-09-26T15:44:19
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,909,672,104
6,254
Dataset.from_generator() cost much more time in vscode debugging mode then running mode
### Describe the bug Hey there, I’m using Dataset.from_generator() to convert a torch_dataset to the Huggingface Dataset. However, when I debug my code on vscode, I find that it runs really slow on Dataset.from_generator() which may even 20 times longer then run the script on terminal. ### Steps to reproduce the bug I write a simple test code : ```python import os from functools import partial from typing import Callable import torch import time from torch.utils.data import Dataset as TorchDataset from datasets import load_from_disk, Dataset as HFDataset import torch from torch.utils.data import Dataset class SimpleDataset(Dataset): def __init__(self, data): self.data = data self.keys = list(data[0].keys()) def __len__(self): return len(self.data) def __getitem__(self, index): sample = self.data[index] return {key: sample[key] for key in self.keys} def TorchDataset2HuggingfaceDataset(torch_dataset: TorchDataset, cache_dir: str = None ) -> HFDataset: """ convert torch dataset to huggingface dataset """ generator : Callable[[], TorchDataset] = lambda: (sample for sample in torch_dataset) return HFDataset.from_generator(generator, cache_dir=cache_dir) if __name__ == '__main__': data = [ {'id': 1, 'name': 'Alice'}, {'id': 2, 'name': 'Bob'}, {'id': 3, 'name': 'Charlie'} ] torch_dataset = SimpleDataset(data) start_time = time.time() huggingface_dataset = TorchDataset2HuggingfaceDataset(torch_dataset) end_time = time.time() print("time: ", end_time - start_time) print(huggingface_dataset) ``` ### Expected behavior this test on my machine report that the running time on terminal is 0.086, however the running time in debugging mode on vscode is 0.25, which I think is much longer than expected. I’d like to know is the anything wrong in the code or just because of debugging? I have traced the code and I find is this func which I get stuck. ```python def create_config_id( self, config_kwargs: dict, custom_features: Optional[Features] = None, ) -> str: ... # stuck in this line suffix = Hasher.hash(config_kwargs_to_add_to_suffix) ``` ### Environment info - `datasets` version: 2.12.0 - Platform: Linux-5.11.0-27-generic-x86_64-with-glibc2.31 - Python version: 3.11.3 - Huggingface_hub version: 0.17.2 - PyArrow version: 11.0.0 - Pandas version: 2.0.1
closed
https://github.com/huggingface/datasets/issues/6254
2023-09-23T02:07:26
2023-10-03T14:42:53
2023-10-03T14:42:53
{ "login": "dontnet-wuenze", "id": 56437469, "type": "User" }
[]
false
[]
1,906,618,910
6,253
Check builder cls default config name in inspect
Fix https://github.com/huggingface/datasets-server/issues/1812 this was causing this issue: ```ipython In [1]: from datasets import * In [2]: inspect.get_dataset_config_names("aakanksha/udpos") Out[2]: ['default'] In [3]: load_dataset_builder("aakanksha/udpos").config.name Out[3]: 'en' ```
closed
https://github.com/huggingface/datasets/pull/6253
2023-09-21T10:15:32
2023-09-21T14:16:44
2023-09-21T14:08:00
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,906,375,378
6,252
exif_transpose not done to Image (PIL problem)
### Feature request I noticed that some of my images loaded using PIL have some metadata related to exif that can rotate them when loading. Since the dataset.features.Image uses PIL for loading, the loaded image may be rotated (width and height will be inverted) thus for tasks as object detection and layoutLM this can create some inconsistencies (between input bboxes and input images). For now there is no option in datasets.features.Image to specify that. We need to do the following when preparing examples (when preparing images for training, test or inference): ``` from PIL import Image, ImageOps pil = ImageOps.exif_transpose(pil) ``` reference: https://stackoverflow.com/a/63950647/5720150 Is it possible to add this by default to the datasets.feature.Image ? or to add the option to do the ImageOps.exif_transpose? Thank you ### Motivation Prevent having inverted data related to exif metadata that may affect object detection tasks ### Your contribution Changing in datasets.featrues.Image I can help with that.
closed
https://github.com/huggingface/datasets/issues/6252
2023-09-21T08:11:46
2024-03-19T15:29:43
2024-03-19T15:29:43
{ "login": "rhajou", "id": 108274349, "type": "User" }
[ { "name": "enhancement", "color": "a2eeef" } ]
false
[]
1,904,418,426
6,251
Support streaming datasets with pyarrow.parquet.read_table
Support streaming datasets with `pyarrow.parquet.read_table`. See: https://huggingface.co/datasets/uonlp/CulturaX/discussions/2 CC: @AndreaFrancis
closed
https://github.com/huggingface/datasets/pull/6251
2023-09-20T08:07:02
2023-09-27T06:37:03
2023-09-27T06:26:24
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
true
[]
1,901,390,945
6,247
Update create_dataset.mdx
modified , as AudioFolder and ImageFolder not in Dataset Library. ``` from datasets import AudioFolder ``` and ```from datasets import ImageFolder``` to ```from datasets import load_dataset``` ``` cannot import name 'AudioFolder' from 'datasets' (/home/eswardivi/miniconda3/envs/Hugformers/lib/python3.10/site-packages/datasets/__init__.py) ```
closed
https://github.com/huggingface/datasets/pull/6247
2023-09-18T17:06:29
2023-09-19T18:51:49
2023-09-19T18:40:10
{ "login": "EswarDivi", "id": 76403422, "type": "User" }
[]
true
[]