mirror of https://github.com/coqui-ai/TTS.git
update compute_statistics for coqpit
This commit is contained in:
parent
79d7215142
commit
c34c8137d7
|
@ -10,19 +10,22 @@ from tqdm import tqdm
|
|||
|
||||
from TTS.tts.datasets.preprocess import load_meta_data
|
||||
from TTS.utils.audio import AudioProcessor
|
||||
from TTS.utils.io import load_config
|
||||
|
||||
# from TTS.utils.io import load_config
|
||||
from TTS.utils.config import load_config
|
||||
|
||||
|
||||
def main():
|
||||
"""Run preprocessing process."""
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Compute mean and variance of spectrogtram features.")
|
||||
parser.add_argument("config_path", type=str,
|
||||
help="TTS config file path to define audio processin parameters.")
|
||||
parser.add_argument("out_path", type=str,
|
||||
help="save path (directory and filename).")
|
||||
parser.add_argument("--data_path", type=str, required=False,
|
||||
help="folder including the target set of wavs overriding dataset config.")
|
||||
parser = argparse.ArgumentParser(description="Compute mean and variance of spectrogtram features.")
|
||||
parser.add_argument("config_path", type=str, help="TTS config file path to define audio processin parameters.")
|
||||
parser.add_argument("out_path", type=str, help="save path (directory and filename).")
|
||||
parser.add_argument(
|
||||
"--data_path",
|
||||
type=str,
|
||||
required=False,
|
||||
help="folder including the target set of wavs overriding dataset config.",
|
||||
)
|
||||
args, overrides = parser.parse_known_args()
|
||||
|
||||
CONFIG = load_config(args.config_path)
|
||||
|
@ -37,7 +40,7 @@ def main():
|
|||
|
||||
# load the meta data of target dataset
|
||||
if args.data_path:
|
||||
dataset_items = glob.glob(os.path.join(args.data_path, '**', '*.wav'), recursive=True)
|
||||
dataset_items = glob.glob(os.path.join(args.data_path, "**", "*.wav"), recursive=True)
|
||||
else:
|
||||
dataset_items = load_meta_data(CONFIG.dataset_config)[0] # take only train data
|
||||
print(f" > There are {len(dataset_items)} files.")
|
||||
|
@ -85,7 +88,7 @@ def main():
|
|||
del CONFIG.audio.min_level_db
|
||||
del CONFIG.audio.symmetric_norm
|
||||
del CONFIG.audio.clip_norm
|
||||
stats['audio_config'] = CONFIG.audio.to_dict()
|
||||
stats["audio_config"] = CONFIG.audio.to_dict()
|
||||
np.save(output_file_path, stats, allow_pickle=True)
|
||||
print(f" > stats saved to {output_file_path}")
|
||||
|
||||
|
|
Loading…
Reference in New Issue