From 3cc1ea693564915b3febde0682c08997939198cf Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Fri, 1 Dec 2023 01:36:33 -0500 Subject: [PATCH] capture stderr for svc and rvc --- _sql/actions/generic_inference_jobs.sql | 7 ++++++ .../job/job_types/vc/rvc_v2/process_job.rs | 22 ++++++++++++++++++- .../vc/rvc_v2/rvc_v2_inference_command.rs | 10 ++++++++- .../job_types/vc/so_vits_svc/process_job.rs | 22 ++++++++++++++++++- .../so_vits_svc_inference_command.rs | 10 ++++++++- 5 files changed, 67 insertions(+), 4 deletions(-) diff --git a/_sql/actions/generic_inference_jobs.sql b/_sql/actions/generic_inference_jobs.sql index d22d74a190..e0ec788b3b 100644 --- a/_sql/actions/generic_inference_jobs.sql +++ b/_sql/actions/generic_inference_jobs.sql @@ -19,7 +19,14 @@ set status = 'dead' where status IN ('pending', 'started', 'attempt_failed') and maybe_model_type IN ('sad_talker', 'so_vits_svc'); +-- Tacotron 2 TTS update generic_inference_jobs set status = 'dead' where status IN ('pending', 'started', 'attempt_failed') and maybe_model_type IN ('tacotron2'); + +-- Sad Talker Face Animation +update generic_inference_jobs +set status = 'dead' +where status IN ('pending', 'started', 'attempt_failed') + and maybe_model_type IN ('sad_talker'); diff --git a/crates/service/job/inference_job/src/job/job_types/vc/rvc_v2/process_job.rs b/crates/service/job/inference_job/src/job/job_types/vc/rvc_v2/process_job.rs index 16a8992dfd..74496b6abc 100644 --- a/crates/service/job/inference_job/src/job/job_types/vc/rvc_v2/process_job.rs +++ b/crates/service/job/inference_job/src/job/job_types/vc/rvc_v2/process_job.rs @@ -1,3 +1,4 @@ +use std::fs::read_to_string; use std::path::PathBuf; use std::time::Instant; @@ -220,6 +221,8 @@ pub async fn process_job(args: RvcV2ProcessJobArgs<'_>) -> Result) -> Result) -> Result { + // warn!("Face not detected in source image"); + // error = ProcessSingleJobError::FaceDetectionFailure; + // } + // _ => {} + //} + } + safe_delete_temp_file(&input_wav_path); safe_delete_temp_file(&output_audio_fs_path); safe_delete_temp_directory(&work_temp_dir); - return Err(ProcessSingleJobError::Other(anyhow!("CommandExitStatus: {:?}", command_exit_status))); + + return Err(error); } // ==================== CHECK ALL FILES EXIST AND GET METADATA ==================== // diff --git a/crates/service/job/inference_job/src/job/job_types/vc/rvc_v2/rvc_v2_inference_command.rs b/crates/service/job/inference_job/src/job/job_types/vc/rvc_v2/rvc_v2_inference_command.rs index bb3be2e01f..b6ff6cc243 100644 --- a/crates/service/job/inference_job/src/job/job_types/vc/rvc_v2/rvc_v2_inference_command.rs +++ b/crates/service/job/inference_job/src/job/job_types/vc/rvc_v2/rvc_v2_inference_command.rs @@ -1,13 +1,14 @@ use std::collections::HashSet; use std::env; use std::ffi::OsString; +use std::fs::File; use std::path::{Path, PathBuf}; use std::time::Duration; use anyhow::anyhow; use log::info; use once_cell::sync::Lazy; -use subprocess::{Popen, PopenConfig}; +use subprocess::{Popen, PopenConfig, Redirection}; use errors::AnyhowResult; use filesys::path_to_string::path_to_string; @@ -80,6 +81,8 @@ pub struct InferenceArgs, Q: AsRef> { /// --output_audio_filename: output path of wav file. pub output_path: P, + pub stderr_output_file: P, + /// --f0-method: f0 prediction method pub maybe_override_f0_method: Option, @@ -267,6 +270,11 @@ impl RvcV2InferenceCommand { let mut config = PopenConfig::default(); + info!("stderr will be written to file: {:?}", args.stderr_output_file.as_ref()); + + let stderr_file = File::create(&args.stderr_output_file)?; + config.stderr = Redirection::File(stderr_file); + if !env_vars.is_empty() { config.env = Some(env_vars); } diff --git a/crates/service/job/inference_job/src/job/job_types/vc/so_vits_svc/process_job.rs b/crates/service/job/inference_job/src/job/job_types/vc/so_vits_svc/process_job.rs index 5a54968f7a..f5d7fa1b89 100644 --- a/crates/service/job/inference_job/src/job/job_types/vc/so_vits_svc/process_job.rs +++ b/crates/service/job/inference_job/src/job/job_types/vc/so_vits_svc/process_job.rs @@ -1,3 +1,4 @@ +use std::fs::read_to_string; use std::time::Instant; use anyhow::anyhow; @@ -148,6 +149,8 @@ pub async fn process_job(args: SoVitsSvcProcessJobArgs<'_>) -> Result) -> Result) -> Result { + // warn!("Face not detected in source image"); + // error = ProcessSingleJobError::FaceDetectionFailure; + // } + // _ => {} + //} + } + safe_delete_temp_file(&input_wav_path); safe_delete_temp_file(&output_audio_fs_path); safe_delete_temp_directory(&work_temp_dir); - return Err(ProcessSingleJobError::Other(anyhow!("CommandExitStatus: {:?}", command_exit_status))); + + return Err(error); } // ==================== CHECK ALL FILES EXIST AND GET METADATA ==================== // diff --git a/crates/service/job/inference_job/src/job/job_types/vc/so_vits_svc/so_vits_svc_inference_command.rs b/crates/service/job/inference_job/src/job/job_types/vc/so_vits_svc/so_vits_svc_inference_command.rs index e99384933c..cbeca1deb3 100644 --- a/crates/service/job/inference_job/src/job/job_types/vc/so_vits_svc/so_vits_svc_inference_command.rs +++ b/crates/service/job/inference_job/src/job/job_types/vc/so_vits_svc/so_vits_svc_inference_command.rs @@ -1,13 +1,14 @@ use std::collections::HashSet; use std::env; use std::ffi::OsString; +use std::fs::File; use std::path::{Path, PathBuf}; use std::time::Duration; use anyhow::anyhow; use log::info; use once_cell::sync::Lazy; -use subprocess::{Popen, PopenConfig}; +use subprocess::{Popen, PopenConfig, Redirection}; use errors::AnyhowResult; use filesys::path_to_string::path_to_string; @@ -90,6 +91,8 @@ pub struct InferenceArgs> { /// --output_path: output path of converting model to onnx (which we use to test validity) pub output_path: P, + pub stderr_output_file: P, + /// --auto-predict-f0: turn on or off fundamental frequency auto prediction /// This sounds better when left off, but it defaults to *ON* if not specified. pub auto_predict_f0: bool, @@ -366,6 +369,11 @@ impl SoVitsSvcInferenceCommand { let mut config = PopenConfig::default(); + info!("stderr will be written to file: {:?}", args.stderr_output_file.as_ref()); + + let stderr_file = File::create(&args.stderr_output_file)?; + config.stderr = Redirection::File(stderr_file); + if !env_vars.is_empty() { config.env = Some(env_vars); }