Return native H3 audio latents
This commit is contained in:
parent
59b8302d4e
commit
fea69673cd
1 changed files with 6 additions and 1 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue