mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-07-18 20:38:15 +08:00
Fix StableAudio extra_conds using wrong temporal downscale ratio
Replace hardcoded magic numbers (21.53 for SA1, 21.5332 for SA3) with self.latent_format.temporal_downscale_ratio (2048 for SA1, 4096 for SA3). Also switch from int() truncation to round() to avoid off-by-one errors. This fixes SA3 generating truncated audio because extra_conds divided by SA1's rate after fix_empty_latent_channels had already resized the latent to SA3's native rate. Refs: #14825 Signed-off-by: Yuchen Fan <functionhx@gmail.com>
This commit is contained in:
parent
04a30fb375
commit
0975da3d75
@ -799,7 +799,8 @@ class StableAudio1(BaseModel):
|
||||
device = kwargs["device"]
|
||||
|
||||
seconds_start = kwargs.get("seconds_start", 0)
|
||||
seconds_total = kwargs.get("seconds_total", int(noise.shape[-1] / 21.53))
|
||||
ratio = self.latent_format.temporal_downscale_ratio
|
||||
seconds_total = kwargs.get("seconds_total", round(noise.shape[-1] * ratio / 44100))
|
||||
|
||||
seconds_start_embed = self.seconds_start_embedder([seconds_start])[0].to(device)
|
||||
seconds_total_embed = self.seconds_total_embedder([seconds_total])[0].to(device)
|
||||
@ -866,7 +867,8 @@ class StableAudio3(BaseModel):
|
||||
noise = kwargs.get("noise", None)
|
||||
device = kwargs["device"]
|
||||
|
||||
seconds_total = kwargs.get("seconds_total", int(noise.shape[-1] / 10.7666))
|
||||
ratio = self.latent_format.temporal_downscale_ratio
|
||||
seconds_total = kwargs.get("seconds_total", round(noise.shape[-1] * ratio / 44100))
|
||||
seconds_total_embed = self.seconds_total_embedder([seconds_total])[0].to(device)
|
||||
|
||||
global_embed = seconds_total_embed.reshape((1, -1))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user