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,699,235,739
5,828
Stream data concatenation issue
### Describe the bug I am not able to concatenate the augmentation of the stream data. I am using the latest version of dataset. ValueError: The features can't be aligned because the key audio of features {'audio_id': Value(dtype='string', id=None), 'audio': {'array': Sequence(feature=Value(dtype='float32', id=None), length=-1, id=None), 'path': Value(dtype='null', id=None), 'sampling_rate': Value(dtype='int64', id=None)}, 'transcript': Value(dtype='string', id=None)} has unexpected type - {'array': Sequence(feature=Value(dtype='float32', id=None), length=-1, id=None), 'path': Value(dtype='null', id=None), 'sampling_rate': Value(dtype='int64', id=None)} (expected either Audio(sampling_rate=16000, mono=True, decode=True, id=None) or Value("null"). ### Steps to reproduce the bug dataset = load_dataset("tobiolatunji/afrispeech-200", "all", streaming=True).shuffle(seed=42) dataset_cln = dataset.remove_columns(['speaker_id', 'path', 'age_group', 'gender', 'accent', 'domain', 'country', 'duration']) dataset_cln = dataset_cln.cast_column("audio", Audio(sampling_rate=16000)) from audiomentations import AddGaussianNoise,Compose,Gain,OneOf,PitchShift,PolarityInversion,TimeStretch augmentation = Compose([ AddGaussianNoise(min_amplitude=0.005, max_amplitude=0.015, p=0.2) ]) def augment_dataset(batch): audio = batch["audio"] audio["array"] = augmentation(audio["array"], sample_rate=audio["sampling_rate"]) return batch augmented_dataset_cln = dataset_cln['train'].map(augment_dataset) dataset_cln['train'] = interleave_datasets([dataset_cln['train'], augmented_dataset_cln]) dataset_cln['train'] = dataset_cln['train'].shuffle(seed=42) ### Expected behavior I should be able to merge as sampling rate is same. ### Environment info import datasets import transformers import accelerate print(datasets.__version__) print(transformers.__version__) print(torch.__version__) print(evaluate.__version__) print(accelerate.__version__) 2.12.0 4.28.1 2.0.0 0.4.0 0.18.0
closed
https://github.com/huggingface/datasets/issues/5828
2023-05-07T21:02:54
2023-06-29T20:07:56
2023-05-10T05:05:47
{ "login": "krishnapriya-18", "id": 48817796, "type": "User" }
[]
false
[]
1,698,891,246
5,827
load json dataset interrupt when dtype cast problem occured
### Describe the bug i have a json like this: [ {"id": 1, "name": 1}, {"id": 2, "name": "Nan"}, {"id": 3, "name": 3}, .... ] ,which have several problematic rows data like row 2, then i load it with datasets.load_dataset('json', data_files=['xx.json'], split='train'), it will report like this: Generating train split: 0 examples [00:00, ? examples/s]Failed to read file 'C:\Users\gawinjunwu\Downloads\test\data\a.json' with error <class 'pyarrow.lib.ArrowInvalid'>: Could not convert '2' with type str: tried to convert to int64 Traceback (most recent call last): File "D:\Python3.9\lib\site-packages\datasets\builder.py", line 1858, in _prepare_split_single for _, table in generator: File "D:\Python3.9\lib\site-packages\datasets\packaged_modules\json\json.py", line 146, in _generate_tables raise ValueError(f"Not able to read records in the JSON file at {file}.") from None ValueError: Not able to read records in the JSON file at C:\Users\gawinjunwu\Downloads\test\data\a.json. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "c:\Users\gawinjunwu\Downloads\test\scripts\a.py", line 4, in <module> ds = load_dataset('json', data_dir='data', split='train') File "D:\Python3.9\lib\site-packages\datasets\load.py", line 1797, in load_dataset builder_instance.download_and_prepare( File "D:\Python3.9\lib\site-packages\datasets\builder.py", line 890, in download_and_prepare self._download_and_prepare( File "D:\Python3.9\lib\site-packages\datasets\builder.py", line 985, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "D:\Python3.9\lib\site-packages\datasets\builder.py", line 1746, in _prepare_split for job_id, done, content in self._prepare_split_single( File "D:\Python3.9\lib\site-packages\datasets\builder.py", line 1891, in _prepare_split_single raise DatasetGenerationError("An error occurred while generating the dataset") from e datasets.builder.DatasetGenerationError: An error occurred while generating the dataset. Could datasets skip those problematic data row? ### Steps to reproduce the bug prepare a json file like this: [ {"id": 1, "name": 1}, {"id": 2, "name": "Nan"}, {"id": 3, "name": 3} ] then use datasets.load_dataset('json', dir_files=['xxx.json']) to load the json file ### Expected behavior skip the problematic data row and load row1 and row3 ### Environment info python3.9
open
https://github.com/huggingface/datasets/issues/5827
2023-05-07T04:52:09
2023-05-10T12:32:28
null
{ "login": "1014661165", "id": 46060451, "type": "User" }
[]
false
[]
1,698,155,751
5,826
Support working_dir in from_spark
Accept `working_dir` as an argument to `Dataset.from_spark`. Setting a non-NFS working directory for Spark workers to materialize to will improve write performance.
closed
https://github.com/huggingface/datasets/pull/5826
2023-05-05T20:22:40
2023-05-25T17:45:54
2023-05-25T08:46:15
{ "login": "maddiedawson", "id": 106995444, "type": "User" }
[]
true
[]
1,697,327,483
5,825
FileNotFound even though exists
### Describe the bug I'm trying to download https://huggingface.co/datasets/bigscience/xP3/resolve/main/ur/xp3_facebook_flores_spa_Latn-urd_Arab_devtest_ab-spa_Latn-urd_Arab.jsonl which works fine in my webbrowser, but somehow not with datasets. Am I doing sth wrong? ``` Downloading builder script: 100% 2.82k/2.82k [00:00<00:00, 64.2kB/s] Downloading readme: 100% 12.6k/12.6k [00:00<00:00, 585kB/s] --------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) [<ipython-input-2-4b45446a91d5>](https://localhost:8080/#) in <cell line: 4>() 2 lang = "ur" 3 fname = "xp3_facebook_flores_spa_Latn-urd_Arab_devtest_ab-spa_Latn-urd_Arab.jsonl" ----> 4 dataset = load_dataset("bigscience/xP3", data_files=f"{lang}/{fname}") 6 frames [/usr/local/lib/python3.10/dist-packages/datasets/data_files.py](https://localhost:8080/#) in _resolve_single_pattern_locally(base_path, pattern, allowed_extensions) 291 if allowed_extensions is not None: 292 error_msg += f" with any supported extension {list(allowed_extensions)}" --> 293 raise FileNotFoundError(error_msg) 294 return sorted(out) 295 FileNotFoundError: Unable to find 'https://huggingface.co/datasets/bigscience/xP3/resolve/main/ur/xp3_facebook_flores_spa_Latn-urd_Arab_devtest_ab-spa_Latn-urd_Arab.jsonl' at /content/https:/huggingface.co/datasets/bigscience/xP3/resolve/main ``` ### Steps to reproduce the bug ``` !pip install -q datasets from datasets import load_dataset lang = "ur" fname = "xp3_facebook_flores_spa_Latn-urd_Arab_devtest_ab-spa_Latn-urd_Arab.jsonl" dataset = load_dataset("bigscience/xP3", data_files=f"{lang}/{fname}") ``` ### Expected behavior Correctly downloads ### Environment info latest versions
closed
https://github.com/huggingface/datasets/issues/5825
2023-05-05T09:49:55
2023-08-16T10:02:01
2023-08-16T10:02:01
{ "login": "Muennighoff", "id": 62820084, "type": "User" }
[]
false
[]
1,697,152,148
5,824
Fix incomplete docstring for `BuilderConfig`
Fixes #5820 Also fixed a couple of typos I spotted
closed
https://github.com/huggingface/datasets/pull/5824
2023-05-05T07:34:28
2023-05-05T12:39:14
2023-05-05T12:31:54
{ "login": "Laurent2916", "id": 21087104, "type": "User" }
[]
true
[]
1,697,024,789
5,823
[2.12.0] DatasetDict.save_to_disk not saving to S3
### Describe the bug When trying to save a `DatasetDict` to a private S3 bucket using `save_to_disk`, the artifacts are instead saved locally, and not in the S3 bucket. I have tried using the deprecated `fs` as well as the `storage_options` arguments and I get the same results. ### Steps to reproduce the bug 1. Create a DatsetDict `dataset` 2. Create a S3FileSystem object `s3 = datasets.filesystems.S3FileSystem(key=aws_access_key_id, secret=aws_secret_access_key)` 3. Save using `dataset_dict.save_to_disk(f"{s3_bucket}/{s3_dir}/{dataset_name}", storage_options=s3.storage_options)` or `dataset_dict.save_to_disk(f"{s3_bucket}/{s3_dir}/{dataset_name}", fs=s3)` 4. Check the corresponding S3 bucket and verify nothing has been uploaded 5. Check the path at f"{s3_bucket}/{s3_dir}/{dataset_name}" and verify that files have been saved there ### Expected behavior Artifacts are uploaded at the f"{s3_bucket}/{s3_dir}/{dataset_name}" S3 location. ### Environment info - `datasets` version: 2.12.0 - Platform: macOS-13.3.1-x86_64-i386-64bit - Python version: 3.11.2 - Huggingface_hub version: 0.14.1 - PyArrow version: 12.0.0 - Pandas version: 2.0.1
closed
https://github.com/huggingface/datasets/issues/5823
2023-05-05T05:22:59
2024-05-30T16:11:31
2023-05-05T15:01:17
{ "login": "thejamesmarq", "id": 5233185, "type": "User" }
[]
false
[]
1,696,627,308
5,822
Audio Dataset with_format torch problem
### Describe the bug Common Voice v10 Delta (German) Dataset from here https://commonvoice.mozilla.org/de/datasets ``` audio_dataset = \ (Dataset .from_dict({"audio": ('/tmp/cv-corpus-10.0-delta-2022-07-04/de/clips/' + df.path).to_list()}) .cast_column("audio", Audio(sampling_rate=16_000)) .with_format('numpy')) audio_dataset[0]["audio"] ``` works, but ``` audio_dataset = \ (Dataset .from_dict({"audio": ('/tmp/cv-corpus-10.0-delta-2022-07-04/de/clips/' + df.path).to_list()}) .cast_column("audio", Audio(sampling_rate=16_000)) .with_format('torch')) audio_dataset[0]["audio"] ``` does not instead I get ``` --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[54], line 1 ----> 1 audio_dataset[0]["audio"] File /anaconda/envs/azureml_py38/lib/python3.8/site-packages/datasets/arrow_dataset.py:2154, in Dataset.__getitem__(self, key) 2152 def __getitem__(self, key): # noqa: F811 2153 """Can be used to index columns (by string names) or rows (by integer index or iterable of indices or bools).""" -> 2154 return self._getitem( 2155 key, 2156 ) File /anaconda/envs/azureml_py38/lib/python3.8/site-packages/datasets/arrow_dataset.py:2139, in Dataset._getitem(self, key, decoded, **kwargs) 2137 formatter = get_formatter(format_type, features=self.features, decoded=decoded, **format_kwargs) 2138 pa_subtable = query_table(self._data, key, indices=self._indices if self._indices is not None else None) -> 2139 formatted_output = format_table( 2140 pa_subtable, key, formatter=formatter, format_columns=format_columns, output_all_columns=output_all_columns 2141 ) 2142 return formatted_output File /anaconda/envs/azureml_py38/lib/python3.8/site-packages/datasets/formatting/formatting.py:532, in format_table(table, key, formatter, format_columns, output_all_columns) 530 python_formatter = PythonFormatter(features=None) 531 if format_columns is None: --> 532 return formatter(pa_table, query_type=query_type) 533 elif query_type == "column": 534 if key in format_columns: File /anaconda/envs/azureml_py38/lib/python3.8/site-packages/datasets/formatting/formatting.py:281, in Formatter.__call__(self, pa_table, query_type) 279 def __call__(self, pa_table: pa.Table, query_type: str) -> Union[RowFormat, ColumnFormat, BatchFormat]: 280 if query_type == "row": --> 281 return self.format_row(pa_table) 282 elif query_type == "column": 283 return self.format_column(pa_table) File /anaconda/envs/azureml_py38/lib/python3.8/site-packages/datasets/formatting/torch_formatter.py:58, in TorchFormatter.format_row(self, pa_table) 56 def format_row(self, pa_table: pa.Table) -> dict: 57 row = self.numpy_arrow_extractor().extract_row(pa_table) ---> 58 return self.recursive_tensorize(row) File /anaconda/envs/azureml_py38/lib/python3.8/site-packages/datasets/formatting/torch_formatter.py:54, in TorchFormatter.recursive_tensorize(self, data_struct) 53 def recursive_tensorize(self, data_struct: dict): ---> 54 return map_nested(self._recursive_tensorize, data_struct, map_list=False) File /anaconda/envs/azureml_py38/lib/python3.8/site-packages/datasets/utils/py_utils.py:356, in map_nested(function, data_struct, dict_only, map_list, map_tuple, map_numpy, num_proc, types, disable_tqdm, desc) 354 num_proc = 1 355 if num_proc <= 1 or len(iterable) <= num_proc: --> 356 mapped = [ 357 _single_map_nested((function, obj, types, None, True, None)) 358 for obj in logging.tqdm(iterable, disable=disable_tqdm, desc=desc) 359 ] 360 else: 361 split_kwds = [] # We organize the splits ourselve (contiguous splits) File /anaconda/envs/azureml_py38/lib/python3.8/site-packages/datasets/utils/py_utils.py:357, in <listcomp>(.0) 354 num_proc = 1 355 if num_proc <= 1 or len(iterable) <= num_proc: 356 mapped = [ --> 357 _single_map_nested((function, obj, types, None, True, None)) 358 for obj in logging.tqdm(iterable, disable=disable_tqdm, desc=desc) 359 ] 360 else: 361 split_kwds = [] # We organize the splits ourselve (contiguous splits) File /anaconda/envs/azureml_py38/lib/python3.8/site-packages/datasets/utils/py_utils.py:309, in _single_map_nested(args) 306 pbar = logging.tqdm(pbar_iterable, disable=disable_tqdm, position=rank, unit="obj", desc=pbar_desc) 308 if isinstance(data_struct, dict): --> 309 return {k: _single_map_nested((function, v, types, None, True, None)) for k, v in pbar} 310 else: 311 mapped = [_single_map_nested((function, v, types, None, True, None)) for v in pbar] File /anaconda/envs/azureml_py38/lib/python3.8/site-packages/datasets/utils/py_utils.py:309, in <dictcomp>(.0) 306 pbar = logging.tqdm(pbar_iterable, disable=disable_tqdm, position=rank, unit="obj", desc=pbar_desc) 308 if isinstance(data_struct, dict): --> 309 return {k: _single_map_nested((function, v, types, None, True, None)) for k, v in pbar} 310 else: 311 mapped = [_single_map_nested((function, v, types, None, True, None)) for v in pbar] File /anaconda/envs/azureml_py38/lib/python3.8/site-packages/datasets/utils/py_utils.py:293, in _single_map_nested(args) 291 # Singleton first to spare some computation 292 if not isinstance(data_struct, dict) and not isinstance(data_struct, types): --> 293 return function(data_struct) 295 # Reduce logging to keep things readable in multiprocessing with tqdm 296 if rank is not None and logging.get_verbosity() < logging.WARNING: File /anaconda/envs/azureml_py38/lib/python3.8/site-packages/datasets/formatting/torch_formatter.py:51, in TorchFormatter._recursive_tensorize(self, data_struct) 49 if data_struct.dtype == np.object: # pytorch tensors cannot be instantied from an array of objects 50 return [self.recursive_tensorize(substruct) for substruct in data_struct] ---> 51 return self._tensorize(data_struct) File /anaconda/envs/azureml_py38/lib/python3.8/site-packages/datasets/formatting/torch_formatter.py:38, in TorchFormatter._tensorize(self, value) 35 import torch 37 default_dtype = {} ---> 38 if np.issubdtype(value.dtype, np.integer): 39 default_dtype = {"dtype": torch.int64} 40 elif np.issubdtype(value.dtype, np.floating): AttributeError: 'NoneType' object has no attribute 'dtype' ``` ### Steps to reproduce the bug 1. Download some audio dataset in this case I used Common Voice v10 Delta (German) Dataset from here https://commonvoice.mozilla.org/de/datasets 2. Try the Code from above ### Expected behavior It should work for torch ### Environment info pytorch: 2.0.0 datasets: 2.3.2 numpy: 1.21.6 Python: 3.8 Linux
closed
https://github.com/huggingface/datasets/issues/5822
2023-05-04T20:07:51
2023-05-11T20:45:53
2023-05-11T20:45:53
{ "login": "paulbauriegel", "id": 20282916, "type": "User" }
[]
false
[]
1,696,400,343
5,821
IterableDataset Arrow formatting
Adding an optional `.iter_arrow` to examples iterable. This allows to use Arrow formatting in map/filter. This will also be useful for torch formatting, since we can reuse the TorchFormatter that converts Arrow data to torch tensors Related to https://github.com/huggingface/datasets/issues/5793 and https://github.com/huggingface/datasets/issues/3444 Required for https://github.com/huggingface/datasets/pull/5852 ### Example: Speed x10 in map ```python from datasets import Dataset import pyarrow.compute as pc import time ds = Dataset.from_dict({"a": range(100_000)}) ids = ds.to_iterable_dataset() ids = ids.map(lambda x: {"a": [a + 10 for a in x["a"]]}, batched=True) _start = time.time() print(f"Python ({sum(1 for _ in ids)} items):\t{(time.time() - _start) * 1000:.1f}ms") # Python (100000 items): 695.7ms ids = ds.to_iterable_dataset().with_format("arrow") ids = ids.map(lambda t: t.set_column(0, "a", pc.add(t[0], 10)), batched=True) ids = ids.with_format(None) _start = time.time() print(f"Arrow ({sum(1 for _ in ids)} items):\t{(time.time() - _start) * 1000:.1f}ms)") # Arrow (100000 items): 81.0ms) ``` ### Implementation details I added an optional `iter_arrow` method to examples iterable. If an example iterable has this method, then it can be used to iterate on the examples by batch of arrow tables.
closed
https://github.com/huggingface/datasets/pull/5821
2023-05-04T17:23:43
2023-05-31T09:43:26
2023-05-31T09:36:18
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,695,892,811
5,820
Incomplete docstring for `BuilderConfig`
Hi guys ! I stumbled upon this docstring while working on a project. Some of the attributes have missing descriptions. https://github.com/huggingface/datasets/blob/bc5fef5b6d91f009e4101684adcb374df2c170f6/src/datasets/builder.py#L104-L117
closed
https://github.com/huggingface/datasets/issues/5820
2023-05-04T12:14:34
2023-05-05T12:31:56
2023-05-05T12:31:56
{ "login": "Laurent2916", "id": 21087104, "type": "User" }
[ { "name": "good first issue", "color": "7057ff" } ]
false
[]
1,695,536,738
5,819
Cannot pickle error in Dataset.from_generator()
### Describe the bug I'm trying to use Dataset.from_generator() to generate a large dataset. ### Steps to reproduce the bug Code to reproduce: ``` from transformers import T5Tokenizer, T5ForConditionalGeneration, GenerationConfig import torch from tqdm import tqdm from datasets import load_dataset tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-small") model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-small", device_map="auto") model = torch.compile(model) def generate_data(data_loader): model.eval() for batch in tqdm(data_loader): input_ids = tokenizer(batch['instruction'], return_tensors='pt', padding=True, truncation=True).input_ids.to("cuda:0") with torch.no_grad(): outputs = model.generate(input_ids, generation_config=generation_config) decoder_hidden_states = outputs.decoder_hidden_states for i, h in zip(batch['instruction'], decoder_hidden_states): yield {"instruction": i, "decoder_hidden_states": h} generation_config = GenerationConfig( temperature=1, max_new_tokens=1024, do_sample=False, num_return_sequences=1, return_dict_in_generate=True, output_scores=True, output_hidden_states=True, ) from datasets import Dataset, load_dataset from torch.utils.data import DataLoader dataset = load_dataset("HuggingFaceH4/databricks_dolly_15k") train_loader = DataLoader(dataset['train'], batch_size=2, shuffle=True) dataset = Dataset.from_generator(generator=generate_data, gen_kwargs={"data_loader": train_loader}) dataset.save_to_disk("data/flant5_small_generation") ``` ### Expected behavior The dataset should be generated and saved. But the following error occurred: ``` Traceback (most recent call last): File "/remote-home/xhwang/alpaca-lora/data_collection_t5.py", line 46, in <module> dataset = Dataset.from_generator(generator=generate_data, gen_kwargs={"data_loader": train_loader}) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 1035, in from_generator return GeneratorDatasetInputStream( File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/io/generator.py", line 28, in __init__ self.builder = Generator( File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/builder.py", line 336, in __init__ self.config, self.config_id = self._create_builder_config( File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/builder.py", line 505, in _create_builder_config config_id = builder_config.create_config_id( File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/builder.py", line 179, in create_config_id suffix = Hasher.hash(config_kwargs_to_add_to_suffix) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/fingerprint.py", line 236, in hash return cls.hash_default(value) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/fingerprint.py", line 229, in hash_default return cls.hash_bytes(dumps(value)) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 726, in dumps dump(obj, file) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 701, in dump Pickler(file, recurse=True).dump(obj) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 394, in dump StockPickler.dump(self, obj) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 487, in dump self.save(obj) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 691, in save dill.Pickler.save(self, obj, save_persistent_id=save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 388, in save StockPickler.save(self, obj, save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 560, in save f(self, obj) # Call unbound method with explicit self File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 1186, in save_module_dict StockPickler.save_dict(pickler, obj) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 972, in save_dict self._batch_setitems(obj.items()) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 998, in _batch_setitems save(v) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 691, in save dill.Pickler.save(self, obj, save_persistent_id=save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 388, in save StockPickler.save(self, obj, save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 560, in save f(self, obj) # Call unbound method with explicit self File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 1311, in save_function dill._dill._save_with_postproc( File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 1084, in _save_with_postproc pickler._batch_setitems(iter(source.items())) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 998, in _batch_setitems save(v) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 691, in save dill.Pickler.save(self, obj, save_persistent_id=save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 388, in save StockPickler.save(self, obj, save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 603, in save self.save_reduce(obj=obj, *rv) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 717, in save_reduce save(state) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 691, in save dill.Pickler.save(self, obj, save_persistent_id=save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 388, in save StockPickler.save(self, obj, save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 560, in save f(self, obj) # Call unbound method with explicit self File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 1186, in save_module_dict StockPickler.save_dict(pickler, obj) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 972, in save_dict self._batch_setitems(obj.items()) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 998, in _batch_setitems save(v) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 691, in save dill.Pickler.save(self, obj, save_persistent_id=save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 388, in save StockPickler.save(self, obj, save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 603, in save self.save_reduce(obj=obj, *rv) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 717, in save_reduce save(state) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 691, in save dill.Pickler.save(self, obj, save_persistent_id=save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 388, in save StockPickler.save(self, obj, save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 560, in save f(self, obj) # Call unbound method with explicit self File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 1186, in save_module_dict StockPickler.save_dict(pickler, obj) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 972, in save_dict self._batch_setitems(obj.items()) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 998, in _batch_setitems save(v) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 691, in save dill.Pickler.save(self, obj, save_persistent_id=save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 388, in save StockPickler.save(self, obj, save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 560, in save f(self, obj) # Call unbound method with explicit self File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 1311, in save_function dill._dill._save_with_postproc( File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 1070, in _save_with_postproc pickler.save_reduce(*reduction, obj=obj) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 717, in save_reduce save(state) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 691, in save dill.Pickler.save(self, obj, save_persistent_id=save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 388, in save StockPickler.save(self, obj, save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 560, in save f(self, obj) # Call unbound method with explicit self File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 887, in save_tuple save(element) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 691, in save dill.Pickler.save(self, obj, save_persistent_id=save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 388, in save StockPickler.save(self, obj, save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 560, in save f(self, obj) # Call unbound method with explicit self File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 1186, in save_module_dict StockPickler.save_dict(pickler, obj) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 972, in save_dict self._batch_setitems(obj.items()) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 998, in _batch_setitems save(v) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 691, in save dill.Pickler.save(self, obj, save_persistent_id=save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 388, in save StockPickler.save(self, obj, save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 560, in save f(self, obj) # Call unbound method with explicit self File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 1311, in save_function dill._dill._save_with_postproc( File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 1070, in _save_with_postproc pickler.save_reduce(*reduction, obj=obj) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 717, in save_reduce save(state) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 691, in save dill.Pickler.save(self, obj, save_persistent_id=save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 388, in save StockPickler.save(self, obj, save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 560, in save f(self, obj) # Call unbound method with explicit self File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 887, in save_tuple save(element) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 691, in save dill.Pickler.save(self, obj, save_persistent_id=save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 388, in save StockPickler.save(self, obj, save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 560, in save f(self, obj) # Call unbound method with explicit self File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 1186, in save_module_dict StockPickler.save_dict(pickler, obj) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 972, in save_dict self._batch_setitems(obj.items()) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 1003, in _batch_setitems save(v) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 691, in save dill.Pickler.save(self, obj, save_persistent_id=save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 388, in save StockPickler.save(self, obj, save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 560, in save f(self, obj) # Call unbound method with explicit self File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 1311, in save_function dill._dill._save_with_postproc( File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 1084, in _save_with_postproc pickler._batch_setitems(iter(source.items())) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 998, in _batch_setitems save(v) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 691, in save dill.Pickler.save(self, obj, save_persistent_id=save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/site-packages/dill/_dill.py", line 388, in save StockPickler.save(self, obj, save_persistent_id) File "/remote-home/xhwang/anaconda3/envs/alpaca-lora/lib/python3.10/pickle.py", line 578, in save rv = reduce(self.proto) TypeError: cannot pickle 'ConfigModuleInstance' object ``` ### Environment info - `datasets` version: 2.11.0 - Platform: Linux-4.15.0-156-generic-x86_64-with-glibc2.31 - Python version: 3.10.10 - Huggingface_hub version: 0.13.2 - PyArrow version: 11.0.0 - Pandas version: 1.5.3
closed
https://github.com/huggingface/datasets/issues/5819
2023-05-04T08:39:09
2023-05-05T19:20:59
2023-05-05T19:20:58
{ "login": "xinghaow99", "id": 50691954, "type": "User" }
[]
false
[]
1,695,052,555
5,818
Ability to update a dataset
### Feature request The ability to load a dataset, add or change something, and save it back to disk. Maybe it's possible, but I can't work out how to do it, e.g. this fails: ```py import datasets dataset = datasets.load_from_disk("data/test1") dataset = dataset.add_item({"text": "A new item"}) dataset.save_to_disk("data/test1") ``` With the error: ``` PermissionError: Tried to overwrite /mnt/c/Users/david/py/learning/mini_projects/data_sorting_and_filtering/data/test1 but a dataset can't overwrite itself. ``` ### Motivation My use case is that I want to process a dataset in a particular way but it doesn't fit in memory if I do it in one go. So I want to perform a loop and at each step in the loop, process one shard and append it to an ever-growing dataset. The code in the loop will load a dataset, add some rows, then save it again. Maybe I'm just thinking about things incorrectly and there's a better approach. FWIW I can't use `dataset.map()` to do the task because that doesn't work with `num_proc` when adding rows, so is confined to a single process which is too slow. The only other way I can think of is to create a new file each time, but surely that's not how people do this sort of thing. ### Your contribution na
open
https://github.com/huggingface/datasets/issues/5818
2023-05-04T01:08:13
2023-05-04T20:43:39
null
{ "login": "davidgilbertson", "id": 4443482, "type": "User" }
[ { "name": "enhancement", "color": "a2eeef" } ]
false
[]
1,694,891,866
5,817
Setting `num_proc` errors when `.map` returns additional items.
### Describe the bug I'm using a map function that returns more rows than are passed in. If I try to use `num_proc` I get: ``` File "/home/davidg/.virtualenvs/learning/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 563, in wrapper out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs) File "/home/davidg/.virtualenvs/learning/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 528, in wrapper out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs) File "/home/davidg/.virtualenvs/learning/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3097, in map for rank, done, content in iflatmap_unordered( File "/home/davidg/.virtualenvs/learning/lib/python3.10/site-packages/datasets/utils/py_utils.py", line 1372, in iflatmap_unordered yield queue.get(timeout=0.05) File "<string>", line 2, in get File "/home/davidg/.virtualenvs/learning/lib/python3.10/site-packages/multiprocess/managers.py", line 818, in _callmethod kind, result = conn.recv() File "/home/davidg/.virtualenvs/learning/lib/python3.10/site-packages/multiprocess/connection.py", line 258, in recv buf = self._recv_bytes() File "/home/davidg/.virtualenvs/learning/lib/python3.10/site-packages/multiprocess/connection.py", line 422, in _recv_bytes buf = self._recv(4) File "/home/davidg/.virtualenvs/learning/lib/python3.10/site-packages/multiprocess/connection.py", line 391, in _recv raise EOFError EOFError ``` ### Steps to reproduce the bug This is copied from the [Datasets docs](https://huggingface.co/docs/datasets/v2.12.0/en/process#batch-processing), with `num_proc` added, and will error. ```py import datasets dataset = ... # any old dataset def chunk_examples(examples): chunks = [] for sentence in examples["text"]: chunks += [sentence[i : i + 50] for i in range(0, len(sentence), 50)] return {"chunks": chunks} chunked_dataset = dataset.map( chunk_examples, batched=True, remove_columns=dataset.column_names, num_proc=2, # Remove and it works ) ``` ### Expected behavior Should work fine. On a related note, multi-processing also fails if there is a Meta class anywhere in scope (and there are plenty in the standard library). This is the fault of `dill` and is a long standing issue. Have you considered using Loky for multiprocessing? I've found that the built-in `datasets` multi-processing breaks more than it works so have written my own function using `loky`, for reference: ```py import datasets import loky def fast_loop(dataset: datasets.Dataset, func, num_proc=None): if num_proc is None: import os num_proc = len(os.sched_getaffinity(0)) shards = [ dataset.shard(num_shards=num_proc, index=i, contiguous=True) for i in range(num_proc) ] executor = loky.get_reusable_executor(max_workers=num_proc) results = executor.map(func, shards) return datasets.combine.concatenate_datasets(list(results)) ``` ### Environment info - `datasets` version: 2.11.0 - Platform: Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.31 - Python version: 3.10.8 - Huggingface_hub version: 0.12.1 - PyArrow version: 11.0.0 - Pandas version: 2.0.1
closed
https://github.com/huggingface/datasets/issues/5817
2023-05-03T21:46:53
2023-05-04T21:14:21
2023-05-04T20:22:25
{ "login": "davidgilbertson", "id": 4443482, "type": "User" }
[]
false
[]
1,694,590,856
5,816
Preserve `stopping_strategy` of shuffled interleaved dataset (random cycling case)
Preserve the `stopping_strategy` in the `RandomlyCyclingMultiSourcesExamplesIterable.shard_data_sources` to fix shuffling a dataset interleaved (from multiple sources) with probabilities. Fix #5812
closed
https://github.com/huggingface/datasets/pull/5816
2023-05-03T18:34:18
2023-05-04T14:31:55
2023-05-04T14:24:49
{ "login": "mariosasko", "id": 47462742, "type": "User" }
[]
true
[]
1,693,216,778
5,814
Repro windows crash
null
closed
https://github.com/huggingface/datasets/pull/5814
2023-05-02T23:30:18
2024-01-08T18:30:45
2024-01-08T18:30:45
{ "login": "maddiedawson", "id": 106995444, "type": "User" }
[]
true
[]
1,693,701,743
5,815
Easy way to create a Kaggle dataset from a Huggingface dataset?
I'm not sure whether this is more appropriately addressed with HuggingFace or Kaggle. I would like to somehow directly create a Kaggle dataset from a HuggingFace Dataset. While Kaggle does provide the option to create a dataset from a URI, that URI must point to a single file. For example: ![image](https://user-images.githubusercontent.com/5355286/235792394-7c559d07-4aff-45b7-ad2b-9c5280c88415.png) Is there some mechanism from huggingface to represent a dataset (such as that from `load_dataset('wmt14', 'de-en', split='train')` as a single file? Or, some other way to get that into a Kaggle dataset so that I can use the huggingface `datasets` module to process and consume it inside of a Kaggle notebook? Thanks in advance!
open
https://github.com/huggingface/datasets/issues/5815
2023-05-02T21:43:33
2023-07-26T16:13:31
null
{ "login": "hrbigelow", "id": 5355286, "type": "User" }
[]
false
[]
1,691,908,535
5,813
[DO-NOT-MERGE] Debug Windows issue at #3
TBD
closed
https://github.com/huggingface/datasets/pull/5813
2023-05-02T07:19:34
2023-05-02T07:21:30
2023-05-02T07:21:30
{ "login": "HyukjinKwon", "id": 6477701, "type": "User" }
[]
true
[]
1,691,798,169
5,812
Cannot shuffle interleaved IterableDataset with "all_exhausted" stopping strategy
### Describe the bug Shuffling interleaved `IterableDataset` with "all_exhausted" strategy yields non-exhaustive sampling. ### Steps to reproduce the bug ```py from datasets import IterableDataset, interleave_datasets def gen(bias, length): for i in range(length): yield dict(a=bias+i) seed = 42 probabilities = [0.2, 0.6, 0.2] d1 = IterableDataset.from_generator(lambda: gen(0, 3)) d2 = IterableDataset.from_generator(lambda: gen(10, 4)) d3 = IterableDataset.from_generator(lambda: gen(20, 3)) ds = interleave_datasets([d1, d2, d3], probabilities=probabilities, seed=seed, stopping_strategy='all_exhausted') ds = ds.shuffle(buffer_size=1000) for x in ds: print(x) ``` This code produces ``` {'a': 0} {'a': 22} {'a': 20} {'a': 21} {'a': 10} {'a': 1} ``` ### Expected behavior It should produce a longer list of examples to exhaust all the datasets. If you comment out the shuffle line, it will exhaust all the datasets properly. Here is the output if you comment out shuffling: ``` {'a': 10} {'a': 11} {'a': 20} {'a': 12} {'a': 0} {'a': 21} {'a': 13} {'a': 10} {'a': 1} {'a': 11} {'a': 12} {'a': 22} {'a': 13} {'a': 20} {'a': 10} {'a': 11} {'a': 12} {'a': 2} ``` ### Environment info - `datasets` version: 2.12.0 - Platform: Linux-5.10.147+-x86_64-with-glibc2.31 - Python version: 3.10.11 - Huggingface_hub version: 0.14.1 - PyArrow version: 9.0.0 - Pandas version: 1.5.3 This was run on Google Colab.
closed
https://github.com/huggingface/datasets/issues/5812
2023-05-02T05:26:17
2023-05-04T14:24:51
2023-05-04T14:24:51
{ "login": "offchan42", "id": 15215732, "type": "User" }
[ { "name": "bug", "color": "d73a4a" }, { "name": "streaming", "color": "fef2c0" } ]
false
[]
1,689,919,046
5,811
load_dataset: TypeError: 'NoneType' object is not callable, on local dataset filename changes
### Describe the bug I've adapted Databrick's [train_dolly.py](/databrickslabs/dolly/blob/master/train_dolly.py) to train using a local dataset, which has been working. Upon changing the filenames of the `.json` & `.py` files in my local dataset directory, `dataset = load_dataset(path_or_dataset)["train"]` throws the error: ```python 2023-04-30 09:10:52 INFO [training.trainer] Loading dataset from dushowxa-characters Traceback (most recent call last): File "/data/dushowxa-dolly/train_dushowxa.py", line 26, in <module> load_training_dataset() File "/data/dushowxa-dolly/training/trainer.py", line 89, in load_training_dataset dataset = load_dataset(path_or_dataset)["train"] File "/data/dushowxa-dolly/.venv/lib/python3.10/site-packages/datasets/load.py", line 1773, in load_dataset builder_instance = load_dataset_builder( File "/data/dushowxa-dolly/.venv/lib/python3.10/site-packages/datasets/load.py", line 1528, in load_dataset_builder builder_instance: DatasetBuilder = builder_cls( TypeError: 'NoneType' object is not callable ``` The local dataset filenames were of the form `dushowxa-characters/expanse-dushowxa-characters.json` and are now of the form `dushowxa-characters/dushowxa-characters.json` (the word `expanse-` was removed from the filenames). Is this perhaps a dataset caching issue? I have attempted to manually clear caches, but to no effect: ```sh rm -rfv ~/.cache/huggingface/datasets/* rm -rfv ~/.cache/huggingface/modules/* ``` ### Steps to reproduce the bug Run `python3 train_dushowxa.py` (adapted from Databrick's [train_dolly.py](/databrickslabs/dolly/blob/master/train_dolly.py)). ### Expected behavior Training succeeds as before local dataset filenames were changed. ### Environment info Ubuntu 22.04, Python 3.10.6, venv ```python accelerate>=0.16.0,<1 click>=8.0.4,<9 datasets>=2.10.0,<3 deepspeed>=0.9.0,<1 transformers[torch]>=4.28.1,<5 langchain>=0.0.139 ```
open
https://github.com/huggingface/datasets/issues/5811
2023-04-30T13:27:17
2025-02-27T07:32:30
null
{ "login": "durapensa", "id": 50685483, "type": "User" }
[]
false
[]
1,689,917,822
5,810
Add `fn_kwargs` to `map` and `filter` of `IterableDataset` and `IterableDatasetDict`
# Overview I've added an argument`fn_kwargs` for map and filter methods of `IterableDataset` and `IterableDatasetDict` classes. # Details Currently, the map and filter methods of some classes related to `IterableDataset` do not allow specifing the arguments passed to the function. This pull request adds `fn_kwargs` to pass arguments to the mapping function. This allows users to preprocess data more flexibly. Added `fn_kwargs` to the following classes and methods (description of the argument is also added). 1. class `FilteredExamplesIterable` 2. method `filter` of class `IterableDataset` 3. method `map` of class `IterableDatasetDict` 4. method `filter` of class `IterableDatasetDict` # Example of changes Here's an example of how to use the new functionality: ```python from datasets import IterableDatasetDict def preprocess_function(example, a=None, b=None): # do something return example dataset = IterableDatasetDict(...) dataset = dataset.map(preprocess_function, fn_kwargs={"a": 1, "b": 2}) ``` # Related Issues This pull request is related to the following issue: https://github.com/huggingface/datasets/issues/3444 . # Testing I have added unit tests to test the new functionality. In test_iterable_dataset.py - Added `test_filtered_examples_iterable_with_fn_kwargs` for [1](#details). - Added `test_iterable_dataset_filter` for [2](#details). - Added `test_iterable_dataset_map_with_fn_kwargs`. This is not a newly added feature, but was added because it was not tested. In test_dataset_dict.py - Added `_create_dummy_iterable_dataset` for [3](#details) and [4](#details). - Added `_create_dummy_iterable_dataset_dict` for [3](#details) and [4](#details). - Added `test_iterable_map` for [3](#details). - Added `test_iterable_filter` for [4](#details). Note that, there is no test for `IterableDatasetDict` at the current main branch. I thought about writing tests for `IterableDatasetDict` in a new file, but I decided to add them in the test file for `DatasetDict` (test_dataset_dict.py). # Checklist - [x] Format the code. - [x] Added tests. - [x] Passed tests locally.
closed
https://github.com/huggingface/datasets/pull/5810
2023-04-30T13:23:01
2023-05-22T08:12:39
2023-05-22T08:05:31
{ "login": "yuukicammy", "id": 3927621, "type": "User" }
[]
true
[]
1,689,797,293
5,809
wiki_dpr details for Open Domain Question Answering tasks
Hey guys! Thanks for creating the wiki_dpr dataset! I am currently trying to combine wiki_dpr and my own datasets. but I don't know how to make the embedding value the same way as wiki_dpr. As an experiment, I embeds the text of id="7" of wiki_dpr, but this result was very different from wiki_dpr.
closed
https://github.com/huggingface/datasets/issues/5809
2023-04-30T06:12:04
2023-07-21T14:11:00
2023-07-21T14:11:00
{ "login": "yulgok22", "id": 64122846, "type": "User" }
[]
false
[]
1,688,977,237
5,807
Support parallelized downloading in load_dataset with Spark
As proposed in https://github.com/huggingface/datasets/issues/5798, this adds support to parallelized downloading in `load_dataset` with Spark, which can speed up the process by distributing the workload to worker nodes. Parallelizing dataset processing is not supported in this PR.
closed
https://github.com/huggingface/datasets/pull/5807
2023-04-28T18:34:32
2023-05-25T16:54:14
2023-05-25T16:54:14
{ "login": "es94129", "id": 12763339, "type": "User" }
[]
true
[]
1,688,598,095
5,806
Return the name of the currently loaded file in the load_dataset function.
### Feature request Add an optional parameter return_file_name in the load_dataset function. When it is set to True, the function will include the name of the file corresponding to the current line as a feature in the returned output. ### Motivation When training large language models, machine problems may interrupt the training process. In such cases, it is common to load a previously saved checkpoint to resume training. I would like to be able to obtain the names of the previously trained data shards, so that I can skip these parts of the data during continued training to avoid overfitting and redundant training time. ### Your contribution I currently use a dataset in jsonl format, so I am primarily interested in the json format. I suggest adding the file name to the returned table here https://github.com/huggingface/datasets/blob/main/src/datasets/packaged_modules/json/json.py#L92.
open
https://github.com/huggingface/datasets/issues/5806
2023-04-28T13:50:15
2025-03-21T12:07:15
null
{ "login": "s-JoL", "id": 16948304, "type": "User" }
[ { "name": "enhancement", "color": "a2eeef" }, { "name": "good first issue", "color": "7057ff" } ]
false
[]
1,688,558,577
5,805
Improve `Create a dataset` tutorial
Our [tutorial on how to create a dataset](https://huggingface.co/docs/datasets/create_dataset) is a bit misleading. 1. In **Folder-based builders** section it says that we have two folder-based builders as standard builders, but we also have similar builders (that can be created from directory with data of required format) for `csv`, `json/jsonl`, `parquet` and `txt` files. We have info about these loaders in separate [guide for loading](https://huggingface.co/docs/datasets/loading#local-and-remote-files) but it's worth briefly mentioning them in the beginning tutorial because they are more common and for consistency. Would be helpful to add the link to the full guide. 2. **From local files** section lists methods for creating a dataset from in-memory data which are also described in [loading guide](https://huggingface.co/docs/datasets/loading#inmemory-data). Maybe we should actually rethink and restructure this tutorial somehow.
open
https://github.com/huggingface/datasets/issues/5805
2023-04-28T13:26:22
2024-07-26T21:16:13
null
{ "login": "polinaeterna", "id": 16348744, "type": "User" }
[ { "name": "documentation", "color": "0075ca" } ]
false
[]
1,688,285,666
5,804
Set dev version
null
closed
https://github.com/huggingface/datasets/pull/5804
2023-04-28T10:10:01
2023-04-28T10:18:51
2023-04-28T10:10:29
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,688,256,290
5,803
Release: 2.12.0
null
closed
https://github.com/huggingface/datasets/pull/5803
2023-04-28T09:52:11
2023-04-28T10:18:56
2023-04-28T09:54:43
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,686,509,799
5,802
Validate non-empty data_files
This PR adds validation of `data_files`, so that they are non-empty (str, list, or dict) or `None` (default). See: https://github.com/huggingface/datasets/pull/5787#discussion_r1178862327
closed
https://github.com/huggingface/datasets/pull/5802
2023-04-27T09:51:36
2023-04-27T14:59:47
2023-04-27T14:51:40
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
true
[]
1,686,348,096
5,800
Change downloaded file permission based on umask
This PR changes the permission of downloaded files to cache, so that the umask is taken into account. Related to: - #2157 Fix #5799. CC: @stas00
closed
https://github.com/huggingface/datasets/pull/5800
2023-04-27T08:13:30
2023-04-27T09:33:05
2023-04-27T09:30:16
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
true
[]
1,686,334,572
5,799
Files downloaded to cache do not respect umask
As reported by @stas00, files downloaded to the cache do not respect umask: ```bash $ ls -l /path/to/cache/datasets/downloads/ -rw------- 1 uername username 150M Apr 25 16:41 5e646c1d600f065adaeb134e536f6f2f296a6d804bd1f0e1fdcd20ee28c185c6 ``` Related to: - #2065
closed
https://github.com/huggingface/datasets/issues/5799
2023-04-27T08:06:05
2023-04-27T09:30:17
2023-04-27T09:30:17
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[ { "name": "bug", "color": "d73a4a" } ]
false
[]
1,685,904,526
5,798
Support parallelized downloading and processing in load_dataset with Spark
### Feature request When calling `load_dataset` for datasets that have multiple files, support using Spark to distribute the downloading and processing job to worker nodes when `cache_dir` is a cloud file system shared among nodes. ```python load_dataset(..., use_spark=True) ``` ### Motivation Further speed up `dl_manager.download` and `_prepare_split` by distributing the workloads to worker nodes. ### Your contribution I can submit a PR to support this.
open
https://github.com/huggingface/datasets/issues/5798
2023-04-27T00:16:11
2023-05-25T14:11:41
null
{ "login": "es94129", "id": 12763339, "type": "User" }
[ { "name": "enhancement", "color": "a2eeef" } ]
false
[]
1,685,501,199
5,797
load_dataset is case sentitive?
### Describe the bug load_dataset() function is case sensitive? ### Steps to reproduce the bug The following two code, get totally different behavior. 1. load_dataset('mbzuai/bactrian-x','en') 2. load_dataset('MBZUAI/Bactrian-X','en') ### Expected behavior Compare 1 and 2. 1 will download all 52 subsets, shell output: ```Downloading and preparing dataset json/MBZUAI--bactrian-X to xxx``` 2 will only download single subset, shell output ```Downloading and preparing dataset bactrian-x/en to xxx``` ### Environment info Python 3.10.11 datasets Version: 2.11.0
open
https://github.com/huggingface/datasets/issues/5797
2023-04-26T18:19:04
2023-04-27T11:56:58
null
{ "login": "haonan-li", "id": 34729065, "type": "User" }
[]
false
[]
1,685,451,919
5,796
Spark docs
Added a "Use with Spark" doc page to document `Dataset.from_spark` following https://github.com/huggingface/datasets/pull/5701 cc @maddiedawson
closed
https://github.com/huggingface/datasets/pull/5796
2023-04-26T17:39:43
2023-04-27T16:41:50
2023-04-27T16:34:45
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,685,414,505
5,795
Fix spark imports
null
closed
https://github.com/huggingface/datasets/pull/5795
2023-04-26T17:09:32
2023-04-26T17:49:03
2023-04-26T17:39:12
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,685,196,061
5,794
CI ZeroDivisionError
Sometimes when running our CI on Windows, we get a ZeroDivisionError: ``` FAILED tests/test_metric_common.py::LocalMetricTest::test_load_metric_frugalscore - ZeroDivisionError: float division by zero ``` See for example: - https://github.com/huggingface/datasets/actions/runs/4809358266/jobs/8560513110 - https://github.com/huggingface/datasets/actions/runs/4798359836/jobs/8536573688 ``` _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ split = 'test', start_time = 1682516718.8236516, num_samples = 2, num_steps = 1 def speed_metrics(split, start_time, num_samples=None, num_steps=None): """ Measure and return speed performance metrics. This function requires a time snapshot `start_time` before the operation to be measured starts and this function should be run immediately after the operation to be measured has completed. Args: - split: name to prefix metric (like train, eval, test...) - start_time: operation start time - num_samples: number of samples processed """ runtime = time.time() - start_time result = {f"{split}_runtime": round(runtime, 4)} if num_samples is not None: > samples_per_second = num_samples / runtime E ZeroDivisionError: float division by zero C:\hostedtoolcache\windows\Python\3.7.9\x64\lib\site-packages\transformers\trainer_utils.py:354: ZeroDivisionError ```
closed
https://github.com/huggingface/datasets/issues/5794
2023-04-26T14:55:23
2024-05-17T09:12:11
2024-05-17T09:12:11
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[ { "name": "bug", "color": "d73a4a" } ]
false
[]
1,684,777,320
5,793
IterableDataset.with_format("torch") not working
### Describe the bug After calling the with_format("torch") method on an IterableDataset instance, the data format is unchanged. ### Steps to reproduce the bug ```python from datasets import IterableDataset def gen(): for i in range(4): yield {"a": [i] * 4} dataset = IterableDataset.from_generator(gen).with_format("torch") next(iter(dataset)) ``` ### Expected behavior `{"a": torch.tensor([0, 0, 0, 0])}` is expected, but `{"a": [0, 0, 0, 0]}` is observed. ### Environment info ```bash platform==ubuntu 22.04.01 python==3.10.9 datasets==2.11.0 ```
closed
https://github.com/huggingface/datasets/issues/5793
2023-04-26T10:50:23
2023-06-13T15:57:06
2023-06-13T15:57:06
{ "login": "jiangwangyi", "id": 39762734, "type": "User" }
[ { "name": "bug", "color": "d73a4a" }, { "name": "enhancement", "color": "a2eeef" }, { "name": "streaming", "color": "fef2c0" } ]
false
[]
1,683,473,943
5,791
TIFF/TIF support
### Feature request I currently have a dataset (with tiff and json files) where I have to do this: `wget path_to_data/images.zip && unzip images.zip` `wget path_to_data/annotations.zip && unzip annotations.zip` Would it make sense a contribution that supports these type of files? ### Motivation instead of using `load_dataset` have to use wget as these files are not supported for annotations with JSON and images with TIFF files. Additionally to this, the PIL formatting from datasets does not read correctly the image channels with TIFF format, besides multichannel adaptation might be necessary as well (as my data e.g has more than 3 channels) ### Your contribution 1. Support TIFF images over multi channel format 2. Support JSON annotations
closed
https://github.com/huggingface/datasets/issues/5791
2023-04-25T16:14:18
2024-01-15T16:40:33
2024-01-15T16:40:16
{ "login": "sebasmos", "id": 31293221, "type": "User" }
[ { "name": "enhancement", "color": "a2eeef" } ]
false
[]
1,683,229,126
5,790
Allow to run CI on push to ci-branch
This PR allows to run the CI on push to a branch named "ci-*", without needing to open a PR. - This will allow to make CI tests without opening a PR, e.g., for future `huggingface-hub` releases, future dependency releases (like `fsspec`, `pandas`,...) Note that to build the documentation, we already allow it on push to a branch named "doc-builder*". See: - #5788 CC: @Wauplin
closed
https://github.com/huggingface/datasets/pull/5790
2023-04-25T13:57:26
2023-04-26T13:43:08
2023-04-26T13:35:47
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
true
[]
1,682,611,179
5,789
Support streaming datasets that use jsonlines
Extend support for streaming datasets that use `jsonlines.open`. Currently, if `jsonlines` is installed, `datasets` raises a `FileNotFoundError`: ``` FileNotFoundError: [Errno 2] No such file or directory: 'https://...' ``` See: - https://huggingface.co/datasets/masakhane/afriqa/discussions/1
open
https://github.com/huggingface/datasets/issues/5789
2023-04-25T07:40:02
2023-04-25T07:40:03
null
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[ { "name": "enhancement", "color": "a2eeef" } ]
false
[]
1,681,136,256
5,788
Prepare tests for hfh 0.14
Related to the coming release of `huggingface_hub==0.14.0`. It will break some internal tests. The PR fixes these tests. Let's double-check the CI but I expect the fixed tests to be running fine with both `hfh<=0.13.4` and `hfh==0.14`. Worth case scenario, existing PRs will have to be rebased once this fix is merged. See related [discussion](https://huggingface.slack.com/archives/C02V5EA0A95/p1682337463368609?thread_ts=1681994202.635609&cid=C02V5EA0A95) (private slack). cc @lhoestq
closed
https://github.com/huggingface/datasets/pull/5788
2023-04-24T12:13:03
2023-04-25T14:32:56
2023-04-25T14:25:30
{ "login": "Wauplin", "id": 11801849, "type": "User" }
[]
true
[]
1,680,965,959
5,787
Fix inferring module for unsupported data files
This PR raises a FileNotFoundError instead: ``` FileNotFoundError: No (supported) data files or dataset script found in <dataset_name> ``` Fix #5785.
closed
https://github.com/huggingface/datasets/pull/5787
2023-04-24T10:44:50
2023-04-27T13:06:01
2023-04-27T12:57:28
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
true
[]
1,680,957,070
5,786
Multiprocessing in a `filter` or `map` function with a Pytorch model
### Describe the bug I am trying to use a Pytorch model loaded on CPUs with multiple processes with a `.map` or a `.filter` method. Usually, when dealing with models that are non-pickable, creating a class such that the `map` function is the method `__call__`, and adding `reduce` helps to solve the problem. However, here, the command hangs without throwing an error. ### Steps to reproduce the bug ``` from datasets import Dataset import torch from torch import nn from torchvision import models ​ ​ class FilterFunction: #__slots__ = ("path_model", "model") # Doesn't change anything uncommented def __init__(self, path_model): self.path_model = path_model model = models.resnet50() model.fc = nn.Sequential( nn.Linear(2048, 512), nn.ReLU(), nn.Dropout(0.2), nn.Linear(512, 10), nn.LogSoftmax(dim=1) ) model.load_state_dict(torch.load(path_model, map_location=torch.device("cpu"))) model.eval() self.model = model def __call__(self, batch): return [True] * len(batch["id"]) # Comment this to have an error def __reduce__(self): return (self.__class__, (self.path_model,)) ​ ​ dataset = Dataset.from_dict({"id": [0, 1, 2, 4]}) ​ # Download (100 MB) at https://github.com/emiliantolo/pytorch_nsfw_model/raw/master/ResNet50_nsfw_model.pth path_model = "/fsx/hugo/nsfw_image/ResNet50_nsfw_model.pth" ​ filter_function = FilterFunction(path_model=path_model) ​ # Works filtered_dataset = dataset.filter(filter_function, num_proc=1, batched=True, batch_size=2) # Doesn't work filtered_dataset = dataset.filter(filter_function, num_proc=2, batched=True, batch_size=2) ``` ### Expected behavior The command `filtered_dataset = dataset.filter(filter_function, num_proc=2, batched=True, batch_size=2)` should work and not hang. ### Environment info Datasets: 2.11.0 Pyarrow: 11.0.0 Ubuntu
closed
https://github.com/huggingface/datasets/issues/5786
2023-04-24T10:38:07
2023-05-30T09:56:30
2023-04-24T10:43:58
{ "login": "HugoLaurencon", "id": 44556846, "type": "User" }
[]
false
[]
1,680,956,964
5,785
Unsupported data files raise TypeError: 'NoneType' object is not iterable
Currently, we raise a TypeError for unsupported data files: ``` TypeError: 'NoneType' object is not iterable ``` See: - https://github.com/huggingface/datasets-server/issues/1073 We should give a more informative error message.
closed
https://github.com/huggingface/datasets/issues/5785
2023-04-24T10:38:03
2023-04-27T12:57:30
2023-04-27T12:57:30
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[ { "name": "bug", "color": "d73a4a" } ]
false
[]
1,680,950,726
5,784
Raise subprocesses traceback when interrupting
When a subprocess hangs in `filter` or `map`, one should be able to get the subprocess' traceback when interrupting the main process. Right now it shows nothing. To do so I `.get()` the subprocesses async results even the main process is stopped with e.g. `KeyboardInterrupt`. I added a timeout in case the subprocess is hanging or crashed.
closed
https://github.com/huggingface/datasets/pull/5784
2023-04-24T10:34:03
2023-04-26T16:04:42
2023-04-26T15:54:44
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,679,664,393
5,783
Offset overflow while doing regex on a text column
### Describe the bug `ArrowInvalid: offset overflow while concatenating arrays` Same error as [here](https://github.com/huggingface/datasets/issues/615) ### Steps to reproduce the bug Steps to reproduce: (dataset is a few GB big so try in colab maybe) ``` import datasets import re ds = datasets.load_dataset('nishanthc/dnd_map_dataset_v0.1', split = 'train') def get_text_caption(example): regex_pattern = r'\s\d+x\d+|,\sLQ|,\sgrid|\.\w+$' example['text_caption'] = re.sub(regex_pattern, '', example['picture_text']) return example ds = ds.map(get_text_caption) ``` I am trying to apply a regex to remove certain patterns from a text column. Not sure why this error is showing up. ### Expected behavior Dataset should have a new column with processed text ### Environment info Datasets version - 2.11.0
open
https://github.com/huggingface/datasets/issues/5783
2023-04-22T19:12:03
2023-09-22T06:44:07
null
{ "login": "nishanthcgit", "id": 5066268, "type": "User" }
[]
false
[]
1,679,622,367
5,782
Support for various audio-loading backends instead of always relying on SoundFile
### Feature request Introduce an option to select from a variety of audio-loading backends rather than solely relying on the SoundFile library. For instance, if the ffmpeg library is installed, it can serve as a fallback loading option. ### Motivation - The SoundFile library, used in [features/audio.py](https://github.com/huggingface/datasets/blob/649d5a3315f9e7666713b6affe318ee00c7163a0/src/datasets/features/audio.py#L185), supports only a [limited number of audio formats](https://pysoundfile.readthedocs.io/en/latest/index.html?highlight=supported#soundfile.available_formats). - However, current methods for creating audio datasets permit the inclusion of audio files in formats not supported by SoundFile. - As a result, developers may potentially create a dataset they cannot read back. In my most recent project, I dealt with phone call recordings in `.amr` or `.gsm` formats and was genuinely surprised when I couldn't read the dataset I had just packaged a minute prior. Nonetheless, I can still accurately read these files using the librosa library, which employs the audioread library that internally leverages ffmpeg to read such files. Example: ```python audio_dataset_amr = Dataset.from_dict({"audio": ["audio_samples/audio.amr"]}).cast_column("audio", Audio()) audio_dataset_amr.save_to_disk("audio_dataset_amr") audio_dataset_amr = Dataset.load_from_disk("audio_dataset_amr") print(audio_dataset_amr[0]) ``` Results in: ``` Traceback (most recent call last): ... raise LibsndfileError(err, prefix="Error opening {0!r}: ".format(self.name)) soundfile.LibsndfileError: Error opening <_io.BytesIO object at 0x7f316323e4d0>: Format not recognised. ``` While I acknowledge that support for these rare file types may not be a priority, I believe it's quite unfortunate that it's possible to create an unreadable dataset in this manner. ### Your contribution I've created a [simple demo repository](https://github.com/BoringDonut/hf-datasets-ffmpeg-audio) that highlights the mentioned issue. It demonstrates how to create an .amr dataset that results in an error when attempting to read it just a few lines later. Additionally, I've made a [fork with a rudimentary solution](https://github.com/BoringDonut/datasets/blob/fea73a8fbbc8876467c7e6422c9360546c6372d8/src/datasets/features/audio.py#L189) that utilizes ffmpeg to load files not supported by SoundFile. Here you may see github actions fails to read `.amr` dataset using the version of the current dataset, but will work with the patched version: - https://github.com/BoringDonut/hf-datasets-ffmpeg-audio/actions/runs/4773780420/jobs/8487063785 - https://github.com/BoringDonut/hf-datasets-ffmpeg-audio/actions/runs/4773780420/jobs/8487063829 As evident from the GitHub action above, this solution resolves the previously mentioned problem. I'd be happy to create a proper pull request, provide runtime benchmarks and tests if you could offer some guidance on the following: - Where should I incorporate the ffmpeg (or other backends) code? For example, should I create a new file or simply add a function within the Audio class? - Is it feasible to pass the audio-loading function as an argument within the current architecture? This would be useful if I know in advance that I'll be reading files not supported by SoundFile. A few more notes: - In theory, it's possible to load audio using librosa/audioread since librosa is already expected to be installed. However, librosa [will soon discontinue audioread support](https://github.com/librosa/librosa/blob/aacb4c134002903ae56bbd4b4a330519a5abacc0/librosa/core/audio.py#L227). Moreover, using audioread on its own seems inconvenient because it requires a file [path as input](https://github.com/beetbox/audioread/blob/ff9535df934c48038af7be9617fdebb12078cc07/audioread/__init__.py#L108) and cannot work with bytes already loaded into memory or an open file descriptor (as mentioned in [librosa docs](https://librosa.org/doc/main/generated/librosa.load.html#librosa.load), only SoundFile backend supports an open file descriptor as an input).
closed
https://github.com/huggingface/datasets/issues/5782
2023-04-22T17:09:25
2023-05-10T20:23:04
2023-05-10T20:23:04
{ "login": "BoringDonut", "id": 129098876, "type": "User" }
[ { "name": "enhancement", "color": "a2eeef" } ]
false
[]
1,679,580,460
5,781
Error using `load_datasets`
### Describe the bug I tried to load a dataset using the `datasets` library in a conda jupyter notebook and got the below error. ``` ImportError: dlopen(/Users/gilbertyoung/miniforge3/envs/review_sense/lib/python3.8/site-packages/scipy/sparse/linalg/_isolve/_iterative.cpython-38-darwin.so, 0x0002): Library not loaded: @rpath/liblapack.3.dylib Referenced from: <65B094A2-59D7-31AC-A966-4DB9E11D2A15> /Users/gilbertyoung/miniforge3/envs/review_sense/lib/python3.8/site-packages/scipy/sparse/linalg/_isolve/_iterative.cpython-38-darwin.so Reason: tried: '/Users/gilbertyoung/miniforge3/envs/review_sense/lib/python3.8/site-packages/scipy/sparse/linalg/_isolve/liblapack.3.dylib' (no such file), '/Users/gilbertyoung/miniforge3/envs/review_sense/lib/python3.8/site-packages/scipy/sparse/linalg/_isolve/../../../../../../liblapack.3.dylib' (no such file), '/Users/gilbertyoung/miniforge3/envs/review_sense/lib/python3.8/site-packages/scipy/sparse/linalg/_isolve/liblapack.3.dylib' (no such file), '/Users/gilbertyoung/miniforge3/envs/review_sense/lib/python3.8/site-packages/scipy/sparse/linalg/_isolve/../../../../../../liblapack.3.dylib' (no such file), '/Users/gilbertyoung/miniforge3/envs/review_sense/bin/../lib/liblapack.3.dylib' (no such file), '/Users/gilbertyoung/miniforge3/envs/review_sense/bin/../lib/liblapack.3.dylib' (no such file), '/usr/local/lib/liblapack.3.dylib' (no such file), '/usr/lib/liblapack.3.dylib' (no such file, not in dyld cache) ``` ### Steps to reproduce the bug Run the `load_datasets` function ### Expected behavior I expected the dataset to be loaded into my notebook. ### Environment info name: review_sense channels: - apple - conda-forge dependencies: - python=3.8 - pip>=19.0 - jupyter - tensorflow-deps #- scikit-learn #- scipy - pandas - pandas-datareader - matplotlib - pillow - tqdm - requests - h5py - pyyaml - flask - boto3 - ipykernel - seaborn - pip: - tensorflow-macos==2.9 - tensorflow-metal==0.5.0 - bayesian-optimization - gym - kaggle - huggingface_hub - datasets - numpy - huggingface
closed
https://github.com/huggingface/datasets/issues/5781
2023-04-22T15:10:44
2023-05-02T23:41:25
2023-05-02T23:41:25
{ "login": "gjyoungjr", "id": 61463108, "type": "User" }
[]
false
[]
1,679,367,149
5,780
TypeError: 'NoneType' object does not support item assignment
command: ``` def load_datasets(formats, data_dir=datadir, data_files=datafile): dataset = load_dataset(formats, data_dir=datadir, data_files=datafile, split=split, streaming=True, **kwargs) return dataset raw_datasets = DatasetDict() raw_datasets["train"] = load_datasets(“csv”, args.datadir, "train.csv", split=train_split) raw_datasets["test"] = load_datasets(“csv”, args.datadir, "dev.csv", split=test_split) raw_datasets = raw_datasets.cast_column("audio", Audio(sampling_rate=16000)) ``` error: ``` main() File "peft_adalora_whisper_large_training.py", line 502, in main raw_datasets = raw_datasets.cast_column("audio", Audio(sampling_rate=16000)) File "/home/ybZhang/miniconda3/envs/whister/lib/python3.8/site-packages/datasets/dataset_dict.py", line 2015, in cast_column info.features[column] = feature TypeError: 'NoneType' object does not support item assignment ```
closed
https://github.com/huggingface/datasets/issues/5780
2023-04-22T06:22:43
2023-04-23T08:49:18
2023-04-23T08:49:18
{ "login": "ben-8878", "id": 38179632, "type": "User" }
[]
false
[]
1,678,669,865
5,779
Call fs.makedirs in save_to_disk
We need to call `fs.makedirs` when saving a dataset using `save_to_disk`, because some fs implementations have actual directories (S3 and others don't) Close https://github.com/huggingface/datasets/issues/5775
closed
https://github.com/huggingface/datasets/pull/5779
2023-04-21T15:04:28
2023-04-26T12:20:01
2023-04-26T12:11:15
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,678,125,951
5,778
Schrödinger's dataset_dict
### Describe the bug If you use load_dataset('json', data_files="path/test.json"), it will return DatasetDict({train:...}). And if you use load_dataset("path"), it will return DatasetDict({test:...}). Why can't the output behavior be unified? ### Steps to reproduce the bug as description above. ### Expected behavior consistent predictable output. ### Environment info '2.11.0'
closed
https://github.com/huggingface/datasets/issues/5778
2023-04-21T08:38:12
2023-07-24T15:15:14
2023-07-24T15:15:14
{ "login": "liujuncn", "id": 902005, "type": "User" }
[]
false
[]
1,677,655,969
5,777
datasets.load_dataset("code_search_net", "python") : NotADirectoryError: [Errno 20] Not a directory
### Describe the bug While checking out the [tokenizer tutorial](https://huggingface.co/course/chapter6/2?fw=pt), i noticed getting an error while initially downloading the python dataset used in the examples. The [collab with the error is here](https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/en/chapter6/section2.ipynb#scrollTo=hGb69Yo3eV8S) ``` from datasets import load_dataset import os os.environ["HF_DATASETS_CACHE"] = "/workspace" # This can take a few minutes to load, so grab a coffee or tea while you wait! raw_datasets = load_dataset("code_search_net", "python") ``` yeilds: ``` ile /opt/conda/lib/python3.10/site-packages/datasets/download/streaming_download_manager.py:524, in xlistdir(path, use_auth_token) 522 main_hop, *rest_hops = _as_str(path).split("::") 523 if is_local_path(main_hop): --> 524 return os.listdir(path) 525 else: 526 # globbing inside a zip in a private repo requires authentication 527 if not rest_hops and (main_hop.startswith("http://") or main_hop.startswith("https://")): NotADirectoryError: [Errno 20] Not a directory: '/workspace/downloads/25ceeb4c25ab737d688bd56ea92bfbb1f199fe572470456cf2d675479f342ac7/python/final/jsonl/train' ``` I was able to reproduce this erro both in the collab and on my own pytorch/pytorch container pulled from the dockerhub official pytorch image, so i think it may be a server side thing. ### Steps to reproduce the bug Steps to reproduce the issue: 1. run `raw_datasets = load_dataset("code_search_net", "python")` ### Expected behavior expect the code to not exception during dataset pull. ### Environment info i tried both the default HF_DATASETS_CACHE on Collab, and on my local container. i then pointed to the HF_DATASETS_CACHE to a large capacity local storage and the problem was consisten across all 3 scenarios.
closed
https://github.com/huggingface/datasets/issues/5777
2023-04-21T02:08:07
2023-06-05T05:49:52
2023-05-11T11:51:56
{ "login": "ghost", "id": 10137, "type": "User" }
[]
false
[]
1,677,116,100
5,776
Use Pandas' `read_json` in the JSON builder
Instead of PyArrow's `read_json`, we should use `pd.read_json` in the JSON builder for consistency with the CSV and SQL builders (e.g., to address https://github.com/huggingface/datasets/issues/5725). In Pandas2.0, to get the same performance, we can set the `engine` to "pyarrow". The issue is that Colab still doesn't install Pandas 2.0 by default, so I think it's best to wait for this to be resolved on their side to avoid downgrading decoding performance in scenarios when Pandas 2.0 is not installed.
open
https://github.com/huggingface/datasets/issues/5776
2023-04-20T17:15:49
2023-04-20T17:15:49
null
{ "login": "mariosasko", "id": 47462742, "type": "User" }
[ { "name": "enhancement", "color": "a2eeef" } ]
false
[]
1,677,089,901
5,775
ArrowDataset.save_to_disk lost some logic of remote
### Describe the bug https://github.com/huggingface/datasets/blob/e7ce0ac60c7efc10886471932854903a7c19f172/src/datasets/arrow_dataset.py#L1371 Here is the bug point, when I want to save from a `DatasetDict` class and the items of the instance is like `[('train', Dataset({features: ..., num_rows: ...}))]` , there is no guarantee that there exists a directory name `train` under `dataset_dict_path`. ### Steps to reproduce the bug 1. Mock a DatasetDict with items like what I said. 2. using save_to_disk with storage_options, u can use local sftp. code may like below ```python from datasets import load_dataset dataset = load_dataset(...) dataset.save_to_disk('sftp:///tmp', storage_options={'host': 'localhost', 'username': 'admin'}) ``` I suppose u can reproduce the bug by these steps. ### Expected behavior Should create the folder if it does not exists, just like we do locally. ### Environment info - `datasets` version: 2.11.0 - Platform: Linux-6.2.10-arch1-1-x86_64-with-glibc2.35 - Python version: 3.10.9 - Huggingface_hub version: 0.13.2 - PyArrow version: 11.0.0 - Pandas version: 1.5.3
closed
https://github.com/huggingface/datasets/issues/5775
2023-04-20T16:58:01
2023-04-26T12:11:36
2023-04-26T12:11:17
{ "login": "Zoupers", "id": 29817738, "type": "User" }
[]
false
[]
1,676,716,662
5,774
Fix style
Fix C419 issues
closed
https://github.com/huggingface/datasets/pull/5774
2023-04-20T13:21:32
2023-04-20T13:34:26
2023-04-20T13:24:28
{ "login": "lhoestq", "id": 42851186, "type": "User" }
[]
true
[]
1,675,984,633
5,773
train_dataset does not implement __len__
when train using data precessored by the datasets, I get follow warning and it leads to that I can not set epoch numbers: `ValueError: The train_dataset does not implement __len__, max_steps has to be specified. The number of steps needs to be known in advance for the learning rate scheduler.`
open
https://github.com/huggingface/datasets/issues/5773
2023-04-20T04:37:05
2023-07-19T20:33:13
null
{ "login": "ben-8878", "id": 38179632, "type": "User" }
[]
false
[]
1,675,033,510
5,772
Fix JSON builder when missing keys in first row
Until now, the JSON builder only considered the keys present in the first element of the list: - Either explicitly: by passing index 0 in `dataset[0].keys()` - Or implicitly: `pa.Table.from_pylist(dataset)`, where "schema (default None): If not passed, will be inferred from the first row of the mapping values" This PR fixes the bug by considering the union of the keys present in all the rows. Fix #5726.
closed
https://github.com/huggingface/datasets/pull/5772
2023-04-19T14:32:57
2023-04-21T06:45:13
2023-04-21T06:35:27
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
true
[]
1,674,828,380
5,771
Support cloud storage for loading datasets
### Feature request It seems that the the current implementation supports cloud storage only for `load_from_disk`. It would be nice if a similar functionality existed in `load_dataset`. ### Motivation Motivation is pretty clear -- let users work with datasets located in the cloud. ### Your contribution I can help implementing this.
closed
https://github.com/huggingface/datasets/issues/5771
2023-04-19T12:43:53
2023-05-07T17:47:41
2023-05-07T17:47:41
{ "login": "eli-osherovich", "id": 2437102, "type": "User" }
[ { "name": "duplicate", "color": "cfd3d7" }, { "name": "enhancement", "color": "a2eeef" } ]
false
[]
1,673,581,555
5,770
Add IterableDataset.from_spark
Follow-up from https://github.com/huggingface/datasets/pull/5701 Related issue: https://github.com/huggingface/datasets/issues/5678
closed
https://github.com/huggingface/datasets/pull/5770
2023-04-18T17:47:53
2023-05-17T14:07:32
2023-05-17T14:00:38
{ "login": "maddiedawson", "id": 106995444, "type": "User" }
[]
true
[]
1,673,441,182
5,769
Tiktoken tokenizers are not pickable
### Describe the bug Since tiktoken tokenizer is not pickable, it is not possible to use it inside `dataset.map()` with multiprocessing enabled. However, you [made](https://github.com/huggingface/datasets/issues/5536) tiktoken's tokenizers pickable in `datasets==2.10.0` for caching. For some reason, this logic does not work in dataset processing and raises `TypeError: cannot pickle 'builtins.CoreBPE' object` ### Steps to reproduce the bug ``` from datasets import load_dataset import tiktoken dataset = load_dataset("stas/openwebtext-10k") enc = tiktoken.get_encoding("gpt2") tokenized = dataset.map( process, remove_columns=['text'], desc="tokenizing the OWT splits", num_proc=2, ) def process(example): ids = enc.encode(example['text']) ids.append(enc.eot_token) out = {'ids': ids, 'len': len(ids)} return out ``` ### Expected behavior starts processing dataset ### Environment info - `datasets` version: 2.11.0 - Platform: Linux-5.15.0-1021-oracle-x86_64-with-glibc2.29 - Python version: 3.8.10 - Huggingface_hub version: 0.13.4 - PyArrow version: 9.0.0 - Pandas version: 2.0.0
closed
https://github.com/huggingface/datasets/issues/5769
2023-04-18T16:07:40
2023-05-04T18:55:57
2023-05-04T18:55:57
{ "login": "markovalexander", "id": 22663468, "type": "User" }
[]
false
[]
1,672,494,561
5,768
load_dataset("squad") doesn't work in 2.7.1 and 2.10.1
### Describe the bug There is an issue that seems to be unique to the "squad" dataset, in which it cannot be loaded using standard methods. This issue is most quickly reproduced from the command line, using the HF examples to verify a dataset is loaded properly. This is not a problem with "squad_v2" dataset for example. ### Steps to reproduce the bug cmd line > $ python -c "from datasets import load_dataset; print(load_dataset('squad', split='train')[0])" OR Python IDE > from datasets import load_dataset > load_dataset("squad") ### Expected behavior I expected to either see the output described here from running the very same command in command line ([https://huggingface.co/docs/datasets/installation]), or any output that does not raise Python's TypeError. There is some funky behaviour in the dataset builder portion of the codebase that means it is trying to import the squad dataset with an incorrect path, or the squad dataset couldn't be downloaded. I'm not really sure what the problem is beyond that. Messing around with caching I did manage to get it to load the dataset once, and then couldn't repeat this. ### Environment info datasets=2.7.1 **or** 2.10.1, python=3.10.8, Linux 3.10.0-1160.36.2.el7.x86_64 **or** Windows 10-64
closed
https://github.com/huggingface/datasets/issues/5768
2023-04-18T07:10:56
2023-04-20T10:27:23
2023-04-20T10:27:22
{ "login": "yaseen157", "id": 57412770, "type": "User" }
[]
false
[]
1,672,433,979
5,767
How to use Distill-BERT with different datasets?
### Describe the bug - `transformers` version: 4.11.3 - Platform: Linux-5.4.0-58-generic-x86_64-with-glibc2.29 - Python version: 3.8.10 - PyTorch version (GPU?): 1.12.0+cu102 (True) - Tensorflow version (GPU?): 2.10.0 (True) - Flax version (CPU?/GPU?/TPU?): not installed (NA) - Jax version: not installed - JaxLib version: not installed - Using GPU in script?: <fill in> - Using distributed or parallel set-up in script?: <fill in> ### Steps to reproduce the bug I recently read [this](https://huggingface.co/docs/transformers/quicktour#train-with-tensorflow:~:text=The%20most%20important%20thing%20to%20remember%20is%20you%20need%20to%20instantiate%20a%20tokenizer%20with%20the%20same%20model%20name%20to%20ensure%20you%E2%80%99re%20using%20the%20same%20tokenization%20rules%20a%20model%20was%20pretrained%20with.) and was wondering how to use distill-BERT (which is pre-trained with imdb dataset) with a different dataset (for eg. [this](https://huggingface.co/datasets/yhavinga/imdb_dutch) dataset)? ### Expected behavior Distill-BERT should work with different datasets. ### Environment info - `datasets` version: 1.12.1 - Platform: Linux-5.4.0-58-generic-x86_64-with-glibc2.29 - Python version: 3.8.10 - PyArrow version: 11.0.0
closed
https://github.com/huggingface/datasets/issues/5767
2023-04-18T06:25:12
2023-04-20T16:52:05
2023-04-20T16:52:05
{ "login": "sauravtii", "id": 109907638, "type": "User" }
[]
false
[]
1,671,485,882
5,766
Support custom feature types
### Feature request I think it would be nice to allow registering custom feature types with the 🤗 Datasets library. For example, allow to do something along the following lines: ``` from datasets.features import register_feature_type # this would be a new function @register_feature_type class CustomFeatureType: def encode_example(self, value): """User-provided logic to encode an example of this feature.""" pass def decode_example(self, value, token_per_repo_id=None): """User-provided logic to decode an example of this feature.""" pass ``` ### Motivation Users of 🤗 Datasets, such as myself, may want to use the library to load datasets with unsupported feature types (i.e., beyond `ClassLabel`, `Image`, or `Audio`). This would be useful for prototyping new feature types and for feature types that aren't used widely enough to warrant inclusion in 🤗 Datasets. At the moment, this is only possible by monkey-patching 🤗 Datasets, which obfuscates the code and is prone to breaking with library updates. It also requires the user to write some custom code which could be easily avoided. ### Your contribution I would be happy to contribute this feature. My proposed solution would involve changing the following call to `globals()` to an explicit feature type registry, which a user-facing `register_feature_type` decorator could update. https://github.com/huggingface/datasets/blob/fd893098627230cc734f6009ad04cf885c979ac4/src/datasets/features/features.py#L1329 I would also provide an abstract base class for custom feature types which users could inherit. This would have at least an `encode_example` method and a `decode_example` method, similar to `Image` or `Audio`. The existing `encode_nested_example` and `decode_nested_example` functions would also need to be updated to correctly call the corresponding functions for the new type.
open
https://github.com/huggingface/datasets/issues/5766
2023-04-17T15:46:41
2024-03-10T11:11:22
null
{ "login": "jmontalt", "id": 37540982, "type": "User" }
[ { "name": "enhancement", "color": "a2eeef" } ]
false
[]
1,671,388,824
5,765
ValueError: You should supply an encoding or a list of encodings to this method that includes input_ids, but you provided ['text']
### Describe the bug Following is my code that I am trying to run, but facing an error (have attached the whole error below): My code: ``` from collections import OrderedDict import warnings import flwr as fl import torch import numpy as np import random from torch.utils.data import DataLoader from datasets import load_dataset, load_metric from transformers import AutoTokenizer, DataCollatorWithPadding from transformers import AutoModelForSequenceClassification from transformers import AdamW #from transformers import tokenized_datasets warnings.filterwarnings("ignore", category=UserWarning) # DEVICE = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") DEVICE = "cpu" CHECKPOINT = "distilbert-base-uncased" # transformer model checkpoint def load_data(): """Load IMDB data (training and eval)""" raw_datasets = load_dataset("yhavinga/imdb_dutch") raw_datasets = raw_datasets.shuffle(seed=42) # remove unnecessary data split del raw_datasets["unsupervised"] tokenizer = AutoTokenizer.from_pretrained(CHECKPOINT) def tokenize_function(examples): return tokenizer(examples["text"], truncation=True) # random 100 samples population = random.sample(range(len(raw_datasets["train"])), 100) tokenized_datasets = raw_datasets.map(tokenize_function, batched=True) tokenized_datasets["train"] = tokenized_datasets["train"].select(population) tokenized_datasets["test"] = tokenized_datasets["test"].select(population) # tokenized_datasets = tokenized_datasets.remove_columns("text") # tokenized_datasets = tokenized_datasets.rename_column("label", "labels") tokenized_datasets = tokenized_datasets.remove_columns("attention_mask") tokenized_datasets = tokenized_datasets.remove_columns("input_ids") tokenized_datasets = tokenized_datasets.remove_columns("label") tokenized_datasets = tokenized_datasets.remove_columns("text_en") # tokenized_datasets = tokenized_datasets.remove_columns(raw_datasets["train"].column_names) data_collator = DataCollatorWithPadding(tokenizer=tokenizer) trainloader = DataLoader( tokenized_datasets["train"], shuffle=True, batch_size=32, collate_fn=data_collator, ) testloader = DataLoader( tokenized_datasets["test"], batch_size=32, collate_fn=data_collator ) return trainloader, testloader def train(net, trainloader, epochs): optimizer = AdamW(net.parameters(), lr=5e-4) net.train() for _ in range(epochs): for batch in trainloader: batch = {k: v.to(DEVICE) for k, v in batch.items()} outputs = net(**batch) loss = outputs.loss loss.backward() optimizer.step() optimizer.zero_grad() def test(net, testloader): metric = load_metric("accuracy") loss = 0 net.eval() for batch in testloader: batch = {k: v.to(DEVICE) for k, v in batch.items()} with torch.no_grad(): outputs = net(**batch) logits = outputs.logits loss += outputs.loss.item() predictions = torch.argmax(logits, dim=-1) metric.add_batch(predictions=predictions, references=batch["labels"]) loss /= len(testloader.dataset) accuracy = metric.compute()["accuracy"] return loss, accuracy def main(): net = AutoModelForSequenceClassification.from_pretrained( CHECKPOINT, num_labels=2 ).to(DEVICE) trainloader, testloader = load_data() # Flower client class IMDBClient(fl.client.NumPyClient): def get_parameters(self, config): return [val.cpu().numpy() for _, val in net.state_dict().items()] def set_parameters(self, parameters): params_dict = zip(net.state_dict().keys(), parameters) state_dict = OrderedDict({k: torch.Tensor(v) for k, v in params_dict}) net.load_state_dict(state_dict, strict=True) def fit(self, parameters, config): self.set_parameters(parameters) print("Training Started...") train(net, trainloader, epochs=1) print("Training Finished.") return self.get_parameters(config={}), len(trainloader), {} def evaluate(self, parameters, config): self.set_parameters(parameters) loss, accuracy = test(net, testloader) return float(loss), len(testloader), {"accuracy": float(accuracy)} # Start client fl.client.start_numpy_client(server_address="localhost:8080", client=IMDBClient()) if __name__ == "__main__": main() ``` Error: ``` Traceback (most recent call last): File "client_2.py", line 136, in <module> main() File "client_2.py", line 132, in main fl.client.start_numpy_client(server_address="localhost:8080", client=IMDBClient()) File "/home/saurav/.local/lib/python3.8/site-packages/flwr/client/app.py", line 208, in start_numpy_client start_client( File "/home/saurav/.local/lib/python3.8/site-packages/flwr/client/app.py", line 142, in start_client client_message, sleep_duration, keep_going = handle( File "/home/saurav/.local/lib/python3.8/site-packages/flwr/client/grpc_client/message_handler.py", line 68, in handle return _fit(client, server_msg.fit_ins), 0, True File "/home/saurav/.local/lib/python3.8/site-packages/flwr/client/grpc_client/message_handler.py", line 157, in _fit fit_res = client.fit(fit_ins) File "/home/saurav/.local/lib/python3.8/site-packages/flwr/client/app.py", line 252, in _fit results = self.numpy_client.fit(parameters, ins.config) # type: ignore File "client_2.py", line 122, in fit train(net, trainloader, epochs=1) File "client_2.py", line 76, in train for batch in trainloader: File "/home/saurav/.local/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 652, in __next__ data = self._next_data() File "/home/saurav/.local/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 692, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/home/saurav/.local/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 52, in fetch return self.collate_fn(data) File "/home/saurav/.local/lib/python3.8/site-packages/transformers/data/data_collator.py", line 221, in __call__ batch = self.tokenizer.pad( File "/home/saurav/.local/lib/python3.8/site-packages/transformers/tokenization_utils_base.py", line 2713, in pad raise ValueError( ValueError: You should supply an encoding or a list of encodings to this method that includes input_ids, but you provided ['text'] ``` ### Steps to reproduce the bug Run the above code. ### Expected behavior Don't know, doing it for the first time. ### Environment info - `datasets` version: 1.12.1 - Platform: Linux-5.4.0-58-generic-x86_64-with-glibc2.29 - Python version: 3.8.10 - PyArrow version: 11.0.0
open
https://github.com/huggingface/datasets/issues/5765
2023-04-17T15:00:50
2023-04-25T13:50:45
null
{ "login": "sauravtii", "id": 109907638, "type": "User" }
[]
false
[]
1,670,740,198
5,764
ConnectionError: Couldn't reach https://www.dropbox.com/s/zts98j4vkqtsns6/aclImdb_v2.tar?dl=1
### Describe the bug I want to use this (https://huggingface.co/datasets/josianem/imdb) dataset therefore I am trying to load it using the following code: ``` dataset = load_dataset("josianem/imdb") ``` The dataset is not getting loaded and gives the error message as the following: ``` Traceback (most recent call last): File "sample.py", line 3, in <module> dataset = load_dataset("josianem/imdb") File "/home/saurav/.local/lib/python3.8/site-packages/datasets/load.py", line 1112, in load_dataset builder_instance.download_and_prepare( File "/home/saurav/.local/lib/python3.8/site-packages/datasets/builder.py", line 636, in download_and_prepare self._download_and_prepare( File "/home/saurav/.local/lib/python3.8/site-packages/datasets/builder.py", line 704, in _download_and_prepare split_generators = self._split_generators(dl_manager, **split_generators_kwargs) File "/home/saurav/.cache/huggingface/modules/datasets_modules/datasets/imdb/cc6ab4acab2799be15d5d217c24548b856156dafdc850165fdc4f2031f27ff2f/imdb.py", line 79, in _split_generators archive = dl_manager.download(_DOWNLOAD_URL) File "/home/saurav/.local/lib/python3.8/site-packages/datasets/utils/download_manager.py", line 196, in download downloaded_path_or_paths = map_nested( File "/home/saurav/.local/lib/python3.8/site-packages/datasets/utils/py_utils.py", line 197, in map_nested return function(data_struct) File "/home/saurav/.local/lib/python3.8/site-packages/datasets/utils/download_manager.py", line 217, in _download return cached_path(url_or_filename, download_config=download_config) File "/home/saurav/.local/lib/python3.8/site-packages/datasets/utils/file_utils.py", line 289, in cached_path output_path = get_from_cache( File "/home/saurav/.local/lib/python3.8/site-packages/datasets/utils/file_utils.py", line 606, in get_from_cache raise ConnectionError("Couldn't reach {}".format(url)) ConnectionError: Couldn't reach https://www.dropbox.com/s/zts98j4vkqtsns6/aclImdb_v2.tar?dl=1 ``` ### Steps to reproduce the bug You can reproduce the error by using the following code: ``` from datasets import load_dataset, load_metric dataset = load_dataset("josianem/imdb") ``` ### Expected behavior The dataset should get loaded (I am using this dataset for the first time so not much aware of the exact behavior). ### Environment info - `datasets` version: 1.12.1 - Platform: Linux-5.4.0-58-generic-x86_64-with-glibc2.29 - Python version: 3.8.10 - PyArrow version: 11.0.0
closed
https://github.com/huggingface/datasets/issues/5764
2023-04-17T09:08:18
2023-04-18T07:18:20
2023-04-18T07:18:20
{ "login": "sauravtii", "id": 109907638, "type": "User" }
[]
false
[]
1,670,476,302
5,763
fix typo: "mow" -> "now"
I noticed a typo as I was reading the datasets documentation. This PR contains a trivial fix changing "mow" to "now."
closed
https://github.com/huggingface/datasets/pull/5763
2023-04-17T06:03:44
2023-04-17T15:01:53
2023-04-17T14:54:46
{ "login": "csris", "id": 1967608, "type": "User" }
[]
true
[]
1,670,326,470
5,762
Not able to load the pile
### Describe the bug Got this error when I am trying to load the pile dataset ``` TypeError: Couldn't cast array of type struct<file: string, id: string> to {'id': Value(dtype='string', id=None)} ``` ### Steps to reproduce the bug Please visit the following sample notebook https://colab.research.google.com/drive/1JHcjawcHL6QHhi5VcqYd07W2QCEj2nWK#scrollTo=ulJP3eJCI-tB ### Expected behavior The pile should work ### Environment info - `datasets` version: 2.11.0 - Platform: Linux-5.10.147+-x86_64-with-glibc2.31 - Python version: 3.9.16 - Huggingface_hub version: 0.13.4 - PyArrow version: 9.0.0 - Pandas version: 1.5.3
closed
https://github.com/huggingface/datasets/issues/5762
2023-04-17T03:09:10
2023-04-17T09:37:27
2023-04-17T09:37:27
{ "login": "surya-narayanan", "id": 17240858, "type": "User" }
[]
false
[]
1,670,034,582
5,761
One or several metadata.jsonl were found, but not in the same directory or in a parent directory
### Describe the bug An attempt to generate a dataset from a zip archive using imagefolder and metadata.jsonl does not lead to the expected result. Tried all possible locations of the json file: the file in the archive is ignored (generated dataset contains only images), the file next to the archive like [here](https://huggingface.co/docs/datasets/image_dataset#imagefolder) leads to an error: ``` --------------------------------------------------------------------------- ValueError Traceback (most recent call last) File ~\PycharmProjects\testproj\venv\lib\site-packages\datasets\builder.py:1610, in GeneratorBasedBuilder._prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id) 1609 _time = time.time() -> 1610 for key, record in generator: 1611 if max_shard_size is not None and writer._num_bytes > max_shard_size: File ~\PycharmProjects\testproj\venv\lib\site-packages\datasets\packaged_modules\folder_based_builder\folder_based_builder.py:370, in FolderBasedBuilder._generate_examples(self, files, metadata_files, split_name, add_metadata, add_labels) 369 else: --> 370 raise ValueError( 371 f"One or several metadata.{metadata_ext} were found, but not in the same directory or in a parent directory of {downloaded_dir_file}." 372 ) 373 if metadata_dir is not None and downloaded_metadata_file is not None: ValueError: One or several metadata.jsonl were found, but not in the same directory or in a parent directory of C:\Users\User\.cache\huggingface\datasets\downloads\extracted\f7fb7de25fb28ae63089974524f2d271a39d83888bc456d04aa3b3d45f33e6a6\ff0745a0-a741-4d9e-b228-a93b851adf61.png. The above exception was the direct cause of the following exception: DatasetGenerationError Traceback (most recent call last) Cell In[3], line 1 ----> 1 dataset = load_dataset("imagefolder", data_dir=r'C:\Users\User\data') File ~\PycharmProjects\testproj\venv\lib\site-packages\datasets\load.py:1791, 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, use_auth_token, task, streaming, num_proc, storage_options, **config_kwargs) 1788 try_from_hf_gcs = path not in _PACKAGED_DATASETS_MODULES 1790 # Download and prepare data -> 1791 builder_instance.download_and_prepare( 1792 download_config=download_config, 1793 download_mode=download_mode, 1794 verification_mode=verification_mode, 1795 try_from_hf_gcs=try_from_hf_gcs, 1796 num_proc=num_proc, 1797 storage_options=storage_options, 1798 ) 1800 # Build dataset for splits 1801 keep_in_memory = ( 1802 keep_in_memory if keep_in_memory is not None else is_small_dataset(builder_instance.info.dataset_size) 1803 ) File ~\PycharmProjects\testproj\venv\lib\site-packages\datasets\builder.py:891, in DatasetBuilder.download_and_prepare(self, output_dir, download_config, download_mode, verification_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, file_format, max_shard_size, num_proc, storage_options, **download_and_prepare_kwargs) 889 if num_proc is not None: 890 prepare_split_kwargs["num_proc"] = num_proc --> 891 self._download_and_prepare( 892 dl_manager=dl_manager, 893 verification_mode=verification_mode, 894 **prepare_split_kwargs, 895 **download_and_prepare_kwargs, 896 ) 897 # Sync info 898 self.info.dataset_size = sum(split.num_bytes for split in self.info.splits.values()) File ~\PycharmProjects\testproj\venv\lib\site-packages\datasets\builder.py:1651, in GeneratorBasedBuilder._download_and_prepare(self, dl_manager, verification_mode, **prepare_splits_kwargs) 1650 def _download_and_prepare(self, dl_manager, verification_mode, **prepare_splits_kwargs): -> 1651 super()._download_and_prepare( 1652 dl_manager, 1653 verification_mode, 1654 check_duplicate_keys=verification_mode == VerificationMode.BASIC_CHECKS 1655 or verification_mode == VerificationMode.ALL_CHECKS, 1656 **prepare_splits_kwargs, 1657 ) File ~\PycharmProjects\testproj\venv\lib\site-packages\datasets\builder.py:986, in DatasetBuilder._download_and_prepare(self, dl_manager, verification_mode, **prepare_split_kwargs) 982 split_dict.add(split_generator.split_info) 984 try: 985 # Prepare split will record examples associated to the split --> 986 self._prepare_split(split_generator, **prepare_split_kwargs) 987 except OSError as e: 988 raise OSError( 989 "Cannot find data file. " 990 + (self.manual_download_instructions or "") 991 + "\nOriginal error:\n" 992 + str(e) 993 ) from None File ~\PycharmProjects\testproj\venv\lib\site-packages\datasets\builder.py:1490, in GeneratorBasedBuilder._prepare_split(self, split_generator, check_duplicate_keys, file_format, num_proc, max_shard_size) 1488 gen_kwargs = split_generator.gen_kwargs 1489 job_id = 0 -> 1490 for job_id, done, content in self._prepare_split_single( 1491 gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args 1492 ): 1493 if done: 1494 result = content File ~\PycharmProjects\testproj\venv\lib\site-packages\datasets\builder.py:1646, in GeneratorBasedBuilder._prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id) 1644 if isinstance(e, SchemaInferenceError) and e.__context__ is not None: 1645 e = e.__context__ -> 1646 raise DatasetGenerationError("An error occurred while generating the dataset") from e 1648 yield job_id, True, (total_num_examples, total_num_bytes, writer._features, num_shards, shard_lengths) DatasetGenerationError: An error occurred while generating the dataset ``` ### Steps to reproduce the bug 1. Organize directory structure like in the docs: folder/metadata.jsonl folder/train.zip 2. Run load_dataset("imagefolder", data_dir='folder/metadata.jsonl', split='train') ### Expected behavior Dataset generated with all additional features from metadata.jsonl ### Environment info - `datasets` version: 2.11.0 - Platform: Windows-10-10.0.22621-SP0 - Python version: 3.9.0 - Huggingface_hub version: 0.13.4 - PyArrow version: 11.0.0 - Pandas version: 1.5.3
open
https://github.com/huggingface/datasets/issues/5761
2023-04-16T16:21:55
2023-04-19T11:53:24
null
{ "login": "blghtr", "id": 69686152, "type": "User" }
[]
false
[]
1,670,028,072
5,760
Multi-image loading in Imagefolder dataset
### Feature request Extend the `imagefolder` dataloading script to support loading multiple images per dataset entry. This only really makes sense if a metadata file is present. Currently you can use the following format (example `metadata.jsonl`: ``` {'file_name': 'path_to_image.png', 'metadata': ...} ... ``` which will return a batch with key `image` and any other metadata. I would propose extending `file_name` to also accept a list of files, which would return a batch with key `images` and any other metadata. ### Motivation This is useful for example in segmentation tasks in computer vision models, or in text-to-image models that also accept conditioning signals such as another image, feature map, or similar. Currently if I want to do this, I would need to write a custom dataset, rather than just use `imagefolder`. ### Your contribution Would be open to doing a PR, but also happy for someone else to take it as I am not familiar with the datasets library.
open
https://github.com/huggingface/datasets/issues/5760
2023-04-16T16:01:05
2024-12-01T11:16:09
null
{ "login": "vvvm23", "id": 44398246, "type": "User" }
[ { "name": "enhancement", "color": "a2eeef" } ]
false
[]
1,669,977,848
5,759
Can I load in list of list of dict format?
### Feature request my jsonl dataset has following format: ``` [{'input':xxx, 'output':xxx},{'input:xxx,'output':xxx},...] [{'input':xxx, 'output':xxx},{'input:xxx,'output':xxx},...] ``` I try to use `datasets.load_dataset('json', data_files=path)` or `datasets.Dataset.from_json`, it raises ``` File "site-packages/datasets/arrow_dataset.py", line 1078, in from_json ).read() File "site-packages/datasets/io/json.py", line 59, in read self.builder.download_and_prepare( File "site-packages/datasets/builder.py", line 872, in download_and_prepare self._download_and_prepare( File "site-packages/datasets/builder.py", line 967, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "site-packages/datasets/builder.py", line 1749, in _prepare_split for job_id, done, content in self._prepare_split_single( File "site-packages/datasets/builder.py", line 1892, in _prepare_split_single raise DatasetGenerationError("An error occurred while generating the dataset") from e datasets.builder.DatasetGenerationError: An error occurred while generating the dataset ``` ### Motivation I wanna use features like `Datasets.map` or `Datasets.shuffle`, so i need the dataset in memory to be `arrow_dataset.Datasets` format ### Your contribution PR
open
https://github.com/huggingface/datasets/issues/5759
2023-04-16T13:50:14
2023-04-19T12:04:36
null
{ "login": "LZY-the-boys", "id": 72137647, "type": "User" }
[ { "name": "enhancement", "color": "a2eeef" } ]
false
[]
1,669,920,923
5,758
Fixes #5757
Fixes the bug #5757
closed
https://github.com/huggingface/datasets/pull/5758
2023-04-16T11:56:01
2023-04-20T15:37:49
2023-04-20T15:30:48
{ "login": "eli-osherovich", "id": 2437102, "type": "User" }
[]
true
[]
1,669,910,503
5,757
Tilde (~) is not supported
### Describe the bug It seems that `~` is not recognized correctly in local paths. Whenever I try to use it I get an exception ### Steps to reproduce the bug ```python load_dataset("imagefolder", data_dir="~/data/my_dataset") ``` Will generate the following error: ``` EmptyDatasetError: The directory at /path/to/cwd/~/data/datasets/clementine_tagged_per_cam doesn't contain any data files ``` ### Expected behavior Load the dataset. ### Environment info datasets==2.11.0
closed
https://github.com/huggingface/datasets/issues/5757
2023-04-16T11:48:10
2023-04-20T15:30:51
2023-04-20T15:30:51
{ "login": "eli-osherovich", "id": 2437102, "type": "User" }
[]
false
[]
1,669,678,080
5,756
Calling shuffle on a IterableDataset with streaming=True, gives "ValueError: cannot reshape array"
### Describe the bug When calling shuffle on a IterableDataset with streaming=True, I get the following error: ``` Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/administrator/Documents/Projects/huggingface/jax-diffusers-sprint-consistency-models/virtualenv/lib/python3.10/site-packages/datasets/iterable_dataset.py", line 937, in __iter__ for key, example in ex_iterable: File "/home/administrator/Documents/Projects/huggingface/jax-diffusers-sprint-consistency-models/virtualenv/lib/python3.10/site-packages/datasets/iterable_dataset.py", line 627, in __iter__ for x in self.ex_iterable: File "/home/administrator/Documents/Projects/huggingface/jax-diffusers-sprint-consistency-models/virtualenv/lib/python3.10/site-packages/datasets/iterable_dataset.py", line 138, in __iter__ yield from self.generate_examples_fn(**kwargs_with_shuffled_shards) File "/home/administrator/.cache/huggingface/modules/datasets_modules/datasets/mnist/fda16c03c4ecfb13f165ba7e29cf38129ce035011519968cdaf74894ce91c9d4/mnist.py", line 111, in _generate_examples images = np.frombuffer(f.read(), dtype=np.uint8).reshape(size, 28, 28) ValueError: cannot reshape array of size 59992 into shape (60000,28,28) ``` Tested with the fashion_mnist and mnist datasets ### Steps to reproduce the bug Code to reproduce ```python from datasets import load_dataset SHUFFLE_SEED = 42 SHUFFLE_BUFFER_SIZE = 10_000 dataset = load_dataset('fashion_mnist', streaming=True).shuffle(seed=SHUFFLE_SEED, buffer_size=SHUFFLE_BUFFER_SIZE) next(iter(dataset['train'])) ``` ### Expected behavior A random item from the dataset and no error ### Environment info - `datasets` version: 2.11.0 - Platform: Linux-5.15.0-69-generic-x86_64-with-glibc2.35 - Python version: 3.10.6 - Huggingface_hub version: 0.13.4 - PyArrow version: 11.0.0 - Pandas version: 2.0.0
closed
https://github.com/huggingface/datasets/issues/5756
2023-04-16T04:59:47
2023-04-18T03:40:56
2023-04-18T03:40:56
{ "login": "rohfle", "id": 21077341, "type": "User" }
[]
false
[]
1,669,048,438
5,755
ImportError: cannot import name 'DeprecatedEnum' from 'datasets.utils.deprecation_utils'
### Describe the bug The module moved to new place? ### Steps to reproduce the bug in the import step, ```python from datasets.utils.deprecation_utils import DeprecatedEnum ``` error: ``` ImportError: cannot import name 'DeprecatedEnum' from 'datasets.utils.deprecation_utils' ``` ### Expected behavior import successfully ### Environment info python==3.9.16 datasets==1.18.3
closed
https://github.com/huggingface/datasets/issues/5755
2023-04-14T23:28:54
2023-04-14T23:36:19
2023-04-14T23:36:19
{ "login": "fivejjs", "id": 1405491, "type": "User" }
[]
false
[]
1,668,755,035
5,754
Minor tqdm fixes
`GeneratorBasedBuilder`'s TQDM bars were not used as context managers. This PR fixes that (missed these bars in https://github.com/huggingface/datasets/pull/5560). Also, this PR modifies the single-proc `save_to_disk` to fix the issue with the TQDM bar not accumulating the progress in the multi-shard setting (again, this bug was introduced by me in the linked PR 😎)
closed
https://github.com/huggingface/datasets/pull/5754
2023-04-14T18:15:14
2023-04-20T15:27:58
2023-04-20T15:21:00
{ "login": "mariosasko", "id": 47462742, "type": "User" }
[]
true
[]
1,668,659,536
5,753
[IterableDatasets] Add column followed by interleave datasets gives bogus outputs
### Describe the bug If we add a new column to our iterable dataset using the hack described in #5752, when we then interleave datasets the new column is pinned to one value. ### Steps to reproduce the bug What we're going to do here is: 1. Load an iterable dataset in streaming mode (`original_dataset`) 2. Add a new column to this dataset using the hack in #5752 (`modified_dataset_1`) 3. Create another new dataset by adding a column with the same key but different values (`modified_dataset_2`) 4. Interleave our new datasets (`modified_dataset_1` + `modified_dataset_2`) 5. Check the value of our newly added column (`new_column`) ```python from datasets import load_dataset # load an iterable dataset original_dataset = load_dataset("librispeech_asr", "clean", split="validation", streaming=True) # now add a new column to our streaming dataset using our hack from 5752 name = "new_column" column = [f"new dataset 1, row {i}" for i in range(50)] new_features = original_dataset.features.copy() new_features[name] = new_features["file"] # I know that "file" has the right column type to match our new feature def add_column_fn(example, idx): if name in example: raise ValueError(f"Error when adding {name}: column {name} is already in the dataset.") return {name: column[idx]} modified_dataset_1 = original_dataset.map(add_column_fn, with_indices=True, features=new_features) # now create a second modified dataset using the same trick column = [f"new dataset 2, row {i}" for i in range(50)] def add_column_fn(example, idx): if name in example: raise ValueError(f"Error when adding {name}: column {name} is already in the dataset.") return {name: column[idx]} modified_dataset_2 = original_dataset.map(add_column_fn, with_indices=True, features=new_features) # interleave these datasets interleaved_dataset = interleave_datasets([modified_dataset_1, modified_dataset_2]) # now check what the value of the added column is for i, sample in enumerate(interleaved_dataset): print(sample["new_column"]) if i == 10: break ``` **Print Output:** ``` new dataset 2, row 0 new dataset 2, row 0 new dataset 2, row 1 new dataset 2, row 1 new dataset 2, row 2 new dataset 2, row 2 new dataset 2, row 3 new dataset 2, row 3 new dataset 2, row 4 new dataset 2, row 4 new dataset 2, row 5 ``` We see that we only get outputs from our second dataset. ### Expected behavior We should interleave between dataset 1 and 2 and increase in row value: ``` new dataset 1, row 0 new dataset 2, row 0 new dataset 1, row 1 new dataset 2, row 1 new dataset 1, row 2 new dataset 2, row 2 ... ``` ### Environment info - datasets version: 2.10.2.dev0 - Platform: Linux-4.19.0-23-cloud-amd64-x86_64-with-glibc2.28 - Python version: 3.9.16 - Huggingface_hub version: 0.13.3 - PyArrow version: 10.0.1 - Pandas version: 1.5.2
closed
https://github.com/huggingface/datasets/issues/5753
2023-04-14T17:32:31
2025-07-04T05:22:53
2023-04-14T17:36:37
{ "login": "sanchit-gandhi", "id": 93869735, "type": "User" }
[]
false
[]
1,668,574,209
5,752
Streaming dataset looses `.feature` method after `.add_column`
### Describe the bug After appending a new column to a streaming dataset using `.add_column`, we can no longer access the list of dataset features using the `.feature` method. ### Steps to reproduce the bug ```python from datasets import load_dataset original_dataset = load_dataset("librispeech_asr", "clean", split="validation", streaming=True) print(original_dataset.features.keys()) # now add a new column to our streaming dataset modified_dataset = original_dataset.add_column("new_column", ["some random text" for _ in range(50)]) print(modified_dataset.features.keys()) ``` **Print Output:** ``` dict_keys(['file', 'audio', 'text', 'speaker_id', 'chapter_id', 'id']) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[1], line 8 6 # now add a new column to our streaming dataset 7 modified_dataset = original_dataset.add_column("new_column", ["some random text" for _ in range(50)]) ----> 8 print(modified_dataset.features.keys()) AttributeError: 'NoneType' object has no attribute 'keys' ``` We see that we get the features for the original dataset, but not the modified one with the added column. ### Expected behavior Features should be persevered after adding a new column, i.e. calling: ```python print(modified_dataset.features.keys()) ``` Should return: ``` dict_keys(['file', 'audio', 'text', 'speaker_id', 'chapter_id', 'id', 'new_column']) ``` ### Environment info - `datasets` version: 2.10.2.dev0 - Platform: Linux-4.19.0-23-cloud-amd64-x86_64-with-glibc2.28 - Python version: 3.9.16 - Huggingface_hub version: 0.13.3 - PyArrow version: 10.0.1 - Pandas version: 1.5.2
open
https://github.com/huggingface/datasets/issues/5752
2023-04-14T16:39:50
2024-01-18T10:15:20
null
{ "login": "sanchit-gandhi", "id": 93869735, "type": "User" }
[ { "name": "bug", "color": "d73a4a" } ]
false
[]
1,668,333,316
5,751
Consistent ArrayXD Python formatting + better NumPy/Pandas formatting
Return a list of lists instead of a list of NumPy arrays when converting the variable-shaped `ArrayXD` to Python. Additionally, improve the NumPy conversion by returning a numeric NumPy array when the offsets are equal or a NumPy object array when they aren't, and allow converting the variable-shaped `ArrayXD` to Pandas. (Reported in https://github.com/huggingface/datasets/issues/5719#issuecomment-1507579671)
closed
https://github.com/huggingface/datasets/pull/5751
2023-04-14T14:13:59
2023-04-20T14:43:20
2023-04-20T14:40:34
{ "login": "mariosasko", "id": 47462742, "type": "User" }
[]
true
[]
1,668,289,067
5,750
Fail to create datasets from a generator when using Google Big Query
### Describe the bug Creating a dataset from a generator using `Dataset.from_generator()` fails if the generator is the [Google Big Query Python client](https://cloud.google.com/python/docs/reference/bigquery/latest). The problem is that the Big Query client is not pickable. And the function `create_config_id` tries to get a hash of the generator by pickling it. So the following error is generated: ``` _pickle.PicklingError: Pickling client objects is explicitly not supported. Clients have non-trivial state that is local and unpickleable. ``` ### Steps to reproduce the bug 1. Install the big query client and datasets `pip install google-cloud-bigquery datasets` 2. Run the following code: ```py from datasets import Dataset from google.cloud import bigquery client = bigquery.Client() # Perform a query. QUERY = ( 'SELECT name FROM `bigquery-public-data.usa_names.usa_1910_2013` ' 'WHERE state = "TX" ' 'LIMIT 100') query_job = client.query(QUERY) # API request rows = query_job.result() # Waits for query to finish ds = Dataset.from_generator(rows) for r in ds: print(r) ``` ### Expected behavior Two options: 1. Ignore the pickle errors when computing the hash 2. Provide a scape hutch so that we can avoid calculating the hash for the generator. For example, allowing to provide a hash from the user. ### Environment info python 3.9 google-cloud-bigquery 3.9.0 datasets 2.11.0
closed
https://github.com/huggingface/datasets/issues/5750
2023-04-14T13:50:59
2023-04-17T12:20:43
2023-04-17T12:20:43
{ "login": "ivanprado", "id": 895720, "type": "User" }
[]
false
[]
1,668,016,321
5,749
AttributeError: 'Version' object has no attribute 'match'
### Describe the bug When I run from datasets import load_dataset data = load_dataset("visual_genome", 'region_descriptions_v1.2.0') AttributeError: 'Version' object has no attribute 'match' ### Steps to reproduce the bug from datasets import load_dataset data = load_dataset("visual_genome", 'region_descriptions_v1.2.0') ### Expected behavior This is error trace: Downloading and preparing dataset visual_genome/region_descriptions_v1.2.0 to C:/Users/Acer/.cache/huggingface/datasets/visual_genome/region_descriptions_v1.2.0/1.2.0/136fe5b83f6691884566c5530313288171e053a3b33bfe3ea2e4c8b39abaf7f3... --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[6], line 1 ----> 1 data = load_dataset("visual_genome", 'region_descriptions_v1.2.0') File ~\.conda\envs\aai\Lib\site-packages\datasets\load.py:1791, 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, use_auth_token, task, streaming, num_proc, storage_options, **config_kwargs) 1788 try_from_hf_gcs = path not in _PACKAGED_DATASETS_MODULES 1790 # Download and prepare data -> 1791 builder_instance.download_and_prepare( 1792 download_config=download_config, 1793 download_mode=download_mode, 1794 verification_mode=verification_mode, 1795 try_from_hf_gcs=try_from_hf_gcs, 1796 num_proc=num_proc, 1797 storage_options=storage_options, 1798 ) 1800 # Build dataset for splits 1801 keep_in_memory = ( 1802 keep_in_memory if keep_in_memory is not None else is_small_dataset(builder_instance.info.dataset_size) 1803 ) File ~\.conda\envs\aai\Lib\site-packages\datasets\builder.py:891, in DatasetBuilder.download_and_prepare(self, output_dir, download_config, download_mode, verification_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, file_format, max_shard_size, num_proc, storage_options, **download_and_prepare_kwargs) 889 if num_proc is not None: 890 prepare_split_kwargs["num_proc"] = num_proc --> 891 self._download_and_prepare( 892 dl_manager=dl_manager, 893 verification_mode=verification_mode, 894 **prepare_split_kwargs, 895 **download_and_prepare_kwargs, 896 ) 897 # Sync info 898 self.info.dataset_size = sum(split.num_bytes for split in self.info.splits.values()) File ~\.conda\envs\aai\Lib\site-packages\datasets\builder.py:1651, in GeneratorBasedBuilder._download_and_prepare(self, dl_manager, verification_mode, **prepare_splits_kwargs) 1650 def _download_and_prepare(self, dl_manager, verification_mode, **prepare_splits_kwargs): -> 1651 super()._download_and_prepare( 1652 dl_manager, 1653 verification_mode, 1654 check_duplicate_keys=verification_mode == VerificationMode.BASIC_CHECKS 1655 or verification_mode == VerificationMode.ALL_CHECKS, 1656 **prepare_splits_kwargs, 1657 ) File ~\.conda\envs\aai\Lib\site-packages\datasets\builder.py:964, in DatasetBuilder._download_and_prepare(self, dl_manager, verification_mode, **prepare_split_kwargs) 962 split_dict = SplitDict(dataset_name=self.name) 963 split_generators_kwargs = self._make_split_generators_kwargs(prepare_split_kwargs) --> 964 split_generators = self._split_generators(dl_manager, **split_generators_kwargs) 966 # Checksums verification 967 if verification_mode == VerificationMode.ALL_CHECKS and dl_manager.record_checksums: File ~\.cache\huggingface\modules\datasets_modules\datasets\visual_genome\136fe5b83f6691884566c5530313288171e053a3b33bfe3ea2e4c8b39abaf7f3\visual_genome.py:377, in VisualGenome._split_generators(self, dl_manager) 375 def _split_generators(self, dl_manager): 376 # Download image meta datas. --> 377 image_metadatas_dir = dl_manager.download_and_extract(self.config.image_metadata_url) 378 image_metadatas_file = os.path.join( 379 image_metadatas_dir, _get_decompressed_filename_from_url(self.config.image_metadata_url) 380 ) 382 # Download annotations File ~\.cache\huggingface\modules\datasets_modules\datasets\visual_genome\136fe5b83f6691884566c5530313288171e053a3b33bfe3ea2e4c8b39abaf7f3\visual_genome.py:328, in VisualGenomeConfig.image_metadata_url(self) 326 @property 327 def image_metadata_url(self): --> 328 if not self.version.match(_LATEST_VERSIONS["image_metadata"]): 329 logger.warning( 330 f"Latest image metadata version is {_LATEST_VERSIONS['image_metadata']}. Trying to generate a dataset of version: {self.version}. Please double check that image data are unchanged between the two versions." 331 ) 332 return f"{_BASE_ANNOTATION_URL}/image_data.json.zip" ### Environment info datasets 2.11.0 python 3.11.3
closed
https://github.com/huggingface/datasets/issues/5749
2023-04-14T10:48:06
2023-06-30T11:31:17
2023-04-18T12:57:08
{ "login": "gulnaz-zh", "id": 54584290, "type": "User" }
[]
false
[]
1,667,517,024
5,748
[BUG FIX] Issue 5739
A fix for https://github.com/huggingface/datasets/issues/5739
open
https://github.com/huggingface/datasets/pull/5748
2023-04-14T05:07:31
2023-04-14T05:07:31
null
{ "login": "airlsyn", "id": 1772912, "type": "User" }
[]
true
[]
1,667,270,412
5,747
[WIP] Add Dataset.to_spark
null
closed
https://github.com/huggingface/datasets/pull/5747
2023-04-13T23:20:03
2024-01-08T18:31:50
2024-01-08T18:31:50
{ "login": "maddiedawson", "id": 106995444, "type": "User" }
[]
true
[]
1,667,102,459
5,746
Fix link in docs
Fixes a broken link in the use_with_pytorch docs
closed
https://github.com/huggingface/datasets/pull/5746
2023-04-13T20:45:19
2023-04-14T13:15:38
2023-04-14T13:08:42
{ "login": "bbbxyz", "id": 7485661, "type": "User" }
[]
true
[]
1,667,086,143
5,745
[BUG FIX] Issue 5744
A temporal fix for https://github.com/huggingface/datasets/issues/5744.
open
https://github.com/huggingface/datasets/pull/5745
2023-04-13T20:29:55
2023-04-21T15:22:43
null
{ "login": "keyboardAnt", "id": 15572698, "type": "User" }
[]
true
[]
1,667,076,620
5,744
[BUG] With Pandas 2.0.0, `load_dataset` raises `TypeError: read_csv() got an unexpected keyword argument 'mangle_dupe_cols'`
The `load_dataset` function with Pandas `1.5.3` has no issue (just a FutureWarning) but crashes with Pandas `2.0.0`. For your convenience, I opened a draft Pull Request to fix it quickly: https://github.com/huggingface/datasets/pull/5745 --- * The FutureWarning mentioned above: ``` FutureWarning: the 'mangle_dupe_cols' keyword is deprecated and will be removed in a future version. Please take steps to stop the use of 'mangle_dupe_cols' ```
closed
https://github.com/huggingface/datasets/issues/5744
2023-04-13T20:21:28
2024-04-09T16:13:59
2023-07-06T17:01:59
{ "login": "keyboardAnt", "id": 15572698, "type": "User" }
[]
false
[]
1,666,843,832
5,743
dataclass.py in virtual environment is overriding the stdlib module "dataclasses"
### Describe the bug "e:\Krish_naik\FSDSRegression\venv\Lib\dataclasses.py" is overriding the stdlib module "dataclasses" ### Steps to reproduce the bug module issue ### Expected behavior overriding the stdlib module "dataclasses" ### Environment info VS code
closed
https://github.com/huggingface/datasets/issues/5743
2023-04-13T17:28:33
2023-04-17T12:23:18
2023-04-17T12:23:18
{ "login": "syedabdullahhassan", "id": 71216295, "type": "User" }
[]
false
[]
1,666,209,738
5,742
Warning specifying future change in to_tf_dataset behaviour
Warning specifying future changes happening to `to_tf_dataset` behaviour when #5602 is merged in
closed
https://github.com/huggingface/datasets/pull/5742
2023-04-13T11:10:00
2023-04-21T13:18:14
2023-04-21T13:11:09
{ "login": "amyeroberts", "id": 22614925, "type": "User" }
[]
true
[]
1,665,860,919
5,741
Fix CI warnings
Fix warnings in our CI tests.
closed
https://github.com/huggingface/datasets/pull/5741
2023-04-13T07:17:02
2023-04-13T09:48:10
2023-04-13T09:40:50
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
true
[]
1,664,132,130
5,740
Fix CI mock filesystem fixtures
This PR fixes the fixtures of our CI mock filesystems. Before, we had to pass `clobber=True` to `fsspec.register_implementation` to overwrite the still present previously added "mock" filesystem. That meant that the mock filesystem fixture was not working properly, because the previously added "mock" filesystem, should have been deleted by the fixture. This PR fixes the mock filesystem fixtures, so that the "mock" filesystem is properly deleted from the inner `fsspec` registry. Tests were added to check the correct behavior of the mock filesystem fixtures. Related to: - #5733
closed
https://github.com/huggingface/datasets/pull/5740
2023-04-12T08:52:35
2023-04-13T11:01:24
2023-04-13T10:54:13
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
true
[]
1,663,762,901
5,739
weird result during dataset split when data path starts with `/data`
### Describe the bug The regex defined here https://github.com/huggingface/datasets/blob/f2607935c4e45c70c44fcb698db0363ca7ba83d4/src/datasets/utils/py_utils.py#L158 will cause a weird result during dataset split when data path starts with `/data` ### Steps to reproduce the bug 1. clone dataset into local path ``` cd /data/train/raw/ git lfs clone https://huggingface.co/datasets/deepmind/code_contests.git ls /data/train/raw/code_contests # README.md data dataset_infos.json ls /data/train/raw/code_contests/data # test-00000-of-00001-9c49eeff30aacaa8.parquet # train-[0-9]+-of-[0-9]+-xx.parquet # valid-00000-of-00001-5e672c5751f060d3.parquet ``` 2. loading data from local ``` from datasets import load_dataset dataset = load_dataset('/data/train/raw/code_contests') FileNotFoundError: Unable to resolve any data file that matches '['data/train/raw/code_contests/data/train-[0-9][0-9][0-9][0-9][0-9]-of-[0-9][0-9][0-9][0-9][0-9]*.*']' at /data/train/raw/code_contests with any supported extension ``` weird path `data/train/raw/code_contests/data/train-[0-9][0-9][0-9][0-9][0-9]-of-[0-9][0-9][0-9][0-9][0-9]*.*` While dive deep into `LocalDatasetModuleFactoryWithoutScript` defined in [load.py](https://github.com/huggingface/datasets/blob/f2607935c4e45c70c44fcb698db0363ca7ba83d4/src/datasets/load.py#L627) and _get_data_files_patterns https://github.com/huggingface/datasets/blob/f2607935c4e45c70c44fcb698db0363ca7ba83d4/src/datasets/data_files.py#L228. I found the weird behavior caused by `string_to_dict` 3. check `string_to_dict` ``` p = '/data/train/raw/code_contests/data/test-00000-of-00001-9c49eeff30aacaa8.parquet' 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]*.*' string_to_dict(p, split_pattern) # {'split': 'train/raw/code_contests/data/test'} p = '/data2/train/raw/code_contests/data/test-00000-of-00001-9c49eeff30aacaa8.parquet' string_to_dict(p, split_pattern) {'split': 'test'} ``` go deep into string_to_dict https://github.com/huggingface/datasets/blob/f2607935c4e45c70c44fcb698db0363ca7ba83d4/src/datasets/utils/py_utils.py#L158. 4. test the regex: <img width="680" alt="image" src="https://user-images.githubusercontent.com/1772912/231351129-75179f01-fb9f-4f12-8fa9-0dfcc3d5f3bd.png"> <img width="679" alt="image" src="https://user-images.githubusercontent.com/1772912/231351025-009f3d83-2cf3-4e15-9ed4-6b9663dcb2ee.png"> ### Expected behavior statement in `steps to reproduce the bug` 3. check `string_to_dict` ``` p = '/data/train/raw/code_contests/data/test-00000-of-00001-9c49eeff30aacaa8.parquet' 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]*.*' string_to_dict(p, split_pattern) # {'split': 'train/raw/code_contests/data/test'} p = '/data2/train/raw/code_contests/data/test-00000-of-00001-9c49eeff30aacaa8.parquet' string_to_dict(p, split_pattern) {'split': 'test'} ``` ### Environment info - linux(debian) - python 3.7 - datasets 2.8.0
open
https://github.com/huggingface/datasets/issues/5739
2023-04-12T04:51:35
2023-04-21T14:20:59
null
{ "login": "airlsyn", "id": 1772912, "type": "User" }
[]
false
[]
1,663,477,690
5,738
load_dataset("text","dataset.txt") loads the wrong dataset!
### Describe the bug I am trying to load my own custom text dataset using the load_dataset function. My dataset is a bunch of ordered text, think along the lines of shakespeare plays. However, after I load the dataset and I inspect it, the dataset is a table with a bunch of latitude and longitude values! What in the world?? ### Steps to reproduce the bug my_dataset = load_dataset("text","TextFile.txt") my_dataset ### Expected behavior I expected the dataset to contain the actual data from the text document that I used. ### Environment info Google Colab
closed
https://github.com/huggingface/datasets/issues/5738
2023-04-12T01:07:46
2023-04-19T12:08:27
2023-04-19T12:08:27
{ "login": "Tylersuard", "id": 41713505, "type": "User" }
[]
false
[]
1,662,919,811
5,737
ClassLabel Error
### Describe the bug I still getting the error "call() takes 1 positional argument but 2 were given" even after ensuring that the value being passed to the label object is a single value and that the ClassLabel object has been created with the correct number of label classes ### Steps to reproduce the bug from datasets import ClassLabel, Dataset 1. Create the ClassLabel object with 3 label values and their corresponding names label_test = ClassLabel(num_classes=3, names=["label_1", "label_2", "label_3"]) 2. Define a dictionary with text and label fields data = { 'text': ['text_1', 'text_2', 'text_3'], 'label': [1, 2, 3], } 3. Create a Hugging Face dataset from the dictionary dataset = Dataset.from_dict(data) print(dataset.features) 4. Map the label values to their corresponding label names using the label object dataset = dataset.map(lambda example: {'text': example['text'], 'label': label_test(example['label'])}) 5. Print the resulting dataset print(dataset) ### Expected behavior I hope my label type is class label instead int. ### Environment info python 3.9 google colab
closed
https://github.com/huggingface/datasets/issues/5737
2023-04-11T17:14:13
2023-04-13T16:49:57
2023-04-13T16:49:57
{ "login": "mrcaelumn", "id": 10896776, "type": "User" }
[]
false
[]
1,662,286,061
5,736
FORCE_REDOWNLOAD raises "Directory not empty" exception on second run
### Describe the bug Running `load_dataset(..., download_mode=datasets.DownloadMode.FORCE_REDOWNLOAD)` twice raises a `Directory not empty` exception on the second run. ### Steps to reproduce the bug I cannot test this on datasets v2.11.0 due to #5711, but this happens in v2.10.1. 1. Set up a script `my_dataset.py` to generate and load an offline dataset. 2. Load it with ```python ds = datasets.load_dataset(path=/path/to/my_dataset.py, name='toy', data_dir=/path/to/my_dataset.py, cache_dir=cache_dir, download_mode=datasets.DownloadMode.FORCE_REDOWNLOAD, ) ``` It loads fine ``` Dataset my_dataset downloaded and prepared to /path/to/cache/toy-..e05e/1.0.0/...5b4c. Subsequent calls will reuse this data. ``` 3. Try to load it again with the same snippet and the splits are generated, but at the end of the loading process it raises the error ``` 2023-04-11 12:10:19,965: DEBUG: open file: /path/to/cache/toy-..e05e/1.0.0/...5b4c.incomplete/dataset_info.json Traceback (most recent call last): File "<string>", line 2, in <module> File "/path/to/conda/environment/lib/python3.10/site-packages/datasets/load.py", line 1782, in load_dataset builder_instance.download_and_prepare( File "/path/to/conda/environment/lib/python3.10/site-packages/datasets/builder.py", line 852, in download_and_prepare with incomplete_dir(self._output_dir) as tmp_output_dir: File "/path/to/conda/environment/lib/python3.10/contextlib.py", line 142, in __exit__ next(self.gen) File "/path/to/conda/environment/lib/python3.10/site-packages/datasets/builder.py", line 826, in incomplete_dir shutil.rmtree(dirname) File "/path/to/conda/environment/lib/python3.10/shutil.py", line 730, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/path/to/conda/environment/lib/python3.10/shutil.py", line 728, in rmtree os.rmdir(path) OSError: [Errno 39] Directory not empty: '/path/to/cache/toy-..e05e/1.0.0/...5b4c' ``` ### Expected behavior Regenerate the dataset from scratch and reload it. ### Environment info - `datasets` version: 2.10.1 - Platform: Linux-4.18.0-483.el8.x86_64-x86_64-with-glibc2.28 - Python version: 3.10.8 - PyArrow version: 11.0.0 - Pandas version: 1.5.2
open
https://github.com/huggingface/datasets/issues/5736
2023-04-11T11:29:15
2023-11-30T07:16:58
null
{ "login": "rcasero", "id": 1219084, "type": "User" }
[]
false
[]
1,662,150,903
5,735
Implement sharding on merged iterable datasets
This PR allows sharding of merged iterable datasets. Merged iterable datasets with for instance the `interleave_datasets` command are comprised of multiple sub-iterable, one for each dataset that has been merged. With this PR, sharding a merged iterable will result in multiple merged datasets each comprised of sharded sub-iterable, ensuring that there is no duplication of data. As a result it is now possible to set any amount of workers in the dataloader as long as it is lower or equal to the lowest amount of shards amongst the datasets. Before it had to be set to 0. I previously talked about this issue on the forum [here](https://discuss.huggingface.co/t/interleaving-iterable-dataset-with-num-workers-0/35801)
closed
https://github.com/huggingface/datasets/pull/5735
2023-04-11T10:02:25
2023-04-27T16:39:04
2023-04-27T16:32:09
{ "login": "bruno-hays", "id": 48770768, "type": "User" }
[]
true
[]
1,662,058,028
5,734
Remove temporary pin of fsspec
Once root cause is found and fixed, remove the temporary pin introduced by: - #5731
closed
https://github.com/huggingface/datasets/issues/5734
2023-04-11T09:04:17
2023-04-11T11:04:52
2023-04-11T11:04:52
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[ { "name": "bug", "color": "d73a4a" } ]
false
[]
1,662,039,191
5,733
Unpin fsspec
In `fsspec--2023.4.0` default value for clobber when registering an implementation was changed from True to False. See: - https://github.com/fsspec/filesystem_spec/pull/1237 This PR recovers previous behavior by passing clobber True when registering mock implementations. This PR also removes the temporary pin introduced by: - #5731 Fix #5734.
closed
https://github.com/huggingface/datasets/pull/5733
2023-04-11T08:52:12
2023-04-11T11:11:45
2023-04-11T11:04:51
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
true
[]
1,662,020,571
5,732
Enwik8 should support the standard split
### Feature request The HuggingFace Datasets library currently supports two BuilderConfigs for Enwik8. One config yields individual lines as examples, while the other config yields the entire dataset as a single example. Both support only a monolithic split: it is all grouped as "train". The HuggingFace Datasets library should include a BuilderConfig for Enwik8 with train, validation, and test sets derived from the first 90 million bytes, next 5 million bytes, and last 5 million bytes, respectively. This Enwik8 split is standard practice in LM papers, as elaborated and motivated below. ### Motivation Enwik8 is commonly split into 90M, 5M, 5M consecutive bytes. This is done in the Transformer-XL [codebase](https://github.com/kimiyoung/transformer-xl/blob/44781ed21dbaec88b280f74d9ae2877f52b492a5/getdata.sh#L34), and is additionally mentioned in the Sparse Transformers [paper](https://arxiv.org/abs/1904.10509) and the Compressive Transformers [paper](https://arxiv.org/abs/1911.05507). This split is pretty much universal among language modeling papers. One may obtain the splits by manual wrangling, using the data yielded by the ```enwik8-raw``` BuilderConfig. However, this undermines the seamless functionality of the library: one must slice the single raw example, extract it into three tensors, and wrap each in a separate dataset. This becomes even more of a nuisance if using the current Enwik8 HuggingFace dataset as a TfdsDataSource with [SeqIO](https://github.com/google/seqio), where a pipeline of preprocessors is typically included in a SeqIO Task definition, to be applied immediately after loading the data with TFDS. ### Your contribution Supporting this functionality in HuggingFace Datasets will only require an additional BuilderConfig for Enwik8 and a few additional lines of code. I will submit a PR.
closed
https://github.com/huggingface/datasets/issues/5732
2023-04-11T08:38:53
2023-04-11T09:28:17
2023-04-11T09:28:16
{ "login": "lucaslingle", "id": 10287371, "type": "User" }
[ { "name": "enhancement", "color": "a2eeef" } ]
false
[]
1,662,012,913
5,731
Temporarily pin fsspec
Fix #5730.
closed
https://github.com/huggingface/datasets/pull/5731
2023-04-11T08:33:15
2023-04-11T08:57:45
2023-04-11T08:47:55
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
true
[]
1,662,007,926
5,730
CI is broken: ValueError: Name (mock) already in the registry and clobber is False
CI is broken for `test_py310`. See: https://github.com/huggingface/datasets/actions/runs/4665326892/jobs/8258580948 ``` =========================== short test summary info ============================ ERROR tests/test_builder.py::test_builder_with_filesystem_download_and_prepare - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_builder.py::test_builder_with_filesystem_download_and_prepare_reload - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_dataset_dict.py::test_dummy_datasetdict_serialize_fs - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_file_utils.py::test_get_from_cache_fsspec - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_filesystem.py::test_is_remote_filesystem - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xexists[tmp_path/file.txt-True] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xexists[tmp_path/file_that_doesnt_exist.txt-False] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xexists[mock://top_level/second_level/date=2019-10-01/a.parquet-True] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xexists[mock://top_level/second_level/date=2019-10-01/file_that_doesnt_exist.parquet-False] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xlistdir[tmp_path-expected_paths0] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xlistdir[mock://-expected_paths1] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xlistdir[mock://top_level-expected_paths2] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xlistdir[mock://top_level/second_level/date=2019-10-01-expected_paths3] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xisdir[tmp_path-True] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xisdir[tmp_path/file.txt-False] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xisdir[mock://-True] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xisdir[mock://top_level-True] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xisdir[mock://dir_that_doesnt_exist-False] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xisfile[tmp_path/file.txt-True] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xisfile[tmp_path/file_that_doesnt_exist.txt-False] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xisfile[mock://-False] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xisfile[mock://top_level/second_level/date=2019-10-01/a.parquet-True] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xgetsize[tmp_path/file.txt-100] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xgetsize[mock://-0] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xgetsize[mock://top_level/second_level/date=2019-10-01/a.parquet-100] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xglob[tmp_path/*.txt-expected_paths0] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xglob[mock://*-expected_paths1] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xglob[mock://top_*-expected_paths2] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xglob[mock://top_level/second_level/date=2019-10-0[1-4]-expected_paths3] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xglob[mock://top_level/second_level/date=2019-10-0[1-4]/*-expected_paths4] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xwalk[tmp_path-expected_outputs0] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::test_xwalk[mock://top_level/second_level-expected_outputs1] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::TestxPath::test_xpath_exists[tmp_path/file.txt-True] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::TestxPath::test_xpath_exists[tmp_path/file_that_doesnt_exist.txt-False] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::TestxPath::test_xpath_exists[mock://top_level/second_level/date=2019-10-01/a.parquet-True] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::TestxPath::test_xpath_exists[mock://top_level/second_level/date=2019-10-01/file_that_doesnt_exist.parquet-False] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::TestxPath::test_xpath_glob[tmp_path-*.txt-expected_paths0] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::TestxPath::test_xpath_glob[mock://-*-expected_paths1] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::TestxPath::test_xpath_glob[mock://-top_*-expected_paths2] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::TestxPath::test_xpath_glob[mock://top_level/second_level-date=2019-10-0[1-4]-expected_paths3] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::TestxPath::test_xpath_glob[mock://top_level/second_level-date=2019-10-0[1-4]/*-expected_paths4] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::TestxPath::test_xpath_rglob[tmp_path-*.txt-expected_paths0] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::TestxPath::test_xpath_rglob[mock://-date=2019-10-0[1-4]-expected_paths1] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::TestxPath::test_xpath_rglob[mock://top_level-date=2019-10-0[1-4]-expected_paths2] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::TestxPath::test_xpath_rglob[mock://-date=2019-10-0[1-4]/*-expected_paths3] - ValueError: Name (mock) already in the registry and clobber is False ERROR tests/test_streaming_download_manager.py::TestxPath::test_xpath_rglob[mock://top_level-date=2019-10-0[1-4]/*-expected_paths4] - ValueError: Name (mock) already in the registry and clobber is False ===== 2105 passed, 18 skipped, 38 warnings, 46 errors in 236.22s (0:03:56) ===== ```
closed
https://github.com/huggingface/datasets/issues/5730
2023-04-11T08:29:46
2023-04-11T08:47:56
2023-04-11T08:47:56
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[ { "name": "bug", "color": "d73a4a" } ]
false
[]
1,661,929,923
5,729
Fix nondeterministic sharded data split order
This PR makes the order of the split names deterministic. Before it was nondeterministic because we were iterating over `set` elements. Fix #5728.
closed
https://github.com/huggingface/datasets/pull/5729
2023-04-11T07:34:20
2023-04-26T15:12:25
2023-04-26T15:05:12
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[]
true
[]
1,661,925,932
5,728
The order of data split names is nondeterministic
After this CI error: https://github.com/huggingface/datasets/actions/runs/4639528358/jobs/8210492953?pr=5718 ``` FAILED tests/test_data_files.py::test_get_data_files_patterns[data_file_per_split4] - AssertionError: assert ['random', 'train'] == ['train', 'random'] At index 0 diff: 'random' != 'train' Full diff: - ['train', 'random'] + ['random', 'train'] ``` I have checked locally and found out that the data split order is nondeterministic. This is caused by the use of `set` for sharded splits.
closed
https://github.com/huggingface/datasets/issues/5728
2023-04-11T07:31:25
2023-04-26T15:05:13
2023-04-26T15:05:13
{ "login": "albertvillanova", "id": 8515462, "type": "User" }
[ { "name": "bug", "color": "d73a4a" } ]
false
[]
1,661,536,363
5,727
load_dataset fails with FileNotFound error on Windows
### Describe the bug Although I can import and run the datasets library in a Colab environment, I cannot successfully load any data on my own machine (Windows 10) despite following the install steps: (1) create conda environment (2) activate environment (3) install with: ``conda` install -c huggingface -c conda-forge datasets` Then ``` from datasets import load_dataset # this or any other example from the website fails with the FileNotFoundError glue = load_dataset("glue", "ax") ``` **Below I have pasted the error omitting the full path**: ``` raise FileNotFoundError( FileNotFoundError: Couldn't find a dataset script at C:\Users\...\glue\glue.py or any data file in the same directory. Couldn't find 'glue' on the Hugging Face Hub either: FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\...\\.cache\\huggingface' ``` ### Steps to reproduce the bug On Windows 10 1) create a minimal conda environment (with just Python) (2) activate environment (3) install datasets with: ``conda` install -c huggingface -c conda-forge datasets` (4) import load_dataset and follow example usage from any dataset card. ### Expected behavior The expected behavior is to load the file into the Python session running on my machine without error. ### Environment info ``` # Name Version Build Channel aiohttp 3.8.4 py311ha68e1ae_0 conda-forge aiosignal 1.3.1 pyhd8ed1ab_0 conda-forge arrow-cpp 11.0.0 h57928b3_13_cpu conda-forge async-timeout 4.0.2 pyhd8ed1ab_0 conda-forge attrs 22.2.0 pyh71513ae_0 conda-forge aws-c-auth 0.6.26 h1262f0c_1 conda-forge aws-c-cal 0.5.21 h7cda486_2 conda-forge aws-c-common 0.8.14 hcfcfb64_0 conda-forge aws-c-compression 0.2.16 h8a79959_5 conda-forge aws-c-event-stream 0.2.20 h5f78564_4 conda-forge aws-c-http 0.7.6 h2545be9_0 conda-forge aws-c-io 0.13.19 h0d2781e_3 conda-forge aws-c-mqtt 0.8.6 hd211e0c_12 conda-forge aws-c-s3 0.2.7 h8113e7b_1 conda-forge aws-c-sdkutils 0.1.8 h8a79959_0 conda-forge aws-checksums 0.1.14 h8a79959_5 conda-forge aws-crt-cpp 0.19.8 he6d3b81_12 conda-forge aws-sdk-cpp 1.10.57 h64004b3_8 conda-forge brotlipy 0.7.0 py311ha68e1ae_1005 conda-forge bzip2 1.0.8 h8ffe710_4 conda-forge c-ares 1.19.0 h2bbff1b_0 ca-certificates 2023.01.10 haa95532_0 certifi 2022.12.7 pyhd8ed1ab_0 conda-forge cffi 1.15.1 py311h7d9ee11_3 conda-forge charset-normalizer 2.1.1 pyhd8ed1ab_0 conda-forge colorama 0.4.6 pyhd8ed1ab_0 conda-forge cryptography 40.0.1 py311h28e9c30_0 conda-forge dataclasses 0.8 pyhc8e2a94_3 conda-forge datasets 2.11.0 py_0 huggingface dill 0.3.6 pyhd8ed1ab_1 conda-forge filelock 3.11.0 pyhd8ed1ab_0 conda-forge frozenlist 1.3.3 py311ha68e1ae_0 conda-forge fsspec 2023.4.0 pyh1a96a4e_0 conda-forge gflags 2.2.2 ha925a31_1004 conda-forge glog 0.6.0 h4797de2_0 conda-forge huggingface_hub 0.13.4 py_0 huggingface idna 3.4 pyhd8ed1ab_0 conda-forge importlib-metadata 6.3.0 pyha770c72_0 conda-forge importlib_metadata 6.3.0 hd8ed1ab_0 conda-forge intel-openmp 2023.0.0 h57928b3_25922 conda-forge krb5 1.20.1 heb0366b_0 conda-forge libabseil 20230125.0 cxx17_h63175ca_1 conda-forge libarrow 11.0.0 h04c43f8_13_cpu conda-forge libblas 3.9.0 16_win64_mkl conda-forge libbrotlicommon 1.0.9 hcfcfb64_8 conda-forge libbrotlidec 1.0.9 hcfcfb64_8 conda-forge libbrotlienc 1.0.9 hcfcfb64_8 conda-forge libcblas 3.9.0 16_win64_mkl conda-forge libcrc32c 1.1.2 h0e60522_0 conda-forge libcurl 7.88.1 h68f0423_1 conda-forge libexpat 2.5.0 h63175ca_1 conda-forge libffi 3.4.2 h8ffe710_5 conda-forge libgoogle-cloud 2.8.0 hf2ff781_1 conda-forge libgrpc 1.52.1 h32da247_1 conda-forge libhwloc 2.9.0 h51c2c0f_0 conda-forge libiconv 1.17 h8ffe710_0 conda-forge liblapack 3.9.0 16_win64_mkl conda-forge libprotobuf 3.21.12 h12be248_0 conda-forge libsqlite 3.40.0 hcfcfb64_0 conda-forge libssh2 1.10.0 h9a1e1f7_3 conda-forge libthrift 0.18.1 h9ce19ad_0 conda-forge libutf8proc 2.8.0 h82a8f57_0 conda-forge libxml2 2.10.3 hc3477c8_6 conda-forge libzlib 1.2.13 hcfcfb64_4 conda-forge lz4-c 1.9.4 hcfcfb64_0 conda-forge mkl 2022.1.0 h6a75c08_874 conda-forge multidict 6.0.4 py311ha68e1ae_0 conda-forge multiprocess 0.70.14 py311ha68e1ae_3 conda-forge numpy 1.24.2 py311h0b4df5a_0 conda-forge openssl 3.1.0 hcfcfb64_0 conda-forge orc 1.8.3 hada7b9e_0 conda-forge packaging 23.0 pyhd8ed1ab_0 conda-forge pandas 2.0.0 py311hf63dbb6_0 conda-forge parquet-cpp 1.5.1 2 conda-forge pip 23.0.1 pyhd8ed1ab_0 conda-forge pthreads-win32 2.9.1 hfa6e2cd_3 conda-forge pyarrow 11.0.0 py311h6a6099b_13_cpu conda-forge pycparser 2.21 pyhd8ed1ab_0 conda-forge pyopenssl 23.1.1 pyhd8ed1ab_0 conda-forge pysocks 1.7.1 pyh0701188_6 conda-forge python 3.11.3 h2628c8c_0_cpython conda-forge python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge python-tzdata 2023.3 pyhd8ed1ab_0 conda-forge python-xxhash 3.2.0 py311ha68e1ae_0 conda-forge python_abi 3.11 3_cp311 conda-forge pytz 2023.3 pyhd8ed1ab_0 conda-forge pyyaml 6.0 py311ha68e1ae_5 conda-forge re2 2023.02.02 h63175ca_0 conda-forge requests 2.28.2 pyhd8ed1ab_1 conda-forge setuptools 67.6.1 pyhd8ed1ab_0 conda-forge six 1.16.0 pyh6c4a22f_0 conda-forge snappy 1.1.10 hfb803bf_0 conda-forge tbb 2021.8.0 h91493d7_0 conda-forge tk 8.6.12 h8ffe710_0 conda-forge tqdm 4.65.0 pyhd8ed1ab_1 conda-forge typing-extensions 4.5.0 hd8ed1ab_0 conda-forge typing_extensions 4.5.0 pyha770c72_0 conda-forge tzdata 2023c h71feb2d_0 conda-forge ucrt 10.0.22621.0 h57928b3_0 conda-forge urllib3 1.26.15 pyhd8ed1ab_0 conda-forge vc 14.3 hb6edc58_10 conda-forge vs2015_runtime 14.34.31931 h4c5c07a_10 conda-forge wheel 0.40.0 pyhd8ed1ab_0 conda-forge win_inet_pton 1.1.0 pyhd8ed1ab_6 conda-forge xxhash 0.8.1 hcfcfb64_0 conda-forge xz 5.2.10 h8cc25b3_1 yaml 0.2.5 h8ffe710_2 conda-forge yarl 1.8.2 py311ha68e1ae_0 conda-forge zipp 3.15.0 pyhd8ed1ab_0 conda-forge zlib 1.2.13 hcfcfb64_4 conda-forge zstd 1.5.4 hd43e919_0 ```
closed
https://github.com/huggingface/datasets/issues/5727
2023-04-10T23:21:12
2023-07-21T14:08:20
2023-07-21T14:08:19
{ "login": "joelkowalewski", "id": 122648572, "type": "User" }
[]
false
[]
1,660,944,807
5,726
Fallback JSON Dataset loading does not load all values when features specified manually
### Describe the bug The fallback JSON dataset loader located here: https://github.com/huggingface/datasets/blob/1c4ec00511868bd881e84a6f7e0333648d833b8e/src/datasets/packaged_modules/json/json.py#L130-L153 does not load the values of features correctly when features are specified manually and not all features have a value in the first entry of the dataset. I'm pretty sure this is not supposed to be expected bahavior? To fix this you'd have to change this line: https://github.com/huggingface/datasets/blob/1c4ec00511868bd881e84a6f7e0333648d833b8e/src/datasets/packaged_modules/json/json.py#L140 To pass a schema to pyarrow which has the same structure as the features argument passed to the load_dataset() method. ### Steps to reproduce the bug Consider a dataset JSON like this: ``` [ { "instruction": "Do stuff", "output": "Answer stuff" }, { "instruction": "Do stuff2", "input": "Additional Input2", "output": "Answer stuff2" } ] ``` Using this code to load the dataset: ``` from datasets import load_dataset, Features, Value features = { "instruction": Value("string"), "input": Value("string"), "output": Value("string") } features = Features(features) ds = load_dataset("json", data_files="./ds.json", features=features) for row in ds["train"]: print(row) ``` we get a dataset that looks like this: | **Instruction** | **Input** | **Output** | |-----------------|--------------------|-----------------| | "Do stuff" | None | "Answer Stuff" | | "Do stuff2" | None | "Answer Stuff2" | ### Expected behavior The input column should contain values other than None for dataset entries that have the "input" attribute set: | **Instruction** | **Input** | **Output** | |-----------------|--------------------|-----------------| | "Do stuff" | None | "Answer Stuff" | | "Do stuff2" | "Additional Input2" | "Answer Stuff2" | ### Environment info Python 3.10.10 Datasets 2.11.0 Windows 10
closed
https://github.com/huggingface/datasets/issues/5726
2023-04-10T15:22:14
2023-04-21T06:35:28
2023-04-21T06:35:28
{ "login": "myluki2000", "id": 3610788, "type": "User" }
[]
false
[]