diff --git a/crates/service/job/inference_job/src/job/job_types/tts/tacotron2_v2_early_fakeyou/mod.rs b/crates/service/job/inference_job/src/job/job_types/tts/tacotron2_v2_early_fakeyou/mod.rs index 83dc785b01..2fe98087b1 100644 --- a/crates/service/job/inference_job/src/job/job_types/tts/tacotron2_v2_early_fakeyou/mod.rs +++ b/crates/service/job/inference_job/src/job/job_types/tts/tacotron2_v2_early_fakeyou/mod.rs @@ -1,4 +1,5 @@ pub mod process_job; pub mod read_metadata_file; pub mod seconds_to_decoder_steps; +pub mod tacotron2_dependencies; pub mod tacotron2_inference_command; diff --git a/crates/service/job/inference_job/src/job/job_types/tts/tacotron2_v2_early_fakeyou/process_job.rs b/crates/service/job/inference_job/src/job/job_types/tts/tacotron2_v2_early_fakeyou/process_job.rs index 45e75397a9..1885ccf15d 100644 --- a/crates/service/job/inference_job/src/job/job_types/tts/tacotron2_v2_early_fakeyou/process_job.rs +++ b/crates/service/job/inference_job/src/job/job_types/tts/tacotron2_v2_early_fakeyou/process_job.rs @@ -32,7 +32,6 @@ use crate::util::maybe_download_file_from_bucket::maybe_download_file_from_bucke /// This allows the request to bypass the model cache and query the latest TTS model. const TEST_REQUEST_TEXT: &str = "This is a test request."; - pub struct ProcessJobArgs<'a> { pub job_dependencies: &'a JobDependencies, pub job: &'a AvailableInferenceJob, @@ -50,10 +49,18 @@ pub async fn process_job(args: ProcessJobArgs<'_>) -> Result) -> Result) -> Result) -> Result None, @@ -249,7 +258,7 @@ pub async fn process_job(args: ProcessJobArgs<'_>) -> Result AnyhowResult { + + let waveglow_vocoder_model_filename = easyenv::get_env_string_or_default( + "TTS_WAVEGLOW_VOCODER_MODEL_FILENAME", "waveglow.pth"); + + let hifigan_vocoder_model_filename = easyenv::get_env_string_or_default( + "TTS_HIFIGAN_VOCODER_MODEL_FILENAME", "hifigan.pth"); + + let hifigan_superres_vocoder_model_filename = easyenv::get_env_string_or_default( + "TTS_HIFIGAN_SUPERRES_VOCODER_MODEL_FILENAME", "hifigan_superres.pth"); + + Ok(Self { + inference_command: Tacotron2InferenceCommand::from_env()?, + waveglow_vocoder_model_filename, + hifigan_vocoder_model_filename, + hifigan_superres_vocoder_model_filename, + }) + } +} diff --git a/crates/service/job/inference_job/src/job_dependencies.rs b/crates/service/job/inference_job/src/job_dependencies.rs index 0a2ad77659..1f9b6477e3 100644 --- a/crates/service/job/inference_job/src/job_dependencies.rs +++ b/crates/service/job/inference_job/src/job_dependencies.rs @@ -24,7 +24,6 @@ use mysql_queries::queries::tts::tts_models::get_tts_model_for_inference_improve use mysql_queries::queries::voice_conversion::inference::get_voice_conversion_model_for_inference::VoiceConversionModelForInference; use newrelic_telemetry::Client as NewRelicClient; -use crate::job::job_types::tts::tacotron2_v2_early_fakeyou::tacotron2_inference_command::Tacotron2InferenceCommand; use crate::job::job_types::tts::vall_e_x::model_downloaders::VallEXDownloaders; use crate::job::job_types::tts::vall_e_x::vall_e_x_inference_command::VallEXCreateEmbeddingCommand; use crate::job::job_types::tts::vall_e_x::vall_e_x_inference_command::VallEXInferenceCommand; @@ -158,25 +157,8 @@ pub struct JobCaches { /// Per-job type details pub struct JobTypeDetails { - pub tacotron2_old_vocodes: Tacotron2VocodesDetails, pub vits: VitsDetails, pub vall_e_x: VallEXDetails - //pub tacotron2_modern: ..., - //pub softvc: ..., -} - -/// "Old" TT2 (vocodes-era) -pub struct Tacotron2VocodesDetails { - pub inference_command: Tacotron2InferenceCommand, - - /// Common pretrained waveglow vocoder filename - pub waveglow_vocoder_model_filename: String, - - /// Common pretrained hifigan vocoder filename - pub hifigan_vocoder_model_filename: String, - - /// Common pretrained hifigan super resolution vocoder filename - pub hifigan_superres_vocoder_model_filename: String, } pub struct VitsDetails { diff --git a/crates/service/job/inference_job/src/job_specific_dependencies.rs b/crates/service/job/inference_job/src/job_specific_dependencies.rs index b278054453..f971571ebd 100644 --- a/crates/service/job/inference_job/src/job_specific_dependencies.rs +++ b/crates/service/job/inference_job/src/job_specific_dependencies.rs @@ -4,6 +4,7 @@ use enums::by_table::generic_inference_jobs::inference_model_type::InferenceMode use errors::AnyhowResult; use crate::job::job_types::lipsync::sad_talker::sad_talker_dependencies::SadTalkerDependencies; +use crate::job::job_types::tts::tacotron2_v2_early_fakeyou::tacotron2_dependencies::Tacotron2Dependencies; use crate::job::job_types::vc::rvc_v2::rvc_v2_dependencies::RvcV2Dependencies; use crate::job::job_types::vc::so_vits_svc::svc_dependencies::SvcDependencies; use crate::util::scoped_execution::ScopedExecution; @@ -12,6 +13,7 @@ pub struct JobSpecificDependencies { pub maybe_rvc_v2_dependencies: Option, pub maybe_sad_talker_dependencies: Option, pub maybe_svc_dependencies: Option, + pub maybe_tacotron2_dependencies: Option, } impl JobSpecificDependencies { @@ -20,6 +22,7 @@ impl JobSpecificDependencies { let mut maybe_rvc_v2_dependencies = None; let mut maybe_sad_talker_dependencies = None; let mut maybe_svc_dependencies = None; + let mut maybe_tacotron2_dependencies = None; if scoped_execution.can_run_job(InferenceModelType::RvcV2) { info!("Setting RVCv2 dependencies..."); @@ -36,10 +39,16 @@ impl JobSpecificDependencies { maybe_svc_dependencies = Some(SvcDependencies::setup()?); } + if scoped_execution.can_run_job(InferenceModelType::Tacotron2) { + info!("Setting Tacotron2 dependencies..."); + maybe_tacotron2_dependencies = Some(Tacotron2Dependencies::setup()?); + } + Ok(JobSpecificDependencies { maybe_rvc_v2_dependencies, maybe_sad_talker_dependencies, - maybe_svc_dependencies + maybe_svc_dependencies, + maybe_tacotron2_dependencies, }) } } diff --git a/crates/service/job/inference_job/src/main.rs b/crates/service/job/inference_job/src/main.rs index 90c034c169..bcc1bc7e11 100644 --- a/crates/service/job/inference_job/src/main.rs +++ b/crates/service/job/inference_job/src/main.rs @@ -50,12 +50,11 @@ use subprocess_common::docker_options::{DockerEnvVar, DockerFilesystemMount, Doc use crate::http_server::run_http_server::CreateServerArgs; use crate::http_server::run_http_server::launch_http_server; use crate::job::job_loop::main_loop::main_loop; -use crate::job::job_types::tts::tacotron2_v2_early_fakeyou::tacotron2_inference_command::Tacotron2InferenceCommand; use crate::job::job_types::tts::vall_e_x::model_downloaders::VallEXDownloaders; use crate::job::job_types::tts::vall_e_x::vall_e_x_inference_command::VallEXCreateEmbeddingCommand; use crate::job::job_types::tts::vall_e_x::vall_e_x_inference_command::VallEXInferenceCommand; use crate::job::job_types::tts::vits::vits_inference_command::VitsInferenceCommand; -use crate::job_dependencies::{FileSystemDetails, JobCaches, JobDependencies, JobTypeDetails, JobWorkerDetails, Tacotron2VocodesDetails, VallEXDetails, VitsDetails}; +use crate::job_dependencies::{FileSystemDetails, JobCaches, JobDependencies, JobTypeDetails, JobWorkerDetails, VallEXDetails, VitsDetails}; use crate::job_specific_dependencies::JobSpecificDependencies; use crate::util::scoped_execution::ScopedExecution; use crate::util::scoped_temp_dir_creator::ScopedTempDirCreator; @@ -169,15 +168,6 @@ async fn main() -> AnyhowResult<()> { let common_env = CommonEnv::read_from_env()?; - let waveglow_vocoder_model_filename = easyenv::get_env_string_or_default( - "TTS_WAVEGLOW_VOCODER_MODEL_FILENAME", "waveglow.pth"); - - let hifigan_vocoder_model_filename = easyenv::get_env_string_or_default( - "TTS_HIFIGAN_VOCODER_MODEL_FILENAME", "hifigan.pth"); - - let hifigan_superres_vocoder_model_filename = easyenv::get_env_string_or_default( - "TTS_HIFIGAN_SUPERRES_VOCODER_MODEL_FILENAME", "hifigan_superres.pth"); - let sidecar_max_synthesizer_models = easyenv::get_env_num( "SIDECAR_MAX_SYNTHESIZER_MODELS", 3)?; @@ -305,13 +295,7 @@ async fn main() -> AnyhowResult<()> { low_priority_starvation_prevention_every_nth, maybe_minimum_priority, job_type_details: JobTypeDetails { - tacotron2_old_vocodes: Tacotron2VocodesDetails { - inference_command: Tacotron2InferenceCommand::from_env()?, - waveglow_vocoder_model_filename, - hifigan_vocoder_model_filename, - hifigan_superres_vocoder_model_filename, - }, - vall_e_x: VallEXDetails { + vall_e_x: VallEXDetails { downloaders: VallEXDownloaders::build_all_from_env(), inference_command: VallEXInferenceCommand::from_env()?, create_embedding_command: VallEXCreateEmbeddingCommand::from_env()?,