From fea69673cdf630a51787176d1fecc0b9a5ff40b5 Mon Sep 17 00:00:00 2001 From: Daniel Maddern Date: Fri, 14 Aug 2026 13:57:30 +0700 Subject: [PATCH] Return native H3 audio latents --- src/h3_blackwell_runtime/sampler.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/h3_blackwell_runtime/sampler.py b/src/h3_blackwell_runtime/sampler.py index a959d5f..fcf6b04 100644 --- a/src/h3_blackwell_runtime/sampler.py +++ b/src/h3_blackwell_runtime/sampler.py @@ -52,6 +52,11 @@ def _model_sigma(video_sigma: torch.Tensor) -> torch.Tensor: return (video_sigma * 1000.0).float() / 1000.0 +def _decode_audio_latent(audio_carried: torch.Tensor, *, shift_video: float = 12.0, shift_audio: float = 3.0) -> torch.Tensor: + """Convert Comfy's AV sampler-carried audio state back to native audio VAE latents.""" + return audio_carried * (shift_audio / shift_video) + + @torch.inference_mode() def sample_video_res_multistep( model, @@ -102,7 +107,7 @@ def sample_video_res_multistep( f"{time.perf_counter() - step_started:.1f}s, elapsed {elapsed:.1f}s, eta {eta:.1f}s", flush=True, ) - return (video, audio_carried) if return_audio else video + return (video, _decode_audio_latent(audio_carried)) if return_audio else video @torch.inference_mode()