3030from sklearn .preprocessing import StandardScaler
3131from tqdm import tqdm
3232
33- from tensorflow_tts .processor import LJSpeechProcessor , BakerProcessor
33+ from tensorflow_tts .processor import LJSpeechProcessor
34+ from tensorflow_tts .processor import BakerProcessor
35+
3436from tensorflow_tts .utils import remove_outlier
3537
3638os .environ ["CUDA_VISIBLE_DEVICES" ] = ""
@@ -60,8 +62,8 @@ def parse_and_config():
6062 "--dataset" ,
6163 type = str ,
6264 default = "ljspeech" ,
63- choices = ["ljspeech" , " baker" ],
64- help = "Dataset to preprocess. Currently only LJSpeech. " ,
65+ choices = ["ljspeech, baker" ],
66+ help = "Dataset to preprocess. Currently only ( LJSpeech, baker) " ,
6567 )
6668 parser .add_argument (
6769 "--config" , type = str , required = True , help = "YAML format configuration file."
@@ -252,15 +254,11 @@ def preprocess():
252254 """Run preprocessing process and compute statistics for normalizing."""
253255 config = parse_and_config ()
254256
255- dataset_processor = {
256- "ljspeech" : LJSpeechProcessor ,
257- "baker" : BakerProcessor
258- }
257+ dataset_processor = {"ljspeech" : LJSpeechProcessor , "baker" : BakerProcessor }
259258
260259 logging .info (f"Selected '{ config ['dataset' ]} ' processor." )
261260 processor = dataset_processor [config ["dataset" ]](
262- config ["rootdir" ], cleaner_names = "english_cleaners" ,
263- target_rate = config ["sampling_rate" ]
261+ config ["rootdir" ], cleaner_names = "english_cleaners"
264262 )
265263
266264 # check output directories
@@ -289,9 +287,7 @@ def preprocess():
289287 # define map iterator
290288 def iterator_data (items_list ):
291289 for item in items_list :
292- sample = processor .get_one_sample (item )
293- if sample is not None :
294- yield sample
290+ yield processor .get_one_sample (item )
295291
296292 train_iterator_data = iterator_data (train_split )
297293 valid_iterator_data = iterator_data (valid_split )
@@ -417,4 +413,5 @@ def compute_statistics():
417413 # save statistics to file
418414 logging .info ("Saving computed statistics." )
419415 scaler_list = [(scaler_mel , "" ), (scaler_energy , "_energy" ), (scaler_f0 , "_f0" )]
420- save_statistics_to_file (scaler_list , config )
416+ save_statistics_to_file (scaler_list , config )
417+
0 commit comments