3030from sklearn .preprocessing import StandardScaler
3131from tqdm import tqdm
3232
33- from tensorflow_tts .processor import LJSpeechProcessor , BakerProcessor
33+
34+ from tensorflow_tts .processor import LJSpeechProcessor
35+ from tensorflow_tts .processor import BakerProcessor
36+
3437from tensorflow_tts .utils import remove_outlier
3538
3639os .environ ["CUDA_VISIBLE_DEVICES" ] = ""
@@ -41,7 +44,6 @@ def parse_and_config():
4144 parser = argparse .ArgumentParser (
4245 description = "Preprocess audio and text features "
4346 "(See detail in tensorflow_tts/bin/preprocess_dataset.py)."
44- )
4547 parser .add_argument (
4648 "--rootdir" ,
4749 default = None ,
@@ -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."
@@ -259,8 +261,7 @@ def preprocess():
259261
260262 logging .info (f"Selected '{ config ['dataset' ]} ' processor." )
261263 processor = dataset_processor [config ["dataset" ]](
262- config ["rootdir" ], cleaner_names = "english_cleaners" ,
263- target_rate = config ["sampling_rate" ]
264+ config ["rootdir" ], cleaner_names = "english_cleaners"
264265 )
265266
266267 # check output directories
@@ -289,13 +290,10 @@ def preprocess():
289290 # define map iterator
290291 def iterator_data (items_list ):
291292 for item in items_list :
292- sample = processor .get_one_sample (item )
293- if sample is not None :
294- yield sample
293+ yield processor .get_one_sample (item )
295294
296295 train_iterator_data = iterator_data (train_split )
297296 valid_iterator_data = iterator_data (valid_split )
298-
299297 p = Pool (config ["n_cpus" ])
300298
301299 # preprocess train files and get statistics for normalizing
@@ -417,4 +415,5 @@ def compute_statistics():
417415 # save statistics to file
418416 logging .info ("Saving computed statistics." )
419417 scaler_list = [(scaler_mel , "" ), (scaler_energy , "_energy" ), (scaler_f0 , "_f0" )]
420- save_statistics_to_file (scaler_list , config )
418+ save_statistics_to_file (scaler_list , config )
419+
0 commit comments