OUT_PATH = args.output_path if args.group_id == '' and args.output_folder == '': OUT_PATH = create_experiment_folder(OUT_PATH, c.run_name, args.debug) else: OUT_PATH = os.path.join(OUT_PATH, args.output_folder) AUDIO_PATH = os.path.join(OUT_PATH, 'test_audios') if args.rank == 0: os.makedirs(AUDIO_PATH, exist_ok=True) new_fields = {} if args.restore_path: new_fields["restore_path"] = args.restore_path new_fields["github_branch"] = get_git_branch() copy_config_file(args.config_path, os.path.join(OUT_PATH, 'config.json'), new_fields) os.chmod(AUDIO_PATH, 0o775) os.chmod(OUT_PATH, 0o775) if args.rank == 0: LOG_DIR = OUT_PATH tb_logger = Logger(LOG_DIR) # Conditional imports preprocessor = importlib.import_module('datasets.preprocess') preprocessor = getattr(preprocessor, c.dataset.lower()) # Audio processor ap = AudioProcessor(**c.audio) try:
if args.num_proc > 1: print(" > Using {} processes.".format(args.num_proc)) with Pool(args.num_proc) as p: r = list( tqdm.tqdm(p.imap(extract_mel, items), total=len(items))) # r = list(p.imap(extract_mel, file_names)) else: print(" > Using single process run.") for item in items: print(" > ", item[1]) r.append(extract_mel(item)) # Save meta data if args.cache_path is not None: file_path = os.path.join(CACHE_PATH, "tts_metadata_val.csv") file = open(file_path, "w") for line in r[:args.val_split]: line = "| ".join(line) file.write(line + '\n') file.close() file_path = os.path.join(CACHE_PATH, "tts_metadata.csv") file = open(file_path, "w") for line in r[args.val_split:]: line = "| ".join(line) file.write(line + '\n') file.close() # copy the used config file to output path for sanity copy_config_file(args.config, CACHE_PATH)