Datasets:
ValueError while loading the dataset
While loading the dataset, a DatasetGenerationError is caused due to the following:
ValueError: Invalid string class label Credit reporting or other personal consumer reports.
Here's the code to replicate the issue:
from datasets import load_dataset
dataset = load_dataset('CFPB/consumer-finance-complaints')
Output:
Generating train split: 0%
1/3079747 [00:00<35:08:39, 24.34 examples/s]
ValueError Traceback (most recent call last)
/usr/local/lib/python3.11/dist-packages/datasets/builder.py in _prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id)
1692 )
-> 1693 example = self.info.features.encode_example(record) if self.info.features is not None else record
1694 writer.write(example, key)
14 frames
ValueError: Invalid string class label Credit reporting or other personal consumer reports
The above exception was the direct cause of the following exception:
DatasetGenerationError Traceback (most recent call last)
/usr/local/lib/python3.11/dist-packages/datasets/builder.py in _prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id)
1710 if isinstance(e, SchemaInferenceError) and e.context is not None:
1711 e = e.context
-> 1712 raise DatasetGenerationError("An error occurred while generating the dataset") from e
1713
1714 yield job_id, True, (total_num_examples, total_num_bytes, writer._features, num_shards, shard_lengths)
DatasetGenerationError: An error occurred while generating the dataset