mirror of https://github.com/coqui-ai/TTS.git
fix(bin.extract_tts_spectrograms): set quantization bits
This commit is contained in:
parent
13e640f17e
commit
aa0fbdf27e
|
@ -159,7 +159,7 @@ def inference(
|
||||||
|
|
||||||
|
|
||||||
def extract_spectrograms(
|
def extract_spectrograms(
|
||||||
data_loader, model, ap, output_path, quantized_wav=False, save_audio=False, debug=False, metada_name="metada.txt"
|
data_loader, model, ap, output_path, quantize_bits=0, save_audio=False, debug=False, metada_name="metada.txt"
|
||||||
):
|
):
|
||||||
model.eval()
|
model.eval()
|
||||||
export_metadata = []
|
export_metadata = []
|
||||||
|
@ -196,8 +196,8 @@ def extract_spectrograms(
|
||||||
_, wavq_path, mel_path, wav_gl_path, wav_path = set_filename(wav_file_path, output_path)
|
_, wavq_path, mel_path, wav_gl_path, wav_path = set_filename(wav_file_path, output_path)
|
||||||
|
|
||||||
# quantize and save wav
|
# quantize and save wav
|
||||||
if quantized_wav:
|
if quantize_bits > 0:
|
||||||
wavq = ap.quantize(wav)
|
wavq = ap.quantize(wav, quantize_bits)
|
||||||
np.save(wavq_path, wavq)
|
np.save(wavq_path, wavq)
|
||||||
|
|
||||||
# save TTS mel
|
# save TTS mel
|
||||||
|
@ -263,7 +263,7 @@ def main(args): # pylint: disable=redefined-outer-name
|
||||||
model,
|
model,
|
||||||
ap,
|
ap,
|
||||||
args.output_path,
|
args.output_path,
|
||||||
quantized_wav=args.quantized,
|
quantize_bits=args.quantize_bits,
|
||||||
save_audio=args.save_audio,
|
save_audio=args.save_audio,
|
||||||
debug=args.debug,
|
debug=args.debug,
|
||||||
metada_name="metada.txt",
|
metada_name="metada.txt",
|
||||||
|
@ -277,7 +277,7 @@ if __name__ == "__main__":
|
||||||
parser.add_argument("--output_path", type=str, help="Path to save mel specs", required=True)
|
parser.add_argument("--output_path", type=str, help="Path to save mel specs", required=True)
|
||||||
parser.add_argument("--debug", default=False, action="store_true", help="Save audio files for debug")
|
parser.add_argument("--debug", default=False, action="store_true", help="Save audio files for debug")
|
||||||
parser.add_argument("--save_audio", default=False, action="store_true", help="Save audio files")
|
parser.add_argument("--save_audio", default=False, action="store_true", help="Save audio files")
|
||||||
parser.add_argument("--quantized", action="store_true", help="Save quantized audio files")
|
parser.add_argument("--quantize_bits", type=int, default=0, help="Save quantized audio files if non-zero")
|
||||||
parser.add_argument("--eval", type=bool, help="compute eval.", default=True)
|
parser.add_argument("--eval", type=bool, help="compute eval.", default=True)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue