> {
- Waveglow {
- waveglow_vocoder_checkpoint_path: P,
- },
- HifiganSuperres {
- hifigan_vocoder_checkpoint_path: P,
- hifigan_superres_vocoder_checkpoint_path: P,
- }
-}
-
pub enum MelMultiplyFactor {
// NB: Default is typically "1.4"
DefaultMultiplyFactor,
diff --git a/crates/service/job/inference_job/src/job/job_types/tts/tacotron2_v2_early_fakeyou/tacotron2_inference_sidecar_client.rs b/crates/service/job/inference_job/src/job/job_types/tts/tacotron2_v2_early_fakeyou/tacotron2_inference_sidecar_client.rs
index 52ea364e5d..613a47bfb0 100644
--- a/crates/service/job/inference_job/src/job/job_types/tts/tacotron2_v2_early_fakeyou/tacotron2_inference_sidecar_client.rs
+++ b/crates/service/job/inference_job/src/job/job_types/tts/tacotron2_v2_early_fakeyou/tacotron2_inference_sidecar_client.rs
@@ -6,8 +6,11 @@ use hyper::client::Client;
use log::info;
use container_common::anyhow_result::AnyhowResult;
+use filesys::path_to_string::path_to_string;
use mysql_queries::column_types::vocoder_type::VocoderType;
+use crate::job::job_types::tts::tacotron2_v2_early_fakeyou::vocoder_option::VocoderForInferenceOption;
+
/// This is used to talk to the TT2 Python HTTP sidecar (rather than shelling out over bash).
/// This keeps models loaded in memory and results in faster inference time.
@@ -67,11 +70,8 @@ impl Tacotron2InferenceSidecarClient {
raw_text: &str,
max_decoder_steps: u32,
synthesizer_checkpoint_path: P,
- vocoder_type: VocoderType,
text_pipeline_type: &str,
- hifigan_vocoder_checkpoint_path: P,
- hifigan_superres_vocoder_checkpoint_path: P,
- waveglow_vocoder_checkpoint_path: P,
+ vocoder_option: VocoderForInferenceOption,
output_audio_filename: P,
output_spectrogram_filename: P,
output_metadata_filename: P,
@@ -80,23 +80,30 @@ impl Tacotron2InferenceSidecarClient {
maybe_custom_mel_multiply_factor: Option,
) -> AnyhowResult<()> {
- let waveglow_vocoder_checkpoint_path = waveglow_vocoder_checkpoint_path
- .as_ref()
- .to_str()
- .map(|s| s.to_string())
- .ok_or(anyhow!("bad waveglow vocoder path"))?;
+ // TODO(bt,2023-11-26): Clean this mutability / multi-configuration up
+ let vocoder_type;
- let hifigan_vocoder_checkpoint_path = hifigan_vocoder_checkpoint_path
- .as_ref()
- .to_str()
- .map(|s| s.to_string())
- .ok_or(anyhow!("bad hifigan vocoder path"))?;
+ let waveglow_vocoder_checkpoint_path;
+ let hifigan_vocoder_checkpoint_path;
+ let hifigan_superres_vocoder_checkpoint_path;
- let hifigan_superres_vocoder_checkpoint_path = hifigan_superres_vocoder_checkpoint_path
- .as_ref()
- .to_str()
- .map(|s| s.to_string())
- .ok_or(anyhow!("bad hifigan super resolution vocoder path"))?;
+ match vocoder_option {
+ VocoderForInferenceOption::Waveglow { waveglow_vocoder_checkpoint_path : path } => {
+ vocoder_type = VocoderType::WaveGlow;
+ waveglow_vocoder_checkpoint_path = path_to_string(path.as_ref());
+ hifigan_vocoder_checkpoint_path = "BOGUS_NOT_USED".to_string();
+ hifigan_superres_vocoder_checkpoint_path = "BOGUS_NOT_USED".to_string();
+ }
+ VocoderForInferenceOption::HifiganSuperres {
+ hifigan_vocoder_checkpoint_path: path,
+ hifigan_superres_vocoder_checkpoint_path : super_res_path,
+ } => {
+ vocoder_type = VocoderType::HifiGanSuperResolution;
+ waveglow_vocoder_checkpoint_path = "BOGUS_NOT_USED".to_string();
+ hifigan_vocoder_checkpoint_path = path_to_string(path.as_ref());
+ hifigan_superres_vocoder_checkpoint_path = path_to_string(super_res_path.as_ref());
+ }
+ }
let synthesizer_checkpoint_path = synthesizer_checkpoint_path
.as_ref()
diff --git a/crates/service/job/inference_job/src/job/job_types/tts/tacotron2_v2_early_fakeyou/vocoder_option.rs b/crates/service/job/inference_job/src/job/job_types/tts/tacotron2_v2_early_fakeyou/vocoder_option.rs
new file mode 100644
index 0000000000..1a2e4669f7
--- /dev/null
+++ b/crates/service/job/inference_job/src/job/job_types/tts/tacotron2_v2_early_fakeyou/vocoder_option.rs
@@ -0,0 +1,13 @@
+use std::path::Path;
+
+#[derive(Clone)]
+pub enum VocoderForInferenceOption> {
+ Waveglow {
+ waveglow_vocoder_checkpoint_path: P,
+ },
+ HifiganSuperres {
+ hifigan_vocoder_checkpoint_path: P,
+ hifigan_superres_vocoder_checkpoint_path: P,
+ }
+}
+