Datasets:

Formats:
arrow
ArXiv:
Libraries:
Datasets
License:

error while download dataset

#2
by Mokasty - opened

Thank you for sharing this valuable dataset.
I am trying to download the dataset via Hugging Face Datasets, but it generating an error while loading the dataset. Does anyone know the issue?

This is whole error trace:

Failed to read file '/root/.cache/huggingface/datasets/downloads/6a659d80e238d91fbff897b60a47b0380b7c27d2b0517a6d5a2c92401acddc11' with error <class 'datasets.table.CastError'>: Couldn't cast
item_id: string
start: timestamp[s]
freq: string
target: fixed_size_list<item: list<item: float>>[2]
child 0, item: list<item: float>
child 0, item: float
-- schema metadata --
huggingface: '{"info": {"features": {"item_id": {"dtype": "string", "_typ' + 247
to
{'item_id': Value(dtype='string', id=None), 'start': Value(dtype='timestamp[s]', id=None), 'freq': Value(dtype='string', id=None), 'target': Sequence(feature=Sequence(feature=Value(dtype='float32', id=None), length=-1, id=None), length=2, id=None), 'past_feat_dynamic_real': Sequence(feature=Sequence(feature=Value(dtype='float32', id=None), length=-1, id=None), length=11, id=None)}
because column names don't match

CastError Traceback (most recent call last)
File /usr/local/lib/python3.8/dist-packages/datasets/builder.py:1973, in ArrowBasedBuilder._prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, job_id)
1972 _time = time.time()
-> 1973 for _, table in generator:
1974 if max_shard_size is not None and writer._num_bytes > max_shard_size:

File /usr/local/lib/python3.8/dist-packages/datasets/packaged_modules/arrow/arrow.py:70, in Arrow.generate_tables(self, files)
67 # Uncomment for debugging (will print the Arrow table size and elements)
68 # logger.warning(f"pa_table: {pa_table} num rows: {pa_table.num_rows}")
69 # logger.warning('\n'.join(str(pa_table.slice(i, 1).to_pydict()) for i in range(pa_table.num_rows)))
---> 70 yield f"{file_idx}
{batch_idx}", self._cast_table(pa_table)
71 except ValueError as e:

File /usr/local/lib/python3.8/dist-packages/datasets/packaged_modules/arrow/arrow.py:58, in Arrow._cast_table(self, pa_table)
55 if self.info.features is not None:
56 # more expensive cast to support nested features with keys in a different order
57 # allows str <-> int/float or str to Audio for example
---> 58 pa_table = table_cast(pa_table, self.info.features.arrow_schema)
59 return pa_table

File /usr/local/lib/python3.8/dist-packages/datasets/table.py:2240, in table_cast(table, schema)
2239 if table.schema != schema:
-> 2240 return cast_table_to_schema(table, schema)
2241 elif table.schema.metadata != schema.metadata:

File /usr/local/lib/python3.8/dist-packages/datasets/table.py:2194, in cast_table_to_schema(table, schema)
2193 if sorted(table.column_names) != sorted(features):
-> 2194 raise CastError(
2195 f"Couldn't cast\n{table.schema}\nto\n{features}\nbecause column names don't match",
2196 table_column_names=table.column_names,
2197 requested_column_names=list(features),
2198 )
2199 arrays = [cast_array_to_feature(table[name], feature) for name, feature in features.items()]

CastError: Couldn't cast
item_id: string
start: timestamp[s]
freq: string
target: fixed_size_list<item: list<item: float>>[2]
child 0, item: list<item: float>
child 0, item: float
-- schema metadata --
huggingface: '{"info": {"features": {"item_id": {"dtype": "string", "_typ' + 247
to
{'item_id': Value(dtype='string', id=None), 'start': Value(dtype='timestamp[s]', id=None), 'freq': Value(dtype='string', id=None), 'target': Sequence(feature=Sequence(feature=Value(dtype='float32', id=None), length=-1, id=None), length=2, id=None), 'past_feat_dynamic_real': Sequence(feature=Sequence(feature=Value(dtype='float32', id=None), length=-1, id=None), length=11, id=None)}
because column names don't match

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

