code compiles

This commit is contained in:
Brandon Thomas committed 2023-04-22 02:14:44 -07:00
1 parent 56e84f434f
commit 8fcb908af9
6 files changed
+20 -24

No files matched your search

@@ -2,9 +2,6 @@
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- These columns are no longer useful.
-- It's better to store booleans for each type of file we store and calculate the paths.
ALTER TABLE voice_conversion_results DROP COLUMN public_bucket_hash;
ALTER TABLE voice_conversion_results DROP COLUMN bucket_has_wav;
ALTER TABLE voice_conversion_results DROP COLUMN bucket_has_mp3;
@@ -6,7 +6,7 @@ use tokens::voice_conversion::model::VoiceConversionModelToken;
/// Used to encode extra state for the `generic_inference_jobs` table.
/// This should act somewhat like a serialized protobuf stored inside a record.
#[derive(Clone, Serialize, Deserialize)]
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct GenericInferenceArgs {
/// The category of inference (probably also present in a top-level field)
#[serde(rename = "cat")] // NB: DO NOT CHANGE. It could break live jobs. Renamed to consume fewer bytes
@@ -20,7 +20,7 @@ pub struct GenericInferenceArgs {
/// Same as `InferenceCategory`, but serialized in fewer characters
/// Do not change the values.
#[derive(Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, Serialize)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, Serialize)]
pub enum InferenceCategoryAbbreviated {
#[serde(rename = "tts")] // NB: DO NOT CHANGE. It could break live jobs. Renamed to be fewer bytes.
#[serde(alias = "text_to_speech")]
@@ -31,7 +31,7 @@ pub enum InferenceCategoryAbbreviated {
VoiceConversion,
}
#[derive(Clone, Serialize, Deserialize)]
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum PolymorphicInferenceArgs {
TextToSpeechInferenceArgs {
// No arguments yet.
@@ -14,10 +14,10 @@ pub struct SyntheticIdRecord {
pub next_id: i64,
}
pub struct InsertArgs<'a, P> where P: AsRef<Path> {
pub struct InsertArgs<'a> {
pub pool: &'a MySqlPool,
pub job: &'a AvailableInferenceJob,
pub bucket_audio_results_path: P,
pub public_bucket_hash: &'a str,
pub file_size_bytes: u64,
pub duration_millis: u64,
pub is_on_prem: bool,
@@ -25,8 +25,8 @@ pub struct InsertArgs<'a, P> where P: AsRef<Path> {
pub is_debug_worker: bool,
}
pub async fn insert_voice_conversion_result<P: AsRef<Path>>(
args: InsertArgs<'_, P>
pub async fn insert_voice_conversion_result(
args: InsertArgs<'_>
) -> AnyhowResult<(VoiceConversionResultToken, u64)>
{
let result_token = VoiceConversionResultToken::generate();
@@ -89,16 +89,10 @@ LIMIT 1
maybe_creator_synthetic_id = Some(next_id);
}
let bucket_audio_result_path = &args.bucket_audio_results_path
.as_ref()
.display()
.to_string();
let vc_model_token = args.job.maybe_model_token.as_deref();
let creator_ip_address = args.job.creator_ip_address.as_str();
let creator_set_visibility = args.job.creator_set_visibility.clone();
let record_id = {
let query_result = sqlx::query!(
r#"
@@ -115,7 +109,8 @@ SET
creator_ip_address = ?,
creator_set_visibility = ?,
public_bucket_wav_audio_path = ?,
public_bucket_hash = ?,
bucket_has_wav = true,
file_size_bytes = ?,
duration_millis = ?,
@@ -124,7 +119,7 @@ SET
generated_by_worker = ?,
is_debug_request = ?
"#,
result_token.to_str(),
result_token.as_str(),
args.job.maybe_model_token,
"",
@@ -135,7 +130,7 @@ SET
args.job.creator_ip_address,
args.job.creator_set_visibility.to_str(),
bucket_audio_result_path,
args.public_bucket_hash,
args.file_size_bytes,
args.duration_millis,
@@ -41,7 +41,7 @@ pub async fn process_single_vc_job(job_dependencies: &JobDependencies, job: &Ava
let maybe_media_upload_token = job.maybe_inference_args
.as_ref()
.map(|args| args.args)
.map(|args| args.args.as_ref())
.flatten()
.map(|args| {
match args {
@@ -236,7 +236,7 @@ pub async fn process_job(args: SoVitsSvcProcessJobArgs<'_>) -> Result<JobSuccess
let (inference_result_token, id) = insert_voice_conversion_result(InsertArgs {
pool: &args.job_dependencies.mysql_pool,
job: &job,
bucket_audio_results_path: &output_audio_fs_path,
public_bucket_hash: result_bucket_location.get_object_hash(),
file_size_bytes: file_metadata.file_size_bytes,
duration_millis: file_metadata.duration_millis.unwrap_or(0),
is_on_prem: args.job_dependencies.worker_details.is_on_prem,
@@ -264,7 +264,7 @@ pub async fn process_job(args: SoVitsSvcProcessJobArgs<'_>) -> Result<JobSuccess
.map(|token| UserToken::new_from_str(token));
args.job_dependencies.firehose_publisher.vc_inference_finished(
maybe_user_token.as_deref(),
maybe_user_token.as_ref(),
&job.inference_job_token,
inference_result_token.as_str())
.await
+6 -2
View File
@@ -31,7 +31,7 @@ use crate::job::job_loop::job_stats::JobStats;
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::vits::vits_inference_command::VitsInferenceCommand;
use crate::job_dependencies::{JobCaches, JobDependencies, JobTypeDetails, JobWorkerDetails, Tacotron2VocodesDetails, VitsDetails};
use crate::job_dependencies::{JobCaches, JobDependencies, JobTypeDetails, JobWorkerDetails, SoVitsSvcDetails, Tacotron2VocodesDetails, VitsDetails};
use crate::util::scoped_temp_dir_creator::ScopedTempDirCreator;
use jobs_common::job_progress_reporter::job_progress_reporter::JobProgressReporterBuilder;
use jobs_common::job_progress_reporter::noop_job_progress_reporter::NoOpJobProgressReporterBuilder;
@@ -47,6 +47,7 @@ use sqlx::mysql::MySqlPoolOptions;
use std::path::PathBuf;
use std::time::Duration;
use subprocess_common::docker_options::{DockerEnvVar, DockerFilesystemMount, DockerGpu, DockerOptions};
use crate::job::job_types::vc::so_vits_svc::so_vits_svc_inference_command::SoVitsSvcInferenceCommand;
// Buckets (shared config)
const ENV_ACCESS_KEY : &'static str = "ACCESS_KEY";
@@ -268,7 +269,10 @@ async fn main() -> AnyhowResult<()> {
},
vits: VitsDetails {
inference_command: vits_inference_command()?,
}
},
so_vits_svc: SoVitsSvcDetails {
inference_command: SoVitsSvcInferenceCommand::from_env()?,
},
},
};