21
21
import torch
22
22
import lhotse
23
23
from pathlib import Path
24
- from lhotse import CutSet , Fbank , FbankConfig , LilcomChunkyWriter , fix_manifests , validate_recordings_and_supervisions
24
+ from lhotse import (
25
+ CutSet ,
26
+ Fbank ,
27
+ FbankConfig ,
28
+ LilcomChunkyWriter ,
29
+ fix_manifests ,
30
+ validate_recordings_and_supervisions ,
31
+ )
25
32
from icefall .utils import get_executor , str2bool
26
33
27
34
# Torch's multithreaded behavior needs to be disabled or
31
38
torch .set_num_threads (1 )
32
39
torch .set_num_interop_threads (1 )
33
40
41
+
34
42
def get_args ():
35
43
parser = argparse .ArgumentParser ()
36
44
@@ -79,10 +87,7 @@ def get_args():
79
87
)
80
88
81
89
parser .add_argument (
82
- "--num-jobs" ,
83
- type = int ,
84
- default = 50 ,
85
- help = "The num of jobs to extract feature."
90
+ "--num-jobs" , type = int , default = 50 , help = "The num of jobs to extract feature."
86
91
)
87
92
88
93
return parser .parse_args ()
@@ -109,11 +114,7 @@ def compute_feature(args, cuts):
109
114
if "train" in args .partition :
110
115
if args .perturb_speed :
111
116
logging .info (f"Doing speed perturb" )
112
- cuts = (
113
- cuts
114
- + cuts .perturb_speed (0.9 )
115
- + cuts .perturb_speed (1.1 )
116
- )
117
+ cuts = cuts + cuts .perturb_speed (0.9 ) + cuts .perturb_speed (1.1 )
117
118
cuts = cuts .compute_and_store_features (
118
119
extractor = extractor ,
119
120
storage_path = f"{ args .output_dir } /{ args .dataset } _feats_{ args .partition } " ,
@@ -132,7 +133,7 @@ def main(args):
132
133
compute_feature (args , cuts )
133
134
134
135
135
- if __name__ == ' __main__' :
136
+ if __name__ == " __main__" :
136
137
formatter = "%(asctime)s %(levelname)s [%(filename)s:%(lineno)d] %(message)s"
137
138
138
139
logging .basicConfig (format = formatter , level = logging .INFO )
0 commit comments