KeyError:"length" while using load_from_disk to load trivia_qa dataset

#11
by EdwardChang141017 - opened

I have downloaded trivia_qa dataset on local device, but when I use "load_from_disk" to load the dataset:
dataset = datasets.load_from_disk(f'{config.dir}/trivia_qa'),
it throws an error as follows:
Traceback (most recent call last):
File "/data/code/generate.py", line 76, in
dataset = datasets.load_from_disk(f'{config.output_dir}/trivia_qa')
File "/etc/miniconda3/envs/unanswerable/lib/python3.10/site-packages/datasets/load.py", line 1739, in load_from_disk
return Dataset.load_from_disk(dataset_path, fs, keep_in_memory=keep_in_memory)
File "/etc/miniconda3/envs/unanswerable/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 1217, in load_from_disk
return Dataset(
File "/etc/miniconda3/envs/unanswerable/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 679, in init
inferred_features = Features.from_arrow_schema(arrow_table.schema)
File "/etc/miniconda3/envs/unanswerable/lib/python3.10/site-packages/datasets/features/features.py", line 1533, in from_arrow_schema
return Features.from_dict(metadata["info"]["features"])
File "/etc/miniconda3/envs/unanswerable/lib/python3.10/site-packages/datasets/features/features.py", line 1562, in from_dict
obj = generate_from_dict(dic)
File "/etc/miniconda3/envs/unanswerable/lib/python3.10/site-packages/datasets/features/features.py", line 1263, in generate_from_dict
return {key: generate_from_dict(value) for key, value in obj.items()}
File "/etc/miniconda3/envs/unanswerable/lib/python3.10/site-packages/datasets/features/features.py", line 1263, in
return {key: generate_from_dict(value) for key, value in obj.items()}
File "/etc/miniconda3/envs/unanswerable/lib/python3.10/site-packages/datasets/features/features.py", line 1267, in generate_from_dict
return Sequence(feature=generate_from_dict(obj["feature"]), length=obj["length"])
KeyError: 'length'
I have no idea how to correct it.

Sign up or log in to comment