DatasetGenerationError Traceback (most recent call last)
Cell In[4], line 3
1 from datasets import load_dataset
----> 3 dataset = load_dataset("Salesforce/lotsa_data")

File /usr/local/lib/python3.8/dist-packages/datasets/load.py:2582, in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, verification_mode, ignore_verifications, keep_in_memory, save_infos, revision, token, use_auth_token, task, streaming, num_proc, storage_options, trust_remote_code, **config_kwargs)
2579 try_from_hf_gcs = path not in _PACKAGED_DATASETS_MODULES
2581 # Download and prepare data
-> 2582 builder_instance.download_and_prepare(
2583 download_config=download_config,
2584 download_mode=download_mode,
2585 verification_mode=verification_mode,
2586 try_from_hf_gcs=try_from_hf_gcs,
2587 num_proc=num_proc,
2588 storage_options=storage_options,
2589 )
2591 # Build dataset for splits
2592 keep_in_memory = (
2593 keep_in_memory if keep_in_memory is not None else is_small_dataset(builder_instance.info.dataset_size)
2594 )

File /usr/local/lib/python3.8/dist-packages/datasets/builder.py:1005, 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)
1003 if num_proc is not None:
1004 prepare_split_kwargs["num_proc"] = num_proc
-> 1005 self._download_and_prepare(
1006 dl_manager=dl_manager,
1007 verification_mode=verification_mode,
1008 **prepare_split_kwargs,
1009 **download_and_prepare_kwargs,
1010 )
1011 # Sync info
1012 self.info.dataset_size = sum(split.num_bytes for split in self.info.splits.values())

File /usr/local/lib/python3.8/dist-packages/datasets/builder.py:1100, in DatasetBuilder._download_and_prepare(self, dl_manager, verification_mode, **prepare_split_kwargs)
1096 split_dict.add(split_generator.split_info)
1098 try:
1099 # Prepare split will record examples associated to the split
-> 1100 self._prepare_split(split_generator, **prepare_split_kwargs)
1101 except OSError as e:
1102 raise OSError(
1103 "Cannot find data file. "
1104 + (self.manual_download_instructions or "")
1105 + "\nOriginal error:\n"
1106 + str(e)
1107 ) from None

File /usr/local/lib/python3.8/dist-packages/datasets/builder.py:1860, in ArrowBasedBuilder._prepare_split(self, split_generator, file_format, num_proc, max_shard_size)
1858 job_id = 0
1859 with pbar:
-> 1860 for job_id, done, content in self._prepare_split_single(
1861 gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args
1862 ):
1863 if done:
1864 result = content

File /usr/local/lib/python3.8/dist-packages/datasets/builder.py:2016, in ArrowBasedBuilder._prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, job_id)
2014 if isinstance(e, DatasetGenerationError):
2015 raise
-> 2016 raise DatasetGenerationError("An error occurred while generating the dataset") from e
2018 yield job_id, True, (total_num_examples, total_num_bytes, writer._features, num_shards, shard_lengths)

DatasetGenerationError: An error occurred while generating the dataset

Salesforce org

I assume you are using the load_dataset function? For load_dataset, you need to specify a particular dataset - e.g. load_dataset('Salesforce/lotsa_data', 'pdb'). But I'd recommend you to use the dataset following the instructions in the codebase.

If anyone has difficulties downloading, do as follows:

from datasets import load_dataset

dataset_name = "Salesforce/lotsa_data" # large dataset, 210,311개
split = "train"

dict_dataset = {}
for label in list_data[0:3]:
try:
dataset = load_dataset(dataset_name, label, split='train')
dict_dataset[label] = dataset
except ValueError:
print(f"Error: {label}")
continue

Sign up or log in to comment