Sidecar supports both vocoders and uses the one in the HTTP request

This commit is contained in:
Brandon Thomas committed 2021-08-25 02:21:59 -04:00
1 parent f4c8bb0095
commit 90e1db42c4
4 files changed
+16 -6

No files matched your search

+8 -5
View File
@@ -234,6 +234,7 @@ class TacotronWaveglowPipeline:
def infer(self, args):
assert('synthesizer_checkpoint_path' in args)
assert('vocoder_type' in args)
assert('raw_text' in args)
assert('output_audio_filename' in args)
assert('output_spectrogram_filename' in args)
@@ -246,13 +247,15 @@ class TacotronWaveglowPipeline:
with torch.no_grad():
mel_outputs, mel_outputs_postnet, _, alignments = tacotron.inference(sequence)
print('Saving spectrogram as JSON...')
save_spectorgram_json_file(mel_outputs_postnet, args['output_spectrogram_filename'])
if False:
if args['vocoder_type'] == 'hifigan-superres':
self.vocode_hifigan_superres(args, mel_outputs_postnet)
elif args['vocoder_type'] == 'waveglow':
self.vocode_waveglow(args, mel_outputs_postnet)
else:
self.vocode_hifigan_superres(args, mel_outputs_postnet)
raise Exception('Wrong vocoder type: {}'.format(args['vocoder_type']))
print('Saving spectrogram as JSON...')
save_spectorgram_json_file(mel_outputs_postnet, args['output_spectrogram_filename'])
print('Generating metadata file...')
generate_metadata_file(args['output_audio_filename'], args['output_metadata_filename'])
+3
View File
@@ -210,6 +210,7 @@ class ApiHandler():
# Request parameters
synthesizer_checkpoint_path = raw_data.get('synthesizer_checkpoint_path')
vocoder_type = raw_data.get('vocoder_type')
waveglow_vocoder_checkpoint_path = raw_data.get('waveglow_vocoder_checkpoint_path')
hifigan_vocoder_checkpoint_path = raw_data.get('hifigan_vocoder_checkpoint_path')
hifigan_superres_vocoder_checkpoint_path = raw_data.get('hifigan_superres_vocoder_checkpoint_path')
@@ -223,6 +224,7 @@ class ApiHandler():
raw_data.get('maybe_clear_synthesizer_checkpoint_path')
print('synthesizer_checkpoint_path: {}'.format(synthesizer_checkpoint_path))
print('vocoder_type: {}'.format(vocoder_type))
print('waveglow_vocoder_checkpoint_path: {}'.format(waveglow_vocoder_checkpoint_path))
print('hifigan_vocoder_checkpoint_path: {}'.format(hifigan_vocoder_checkpoint_path))
print('hifigan_superres_vocoder_checkpoint_path: {}'.format(hifigan_superres_vocoder_checkpoint_path))
@@ -245,6 +247,7 @@ class ApiHandler():
inference_args = {
'raw_text': inference_text,
'synthesizer_checkpoint_path': synthesizer_checkpoint_path,
'vocoder_type': vocoder_type,
'output_audio_filename': output_audio_filename,
'output_spectrogram_filename': output_spectrogram_filename,
'output_metadata_filename': output_metadata_filename,
+4
View File
@@ -7,7 +7,11 @@ use crate::util::anyhow_result::AnyhowResult;
#[serde(rename_all = "lowercase")]
#[sqlx(rename_all = "lowercase")]
pub enum VocoderType {
/// Current state of the art vocoder
#[serde(rename = "hifigan-superres")]
HifiGanSuperResolution,
/// Older WaveGlow vocoder
WaveGlow,
}
+1 -1
View File
@@ -665,7 +665,7 @@ async fn process_job(
inferencer.tts_inference_sidecar_client.request_inference(
&job.raw_inference_text,
&tts_synthesizer_fs_path,
VocoderType::WaveGlow,
VocoderType::HifiGanSuperResolution,
&hifigan_vocoder_model_fs_path,
&hifigan_superres_vocoder_model_fs_path,
&waveglow_vocoder_model_fs_path,