mirror of https://github.com/coqui-ai/TTS.git
Remove tqdm from extract_feat
This commit is contained in:
parent
7188676559
commit
b7be415396
|
@ -8,7 +8,7 @@ import glob
|
||||||
import argparse
|
import argparse
|
||||||
import librosa
|
import librosa
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import tqdm
|
# import tqdm
|
||||||
from utils.audio import AudioProcessor
|
from utils.audio import AudioProcessor
|
||||||
from utils.generic_utils import load_config
|
from utils.generic_utils import load_config
|
||||||
|
|
||||||
|
@ -25,13 +25,11 @@ if __name__ == "__main__":
|
||||||
parser.add_argument("--num_proc", type=int, default=8,
|
parser.add_argument("--num_proc", type=int, default=8,
|
||||||
help="number of processes.")
|
help="number of processes.")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
print(" > Input path: ", DATA_PATH)
|
|
||||||
print(" > Output path: ", OUT_PATH)
|
|
||||||
|
|
||||||
DATA_PATH = args.data_path
|
DATA_PATH = args.data_path
|
||||||
OUT_PATH = args.out_path
|
OUT_PATH = args.out_path
|
||||||
CONFIG = load_config(args.config)
|
CONFIG = load_config(args.config)
|
||||||
|
print(" > Input path: ", DATA_PATH)
|
||||||
|
print(" > Output path: ", OUT_PATH)
|
||||||
ap = AudioProcessor(sample_rate = CONFIG.sample_rate,
|
ap = AudioProcessor(sample_rate = CONFIG.sample_rate,
|
||||||
num_mels = CONFIG.num_mels,
|
num_mels = CONFIG.num_mels,
|
||||||
min_level_db = CONFIG.min_level_db,
|
min_level_db = CONFIG.min_level_db,
|
||||||
|
@ -46,8 +44,8 @@ if __name__ == "__main__":
|
||||||
def extract_mel(file_path):
|
def extract_mel(file_path):
|
||||||
# x, fs = sf.read(file_path)
|
# x, fs = sf.read(file_path)
|
||||||
x, fs = librosa.load(file_path, CONFIG.sample_rate)
|
x, fs = librosa.load(file_path, CONFIG.sample_rate)
|
||||||
mel = ap.melspectrogram(x.astype('float32'))
|
mel = ap.melspectrogram(x.astype('float32')).astype('float32')
|
||||||
linear = ap.spectrogram(x.astype('float32'))
|
linear = ap.spectrogram(x.astype('float32')).astype('float32')
|
||||||
file_name = os.path.basename(file_path).replace(".wav","")
|
file_name = os.path.basename(file_path).replace(".wav","")
|
||||||
mel_file = file_name + ".mel"
|
mel_file = file_name + ".mel"
|
||||||
linear_file = file_name + ".linear"
|
linear_file = file_name + ".linear"
|
||||||
|
@ -73,7 +71,8 @@ if __name__ == "__main__":
|
||||||
if args.num_proc > 1:
|
if args.num_proc > 1:
|
||||||
print(" > Using {} processes.".format(args.num_proc))
|
print(" > Using {} processes.".format(args.num_proc))
|
||||||
with Pool(args.num_proc) as p:
|
with Pool(args.num_proc) as p:
|
||||||
r = list(tqdm.tqdm(p.imap(extract_mel, file_names), total=len(file_names)))
|
# r = list(tqdm.tqdm(p.imap(extract_mel, file_names), total=len(file_names)))
|
||||||
|
r = list(p.imap(extract_mel, file_names))
|
||||||
else:
|
else:
|
||||||
print(" > Using single process run.")
|
print(" > Using single process run.")
|
||||||
for file_name in file_names:
|
for file_name in file_names:
|
||||||
|
|
Loading…
Reference in New Issue