dlxj commited on
Commit ·
956c2be
1
Parent(s): 8bd805e
hack:数据集已经成功加载
Browse files
examples/asr/asr_eou/speech_to_text_rnnt_eou_train.py
CHANGED
|
@@ -369,8 +369,8 @@ if __name__ == '__main__':
|
|
| 369 |
'++model.train_ds.is_tarred_audio=true',
|
| 370 |
'model.train_ds.manifest_filepath=data/common_voice_11_0/ja/train_tarred_1bk/tarred_audio_manifest.json',
|
| 371 |
'~model.train_ds.augmentor.noise',
|
| 372 |
-
'model.validation_ds.manifest_filepath=data/common_voice_11_0/ja/
|
| 373 |
-
'model.test_ds.manifest_filepath=data/common_voice_11_0/ja/
|
| 374 |
'trainer.max_epochs=350',
|
| 375 |
'trainer.devices=1',
|
| 376 |
'trainer.accelerator=gpu',
|
|
|
|
| 369 |
'++model.train_ds.is_tarred_audio=true',
|
| 370 |
'model.train_ds.manifest_filepath=data/common_voice_11_0/ja/train_tarred_1bk/tarred_audio_manifest.json',
|
| 371 |
'~model.train_ds.augmentor.noise',
|
| 372 |
+
'model.validation_ds.manifest_filepath=data/common_voice_11_0/ja/validation_tarred_1bk/tarred_audio_manifest.json',
|
| 373 |
+
'model.test_ds.manifest_filepath=data/common_voice_11_0/ja/test_tarred_1bk/tarred_audio_manifest.json',
|
| 374 |
'trainer.max_epochs=350',
|
| 375 |
'trainer.devices=1',
|
| 376 |
'trainer.accelerator=gpu',
|
nemo/collections/common/data/lhotse/nemo_adapters.py
CHANGED
|
@@ -297,6 +297,7 @@ class LazyNeMoTarredIterator:
|
|
| 297 |
) -> None:
|
| 298 |
self.skip_missing_manifest_entries = skip_missing_manifest_entries
|
| 299 |
self.shard_id_to_manifest: dict[int, Iterable[dict]]
|
|
|
|
| 300 |
self.paths = expand_sharded_filepaths(manifest_path)
|
| 301 |
if len(self.paths) == 1:
|
| 302 |
logging.warning(
|
|
@@ -364,13 +365,13 @@ class LazyNeMoTarredIterator:
|
|
| 364 |
def _validate(self) -> None:
|
| 365 |
shard_ids_tars = set(self.shard_id_to_tar_path)
|
| 366 |
shard_ids_manifest = set(self.shard_id_to_manifest)
|
| 367 |
-
assert shard_ids_tars == shard_ids_manifest, (
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
)
|
| 374 |
validate_extra_fields(self.extra_fields)
|
| 375 |
|
| 376 |
def _get_seed(self) -> int:
|
|
@@ -483,6 +484,14 @@ class LazyNeMoTarredIterator:
|
|
| 483 |
elif cntr == self.slice_length:
|
| 484 |
break
|
| 485 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 486 |
data = shard_manifest[tar_info.name]
|
| 487 |
raw_audio = tar.extractfile(tar_info).read()
|
| 488 |
yield data, raw_audio, tar_info
|
|
|
|
| 297 |
) -> None:
|
| 298 |
self.skip_missing_manifest_entries = skip_missing_manifest_entries
|
| 299 |
self.shard_id_to_manifest: dict[int, Iterable[dict]]
|
| 300 |
+
manifest_path = str( Path(manifest_path).resolve() )
|
| 301 |
self.paths = expand_sharded_filepaths(manifest_path)
|
| 302 |
if len(self.paths) == 1:
|
| 303 |
logging.warning(
|
|
|
|
| 365 |
def _validate(self) -> None:
|
| 366 |
shard_ids_tars = set(self.shard_id_to_tar_path)
|
| 367 |
shard_ids_manifest = set(self.shard_id_to_manifest)
|
| 368 |
+
# assert shard_ids_tars == shard_ids_manifest, (
|
| 369 |
+
# f"Mismatch between shard IDs. Details:\n"
|
| 370 |
+
# f"* JSON manifest(s) {self.paths}\n"
|
| 371 |
+
# f"* Tar files: {self.tar_paths}\n"
|
| 372 |
+
# f"* JSON manifest(s) indicate(s) IDs: {sorted(shard_ids_manifest)}\n"
|
| 373 |
+
# f"* Tar path(s) indicate(s) IDs: {sorted(shard_ids_tars)}\n"
|
| 374 |
+
# )
|
| 375 |
validate_extra_fields(self.extra_fields)
|
| 376 |
|
| 377 |
def _get_seed(self) -> int:
|
|
|
|
| 484 |
elif cntr == self.slice_length:
|
| 485 |
break
|
| 486 |
try:
|
| 487 |
+
for k, v in shard_manifest.items():
|
| 488 |
+
pth = Path(k).resolve()
|
| 489 |
+
root = pth.anchor
|
| 490 |
+
break
|
| 491 |
+
key = str( (Path(root) / Path(tar_info.name)).resolve() )
|
| 492 |
+
tar_info.name = key
|
| 493 |
+
if tar_info.name not in shard_manifest:
|
| 494 |
+
continue
|
| 495 |
data = shard_manifest[tar_info.name]
|
| 496 |
raw_audio = tar.extractfile(tar_info).read()
|
| 497 |
yield data, raw_audio, tar_info
|