diff --git a/crates/lib/mysql_queries/src/payloads/generic_inference_args/inner_payloads/studio_gen2_payload.rs b/crates/lib/mysql_queries/src/payloads/generic_inference_args/inner_payloads/studio_gen2_payload.rs index ea8caa01be..d6648eb8df 100644 --- a/crates/lib/mysql_queries/src/payloads/generic_inference_args/inner_payloads/studio_gen2_payload.rs +++ b/crates/lib/mysql_queries/src/payloads/generic_inference_args/inner_payloads/studio_gen2_payload.rs @@ -26,4 +26,12 @@ pub struct StudioGen2Payload { #[serde(rename = "sm")] #[serde(skip_serializing_if = "Option::is_none")] pub after_job_debug_sleep_millis: Option, + + #[serde(rename = "ow")] + #[serde(skip_serializing_if = "Option::is_none")] + pub output_width: Option, + + #[serde(rename = "oh")] + #[serde(skip_serializing_if = "Option::is_none")] + pub output_height: Option, } diff --git a/crates/service/job/inference_job/src/job/job_types/studio_gen2/process_single_studio_gen2_job.rs b/crates/service/job/inference_job/src/job/job_types/studio_gen2/process_single_studio_gen2_job.rs index d426942101..b796ab0694 100644 --- a/crates/service/job/inference_job/src/job/job_types/studio_gen2/process_single_studio_gen2_job.rs +++ b/crates/service/job/inference_job/src/job/job_types/studio_gen2/process_single_studio_gen2_job.rs @@ -216,6 +216,8 @@ pub async fn process_single_studio_gen2_job( posenet_model_name_or_path: &gen2_deps.posenet_model_name_or_path, face_encoder_model_name_or_path: &gen2_deps.face_encoder_model_name_or_path, unet_model_name_or_path: &gen2_deps.unet_model_name_or_path, + output_width: studio_args.output_width, + output_height: studio_args.output_height, }).await; let inference_duration = Instant::now().duration_since(inference_start_time); diff --git a/crates/service/job/inference_job/src/job/job_types/studio_gen2/stable_animator_command.rs b/crates/service/job/inference_job/src/job/job_types/studio_gen2/stable_animator_command.rs index 403dd68109..5a570aed11 100644 --- a/crates/service/job/inference_job/src/job/job_types/studio_gen2/stable_animator_command.rs +++ b/crates/service/job/inference_job/src/job/job_types/studio_gen2/stable_animator_command.rs @@ -80,6 +80,9 @@ pub struct InferenceArgs<'s> { pub posenet_model_name_or_path: &'s Path, pub face_encoder_model_name_or_path: &'s Path, pub unet_model_name_or_path: &'s Path, + + pub output_width: Option, + pub output_height: Option, } impl StableAnimatorCommand { @@ -161,6 +164,29 @@ impl StableAnimatorCommand { command.push_str(&path_to_string(&args.unet_model_name_or_path)); command.push_str(" "); + if let Some(width) = args.output_width { + command.push_str(" --width "); + command.push_str(&width.to_string()); + command.push_str(" "); + } + + if let Some(height) = args.output_height { + command.push_str(" --height "); + command.push_str(&height.to_string()); + command.push_str(" "); + } + + // TODO(bt,2025-01-24): These should maybe be set as defaults upstream. These are from an + // inference shell script and are not the defaults in the python arg parser. + command.push_str(" --guidance_scale=3.0 "); + command.push_str(" --num_inference_steps=25 "); + command.push_str(" --tile_size=16 "); + command.push_str(" --overlap=4 "); + command.push_str(" --noise_aug_strength=0.02 "); + command.push_str(" --frames_overlap=4 "); + command.push_str(" --decode_chunk_size=4 "); + command.push_str(" --gradient_checkpointing ");; + if let Some(docker_options) = self.maybe_docker_options.as_ref() { command = docker_options.to_command_string(&command); } diff --git a/crates/service/job/inference_job/src/job/job_types/studio_gen2/validate_and_save_results.rs b/crates/service/job/inference_job/src/job/job_types/studio_gen2/validate_and_save_results.rs index 10aaccf096..612b28e4bd 100644 --- a/crates/service/job/inference_job/src/job/job_types/studio_gen2/validate_and_save_results.rs +++ b/crates/service/job/inference_job/src/job/job_types/studio_gen2/validate_and_save_results.rs @@ -169,10 +169,10 @@ pub async fn validate_and_save_results(args: SaveResultsArgs<'_>) -> Result Some(MediaFileOriginProductCategory::StorytellerStudio), @@ -196,7 +196,7 @@ pub async fn validate_and_save_results(args: SaveResultsArgs<'_>) -> Result, + + /// Sleep for debugging + pub debug_sleep_millis: Option, + + // TODO + pub output_width: Option, + pub output_height: Option, } #[derive(Serialize, ToSchema)] @@ -245,7 +252,9 @@ pub async fn enqueue_studio_gen2_handler( video_file: Some(request.video_file.clone()), creator_visibility: Some(set_visibility), watermark_type, - after_job_debug_sleep_millis: None, + after_job_debug_sleep_millis: request.debug_sleep_millis, + output_width: request.output_width, + output_height: request.output_height, }; info!("Creating ComfyUI job record...");