Datasets:
Dataset rewiew request for nb_samtale
#1
by
ingerid
- opened
Description
NB Samtale is a speech corpus for ASR made by the Language Bank at the National Library of Norway.
It consists of ~12 000 sentence segment .wav
-files which have been compressed to six different tarballs, with three {split}_metadata.jsonl-files. Each tarball contains audio segments that are transcribed in either the bokmål
(bm) written form of Norwegian, or in nynorsk
(nn).
I have followed the " Create an audio dataset" guide and struggle to load my dataset with the loading script locally:
>>> datasets.load_dataset("nb_samtale.py")
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
File ~/.pyenv/versions/3.11.4/envs/talenv/lib/python3.11/site-packages/datasets/builder.py:1693, in GeneratorBasedBuilder._prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id)
1684 writer = writer_class(
1685 features=writer._features,
1686 path=fpath.replace("SSSSS", f"{shard_id:05d}").replace("JJJJJ", f"{job_id:05d}"),
(...)
1691 embed_local_files=embed_local_files,
1692 )
-> 1693 example = self.info.features.encode_example(record) if self.info.features is not None else record
1694 writer.write(example, key)
File ~/.pyenv/versions/3.11.4/envs/talenv/lib/python3.11/site-packages/datasets/features/features.py:1852, in Features.encode_example(self, example)
1851 example = cast_to_python_objects(example)
-> 1852 return encode_nested_example(self, example)
File ~/.pyenv/versions/3.11.4/envs/talenv/lib/python3.11/site-packages/datasets/features/features.py:1229, in encode_nested_example(schema, obj, level)
1227 raise ValueError("Got None but expected a dictionary instead")
1228 return (
-> 1229 {
1230 k: encode_nested_example(sub_schema, sub_obj, level=level + 1)
1231 for k, (sub_schema, sub_obj) in zip_dict(schema, obj)
1232 }
1233 if obj is not None
1234 else None
1235 )
1237 elif isinstance(schema, (list, tuple)):
File ~/.pyenv/versions/3.11.4/envs/talenv/lib/python3.11/site-packages/datasets/features/features.py:1229, in <dictcomp>(.0)
1227 raise ValueError("Got None but expected a dictionary instead")
1228 return (
-> 1229 {
1230 k: encode_nested_example(sub_schema, sub_obj, level=level + 1)
1231 for k, (sub_schema, sub_obj) in zip_dict(schema, obj)
1232 }
1233 if obj is not None
1234 else None
1235 )
1237 elif isinstance(schema, (list, tuple)):
File ~/.pyenv/versions/3.11.4/envs/talenv/lib/python3.11/site-packages/datasets/utils/py_utils.py:323, in zip_dict(*dicts)
321 for key in unique_values(itertools.chain(*dicts)): # set merge all keys
322 # Will raise KeyError if the dict don't have the same keys
--> 323 yield key, tuple(d[key] for d in dicts)
File ~/.pyenv/versions/3.11.4/envs/talenv/lib/python3.11/site-packages/datasets/utils/py_utils.py:323, in <genexpr>(.0)
321 for key in unique_values(itertools.chain(*dicts)): # set merge all keys
322 # Will raise KeyError if the dict don't have the same keys
--> 323 yield key, tuple(d[key] for d in dicts)
KeyError: 'path'
The above exception was the direct cause of the following exception:
DatasetGenerationError Traceback (most recent call last)
/home/ingeridd/prosjekter/nb_samtale/load_.ipynb Cell 2 line 3
1 #dataset_path ="Sprakbanken/nb_samtale"
2 dataset_path = "nb_samtale.py"
----> 3 ds = datasets.load_dataset(dataset_path)# 'annotations', split="validation")
File ~/.pyenv/versions/3.11.4/envs/talenv/lib/python3.11/site-packages/datasets/load.py:2153, in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, verification_mode, ignore_verifications, keep_in_memory, save_infos, revision, token, use_auth_token, task, streaming, num_proc, storage_options, **config_kwargs)
2150 try_from_hf_gcs = path not in _PACKAGED_DATASETS_MODULES
2152 # Download and prepare data
-> 2153 builder_instance.download_and_prepare(
2154 download_config=download_config,
2155 download_mode=download_mode,
2156 verification_mode=verification_mode,
2157 try_from_hf_gcs=try_from_hf_gcs,
2158 num_proc=num_proc,
2159 storage_options=storage_options,
2160 )
2162 # Build dataset for splits
2163 keep_in_memory = (
2164 keep_in_memory if keep_in_memory is not None else is_small_dataset(builder_instance.info.dataset_size)
2165 )
File ~/.pyenv/versions/3.11.4/envs/talenv/lib/python3.11/site-packages/datasets/builder.py:954, 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)
952 if num_proc is not None:
953 prepare_split_kwargs["num_proc"] = num_proc
--> 954 self._download_and_prepare(
955 dl_manager=dl_manager,
956 verification_mode=verification_mode,
957 **prepare_split_kwargs,
958 **download_and_prepare_kwargs,
959 )
960 # Sync info
961 self.info.dataset_size = sum(split.num_bytes for split in self.info.splits.values())
File ~/.pyenv/versions/3.11.4/envs/talenv/lib/python3.11/site-packages/datasets/builder.py:1717, in GeneratorBasedBuilder._download_and_prepare(self, dl_manager, verification_mode, **prepare_splits_kwargs)
1716 def _download_and_prepare(self, dl_manager, verification_mode, **prepare_splits_kwargs):
-> 1717 super()._download_and_prepare(
1718 dl_manager,
1719 verification_mode,
1720 check_duplicate_keys=verification_mode == VerificationMode.BASIC_CHECKS
1721 or verification_mode == VerificationMode.ALL_CHECKS,
1722 **prepare_splits_kwargs,
1723 )
File ~/.pyenv/versions/3.11.4/envs/talenv/lib/python3.11/site-packages/datasets/builder.py:1049, in DatasetBuilder._download_and_prepare(self, dl_manager, verification_mode, **prepare_split_kwargs)
1045 split_dict.add(split_generator.split_info)
1047 try:
1048 # Prepare split will record examples associated to the split
-> 1049 self._prepare_split(split_generator, **prepare_split_kwargs)
1050 except OSError as e:
1051 raise OSError(
1052 "Cannot find data file. "
1053 + (self.manual_download_instructions or "")
1054 + "\nOriginal error:\n"
1055 + str(e)
1056 ) from None
File ~/.pyenv/versions/3.11.4/envs/talenv/lib/python3.11/site-packages/datasets/builder.py:1555, in GeneratorBasedBuilder._prepare_split(self, split_generator, check_duplicate_keys, file_format, num_proc, max_shard_size)
1553 job_id = 0
1554 with pbar:
-> 1555 for job_id, done, content in self._prepare_split_single(
1556 gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args
1557 ):
1558 if done:
1559 result = content
File ~/.pyenv/versions/3.11.4/envs/talenv/lib/python3.11/site-packages/datasets/builder.py:1712, in GeneratorBasedBuilder._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
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
Files to review
- nb_samtale.py
Hi! Dictionaries returned in _generate_examples
contain path
as one of the keys, but path
is not in the Features
dictionary, hence the error.
Thank you!
ingerid
changed discussion status to
closed