SVC simplification

This commit is contained in:
Brandon Thomas committed 2023-11-21 20:06:33 -05:00
1 parent 31ee410ac0
commit 4941278590
6 files changed
+37 -14

No files matched your search

@@ -1,2 +1,3 @@
pub mod process_job;
pub mod so_vits_svc_inference_command;
pub mod so_vits_svc_inference_command;
pub mod svc_dependencies;
@@ -48,9 +48,17 @@ pub async fn process_job(args: SoVitsSvcProcessJobArgs<'_>) -> Result<JobSuccess
.new_generic_inference(job.inference_job_token.as_str())
.map_err(|e| ProcessSingleJobError::Other(anyhow!(e)))?;
let model_dependencies = args
.job_dependencies
.job_specific_dependencies
.maybe_svc_dependencies
.as_ref()
.ok_or_else(|| ProcessSingleJobError::JobSystemMisconfiguration(Some("missing SVC dependencies".to_string())))?;
// ==================== CONFIRM OR DOWNLOAD SO-VITS-SVC DEPENDENCIES ==================== //
// TODO: Currently SO-VITS-SVC downloads models from HuggingFace. This is likely a risk in that they can move.
// TODO(bt,2023-04-22): Currently SO-VITS-SVC downloads models from HuggingFace.
// This is likely a risk in that they can move.
// We'll need to address this and save these in our own cloud storage.
// ==================== CONFIRM OR DOWNLOAD SO-VITS-SVC SYNTHESIZER MODEL ==================== //
@@ -169,9 +177,7 @@ pub async fn process_job(args: SoVitsSvcProcessJobArgs<'_>) -> Result<JobSuccess
let inference_start_time = Instant::now();
let command_exit_status = args.job_dependencies
.job_type_details
.so_vits_svc
let command_exit_status = model_dependencies
.inference_command
.execute_inference(InferenceArgs {
model_path: &so_vits_svc_fs_path,
@@ -0,0 +1,14 @@
use errors::AnyhowResult;
use crate::job::job_types::vc::so_vits_svc::so_vits_svc_inference_command::SoVitsSvcInferenceCommand;
pub struct SvcDependencies {
pub inference_command: SoVitsSvcInferenceCommand,
}
impl SvcDependencies {
pub fn setup() -> AnyhowResult<Self> {
Ok(Self {
inference_command: SoVitsSvcInferenceCommand::from_env()?,
})
}
}
@@ -31,7 +31,6 @@ 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::job_types::vc::so_vits_svc::so_vits_svc_inference_command::SoVitsSvcInferenceCommand;
use crate::job_specific_dependencies::JobSpecificDependencies;
use crate::util::common_commands::ffmpeg_logo_watermark_command::FfmpegLogoWatermarkCommand;
use crate::util::scoped_execution::ScopedExecution;
@@ -164,7 +163,6 @@ pub struct JobCaches {
pub struct JobTypeDetails {
pub tacotron2_old_vocodes: Tacotron2VocodesDetails,
pub vits: VitsDetails,
pub so_vits_svc: SoVitsSvcDetails,
pub sad_talker: SadTalkerDetails,
pub vall_e_x: VallEXDetails
//pub tacotron2_modern: ...,
@@ -189,10 +187,6 @@ pub struct VitsDetails {
pub inference_command: VitsInferenceCommand,
}
pub struct SoVitsSvcDetails {
pub inference_command: SoVitsSvcInferenceCommand,
}
pub struct SadTalkerDetails {
pub downloaders: SadTalkerDownloaders,
pub inference_command: SadTalkerInferenceCommand,
@@ -1,25 +1,36 @@
use log::info;
use enums::by_table::generic_inference_jobs::inference_model_type::InferenceModelType;
use errors::AnyhowResult;
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;
pub struct JobSpecificDependencies {
pub maybe_rvc_v2_dependencies: Option<RvcV2Dependencies>,
pub maybe_svc_dependencies: Option<SvcDependencies>,
}
impl JobSpecificDependencies {
pub fn setup_for_jobs(scoped_execution: &ScopedExecution) -> AnyhowResult<Self> {
let mut maybe_rvc_v2_dependencies = None;
let mut maybe_svc_dependencies = None;
if scoped_execution.can_run_job(InferenceModelType::RvcV2) {
info!("Setting RVCv2 dependencies...");
maybe_rvc_v2_dependencies = Some(RvcV2Dependencies::setup()?);
}
if scoped_execution.can_run_job(InferenceModelType::SoVitsSvc) {
info!("Setting SVC dependencies...");
maybe_svc_dependencies = Some(SvcDependencies::setup()?);
}
Ok(JobSpecificDependencies {
maybe_rvc_v2_dependencies,
maybe_svc_dependencies
})
}
}
@@ -323,9 +323,6 @@ async fn main() -> AnyhowResult<()> {
vits: VitsDetails {
inference_command: vits_inference_command()?,
},
so_vits_svc: SoVitsSvcDetails {
inference_command: SoVitsSvcInferenceCommand::from_env()?,
},
sad_talker: SadTalkerDetails {
downloaders: SadTalkerDownloaders::build_all_from_env(),
inference_command: SadTalkerInferenceCommand::from_env()?,