dlxj commited on
Commit
eecbab9
·
1 Parent(s): 0cd4b22

同时生成多个tar 数据集

Browse files
Files changed (2) hide show
  1. convert_ja_tar.py +32 -11
  2. readme.txt +8 -2
convert_ja_tar.py CHANGED
@@ -7,17 +7,38 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "scripts
7
  import convert_to_tarred_audio_dataset
8
 
9
  def main():
10
- convert_to_tarred_audio_dataset.create_tar_datasets(
11
- manifest_path="data/common_voice_11_0/ja/train/train_common_voice_11_0_manifest.json",
12
- target_dir="data/common_voice_11_0/ja/train_tarred_1bk",
13
- num_shards=1024,
14
- max_duration=15.0,
15
- min_duration=1.0,
16
- shuffle=True,
17
- shuffle_seed=1,
18
- sort_in_shards=True,
19
- workers=-1
20
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  if __name__ == "__main__":
23
  main()
 
7
  import convert_to_tarred_audio_dataset
8
 
9
  def main():
10
+ datasets = [
11
+ {
12
+ "manifest_path": "data/common_voice_11_0/ja/train/train_common_voice_11_0_manifest.json",
13
+ "target_dir": "data/common_voice_11_0/ja/train_tarred_1bk",
14
+ "num_shards": 1024
15
+ },
16
+ {
17
+ "manifest_path": "data/common_voice_11_0/ja/validation/validation_common_voice_11_0_manifest.json",
18
+ "target_dir": "data/common_voice_11_0/ja/validation_tarred_1bk",
19
+ "num_shards": 32 # 验证集通常比训练集小,使用较少的 shard
20
+ },
21
+ {
22
+ "manifest_path": "data/common_voice_11_0/ja/test/test_common_voice_11_0_manifest.json",
23
+ "target_dir": "data/common_voice_11_0/ja/test_tarred_1bk",
24
+ "num_shards": 32 # 测试集通常比训练集小,使用较少的 shard
25
+ }
26
+ ]
27
+
28
+ for dataset in datasets:
29
+ print(f"Processing dataset: {dataset['manifest_path']}")
30
+ convert_to_tarred_audio_dataset.create_tar_datasets(
31
+ manifest_path=dataset["manifest_path"],
32
+ target_dir=dataset["target_dir"],
33
+ num_shards=dataset["num_shards"],
34
+ max_duration=15.0,
35
+ min_duration=1.0,
36
+ shuffle=True,
37
+ shuffle_seed=1,
38
+ sort_in_shards=True,
39
+ workers=-1
40
+ )
41
+ print(f"Finished processing dataset: {dataset['manifest_path']}\n")
42
 
43
  if __name__ == "__main__":
44
  main()
readme.txt CHANGED
@@ -56,8 +56,14 @@ python scripts/speech_recognition/convert_to_tarred_audio_dataset.py \
56
  --workers=-1
57
 
58
 
59
- 修复 nemo-toolkit 中的 SIGKILL 问题
60
- python patch_nemo.py
 
 
 
 
 
 
61
 
62
 
63
 
 
56
  --workers=-1
57
 
58
 
59
+ 生成 tar 数据集
60
+ convert_ja_tar.py
61
+
62
+ 修复 nemo-toolkit 中的 SIGKILL 问题
63
+ python patch_nemo.py
64
+
65
+
66
+
67
 
68
 
69