Python
added LTX 2 input audio prompt
DeepBeepMeepb4a847198287
diff --git a/README.md b/README.mdindex f05322a..e0d5b80 100644--- a/README.md+++ b/README.md@@ -36,10 +36,12 @@ WanGP supports the Wan (and derived models), Hunyuan Video and LTV Video models-----## 🔥 Latest Updates :-### January 7st 2026: WanGP v10.10, Spoiled again+### January 9st 2026: WanGP v10.11, Spoiled again- **LTX 2**: here is the long awaited *Ovi Challenger*, LTX-2 generates video and an audio soundtrack. As usual this WanGP version is *low VRAM*. You should be able to run it with as low as 10 GB of VRAM. If you have at least 24 GB of VRAM you will be able to generate 20s at 720p in a single window in only 2 minutes with the distilled model. WanGP LTX 2 version supports on day one, *Start/End keyframes*, *Sliding-Window* / *Video Continuation* and *Generation Preview*. A *LTX 2 distilled* is part of the package for a very fast generation.+With WanGP v10.11 you can now force your soundtrack, it works like *Multitalk* / *Avatar* except in theory it should work with any kind of sound (not just vocals). Thanks to *Kijai* for showing it was possible.+- **Z Image Twin Folder Turbo**: Z Image even faster as this variant can generate images with as little as 1 step (3 steps recommend)- **Qwen LanPaint**: very precise *In Painting*, offers a better integration of the inpainted area in the rest of the image. Beware it is up to 5x slower as it "searches" for the best replacement.@@ -50,6 +52,7 @@ WanGP supports the Wan (and derived models), Hunyuan Video and LTV Video models- **MMaudio NSFW**: for alternative audio background+*update v10.11*: LTX 2, use your own soundtrack### January 1st 2026: WanGP v10.01, Happy New Year !diff --git a/defaults/ltx2_19B.json b/defaults/ltx2_19B.jsonindex 6128706..7ccd4d6 100644--- a/defaults/ltx2_19B.json+++ b/defaults/ltx2_19B.json@@ -2,7 +2,7 @@"model": {"name": "LTX-2 Dev 19B","architecture": "ltx2_19B",- "description": "LTX-2 generates video up to 20s with an audio soundtrack. Supports start/end keyframes and sliding-window continuation.",+ "description": "LTX-2 generates video up to 20s with an audio soundtrack. Supports start/end keyframes and sliding-window continuation. You can force the audio soundtrack by providing an Audio Prompt.","URLs": ["https://huggingface.co/DeepBeepMeep/LTX-2/resolve/main/ltx-2-19b-dev.safetensors","https://huggingface.co/DeepBeepMeep/LTX-2/resolve/main/ltx-2-19b-dev-fp8.safetensors"diff --git a/models/_settings.json b/models/_settings.jsonindex b9d3fd5..5a48872 100644--- a/models/_settings.json+++ b/models/_settings.json@@ -34,6 +34,7 @@"guidance2_scale":5,"guidance3_scale":5,"audio_guidance_scale": 4,+ "audio_scale": 1,"embedded_guidance_scale": 6.0,"alt_guidance_scale": 6.0,"temperature": 0.8,diff --git a/models/ltx2/ltx2.py b/models/ltx2/ltx2.pyindex 44a02b7..5d9f1a8 100644--- a/models/ltx2/ltx2.py+++ b/models/ltx2/ltx2.py@@ -4,10 +4,14 @@ import typesfrom typing import Callable, Iteratorimport torch+import torchaudiofrom shared.utils import files_locator as fl+from .ltx_core.conditioning import AudioConditionByLatent+from .ltx_core.model.audio_vae import AudioProcessorfrom .ltx_core.model.video_vae import SpatialTilingConfig, TemporalTilingConfig, TilingConfig+from .ltx_core.types import AudioLatentShape, VideoPixelShapefrom .ltx_pipelines.distilled import DistilledPipelinefrom .ltx_pipelines.ti2vid_two_stages import TI2VidTwoStagesPipelinefrom .ltx_pipelines.utils.constants import AUDIO_SAMPLE_RATE, DEFAULT_NEGATIVE_PROMPT@@ -347,6 +351,7 @@ class LTX2:self.video_embeddings_connector = self.text_embeddings_connector.video_embeddings_connectorself.audio_embeddings_connector = self.text_embeddings_connector.audio_embeddings_connectorself.video_encoder = ledger.video_encoder()+ self.audio_encoder = ledger.audio_encoder()self.video_decoder = ledger.video_decoder()self.audio_decoder = ledger.audio_decoder()self.vocoder = ledger.vocoder()@@ -358,6 +363,7 @@ class LTX2:ledger.text_embedding_projection = lambda: self.text_embedding_projectionledger.text_embeddings_connector = lambda: self.text_embeddings_connectorledger.video_encoder = lambda: self.video_encoder+ ledger.audio_encoder = lambda: self.audio_encoderledger.video_decoder = lambda: self.video_decoderledger.audio_decoder = lambda: self.audio_decoderledger.vocoder = lambda: self.vocoder@@ -376,6 +382,7 @@ class LTX2:self.video_embeddings_connector = self.text_embeddings_connector.video_embeddings_connectorself.audio_embeddings_connector = self.text_embeddings_connector.audio_embeddings_connectorself.video_encoder = ledger_1.video_encoder()+ self.audio_encoder = ledger_1.audio_encoder()self.video_decoder = ledger_1.video_decoder()self.audio_decoder = ledger_1.audio_decoder()self.vocoder = ledger_1.vocoder()@@ -387,6 +394,7 @@ class LTX2:ledger_1.text_embedding_projection = lambda: self.text_embedding_projectionledger_1.text_embeddings_connector = lambda: self.text_embeddings_connectorledger_1.video_encoder = lambda: self.video_encoder+ ledger_1.audio_encoder = lambda: self.audio_encoderledger_1.video_decoder = lambda: self.video_decoderledger_1.audio_decoder = lambda: self.audio_decoderledger_1.vocoder = lambda: self.vocoder@@ -396,6 +404,7 @@ class LTX2:ledger_2.text_embedding_projection = lambda: self.text_embedding_projectionledger_2.text_embeddings_connector = lambda: self.text_embeddings_connectorledger_2.video_encoder = lambda: self.video_encoder+ ledger_2.audio_encoder = lambda: self.audio_encoderledger_2.video_decoder = lambda: self.video_decoderledger_2.audio_decoder = lambda: self.audio_decoderledger_2.vocoder = lambda: self.vocoder@@ -481,13 +490,25 @@ class LTX2:use_guiding_latent_for_start_image = bool(self.model_def.get("use_guiding_latent_for_start_image", False))use_guiding_start_image = use_guiding_latent_for_start_image and is_start_image_only+ def _append_prefix_entries(target_list, extra_list=None):+ if not has_prefix_frames or is_start_image_only:+ return+ frame_count = min(prefix_frames_count, input_video.shape[1])+ if frame_count <= 0:+ return+ frame_indices = list(range(0, frame_count, latent_stride))+ last_idx = frame_count - 1+ if frame_indices[-1] != last_idx:+ # Ensure the latest prefix frame dominates its latent slot.+ frame_indices.append(last_idx)+ for frame_idx in frame_indices:+ entry = (input_video[:, frame_idx], _to_latent_index(frame_idx, latent_stride), 1.0)+ target_list.append(entry)+ if extra_list is not None:+ extra_list.append(entry)+if isinstance(self.pipeline, TI2VidTwoStagesPipeline):- if has_prefix_frames and not is_start_image_only:- frame_count = min(prefix_frames_count, input_video.shape[1])- for frame_idx in range(0, frame_count, latent_stride):- entry = (input_video[:, frame_idx], _to_latent_index(frame_idx, latent_stride), 1.0)- images.append(entry)- images_stage2.append(entry)+ _append_prefix_entries(images, images_stage2)if image_end is not None:entry = (image_end, _to_latent_index(frame_num - 1, latent_stride), 1.0)@@ -495,7 +516,7 @@ class LTX2:images_stage2.append(entry)if image_start is not None:- entry = (image_start, _to_latent_index(0, latent_stride), 1.0)+ entry = (image_start, _to_latent_index(0, latent_stride), 1.0, "lanczos")if use_guiding_start_image:guiding_images.append(entry)images_stage2.append(entry)@@ -504,12 +525,9 @@ class LTX2:images.append(entry)images_stage2.append(entry)else:- if has_prefix_frames:- frame_count = min(prefix_frames_count, input_video.shape[1])- for frame_idx in range(0, frame_count, latent_stride):- images.append((input_video[:, frame_idx], _to_latent_index(frame_idx, latent_stride), 1.0))+ _append_prefix_entries(images)if image_start is not None:- images.append((image_start, _to_latent_index(0, latent_stride), 1.0))+ images.append((image_start, _to_latent_index(0, latent_stride), 1.0, "lanczos"))if image_end is not None:images.append((image_end, _to_latent_index(frame_num - 1, latent_stride), 1.0))@@ -518,6 +536,95 @@ class LTX2:loras_slists = kwargs.get("loras_slists")text_connectors = getattr(self, "_text_connectors", None)+ audio_conditionings = None+ audio_guide = kwargs.get("audio_guide")+ if audio_guide:+ audio_scale = kwargs.get("audio_scale")+ if audio_scale is None:+ audio_scale = 1.0+ audio_strength = max(0.0, min(1.0, float(audio_scale)))+ if audio_strength > 0.0:+ if self._interrupt:+ return None+ if not os.path.isfile(audio_guide):+ raise FileNotFoundError(f"Audio guide '{audio_guide}' not found.")+ waveform, waveform_sample_rate = torchaudio.load(audio_guide)+ if self._interrupt:+ return None+ if waveform.ndim == 1:+ waveform = waveform.unsqueeze(0).unsqueeze(0)+ elif waveform.ndim == 2:+ waveform = waveform.unsqueeze(0)+ target_channels = int(getattr(self.audio_encoder, "in_channels", waveform.shape[1]))+ if target_channels <= 0:+ target_channels = waveform.shape[1]+ if waveform.shape[1] != target_channels:+ if waveform.shape[1] == 1 and target_channels > 1:+ waveform = waveform.repeat(1, target_channels, 1)+ elif target_channels == 1:+ waveform = waveform.mean(dim=1, keepdim=True)+ else:+ waveform = waveform[:, :target_channels, :]+ if waveform.shape[1] < target_channels:+ pad_channels = target_channels - waveform.shape[1]+ pad = torch.zeros(+ (waveform.shape[0], pad_channels, waveform.shape[2]),+ dtype=waveform.dtype,+ )+ waveform = torch.cat([waveform, pad], dim=1)++ audio_processor = AudioProcessor(+ sample_rate=self.audio_encoder.sample_rate,+ mel_bins=self.audio_encoder.mel_bins,+ mel_hop_length=self.audio_encoder.mel_hop_length,+ n_fft=self.audio_encoder.n_fft,+ )+ waveform = waveform.to(device="cpu", dtype=torch.float32)+ audio_processor = audio_processor.to(waveform.device)+ mel = audio_processor.waveform_to_mel(waveform, waveform_sample_rate)+ if self._interrupt:+ return None+ audio_params = next(self.audio_encoder.parameters(), None)+ audio_device = audio_params.device if audio_params is not None else self.device+ audio_dtype = audio_params.dtype if audio_params is not None else self.dtype+ mel = mel.to(device=audio_device, dtype=audio_dtype)+ with torch.inference_mode():+ audio_latent = self.audio_encoder(mel)+ if self._interrupt:+ return None+ audio_downsample = getattr(+ getattr(self.audio_encoder, "patchifier", None),+ "audio_latent_downsample_factor",+ 4,+ )+ target_shape = AudioLatentShape.from_video_pixel_shape(+ VideoPixelShape(+ batch=audio_latent.shape[0],+ frames=int(frame_num),+ width=1,+ height=1,+ fps=float(fps),+ ),+ channels=audio_latent.shape[1],+ mel_bins=audio_latent.shape[3],+ sample_rate=self.audio_encoder.sample_rate,+ hop_length=self.audio_encoder.mel_hop_length,+ audio_latent_downsample_factor=audio_downsample,+ )+ target_frames = target_shape.frames+ if audio_latent.shape[2] < target_frames:+ pad_frames = target_frames - audio_latent.shape[2]+ pad = torch.zeros(+ (audio_latent.shape[0], audio_latent.shape[1], pad_frames, audio_latent.shape[3]),+ device=audio_latent.device,+ dtype=audio_latent.dtype,+ )+ audio_latent = torch.cat([audio_latent, pad], dim=2)+ elif audio_latent.shape[2] > target_frames:+ audio_latent = audio_latent[:, :, :target_frames, :]+ audio_latent = audio_latent.to(device=self.device, dtype=self.dtype)+ audio_conditionings = [AudioConditionByLatent(audio_latent, audio_strength)]+target_height = int(height)target_width = int(width)if target_height % 64 != 0:@@ -542,6 +649,7 @@ class LTX2:images_stage2=images_stage2 if stage2_override else None,tiling_config=tiling_config,enhance_prompt=False,+ audio_conditionings=audio_conditionings,callback=callback,interrupt_check=interrupt_check,loras_slists=loras_slists,@@ -558,6 +666,7 @@ class LTX2:images=images,tiling_config=tiling_config,enhance_prompt=False,+ audio_conditionings=audio_conditionings,callback=callback,interrupt_check=interrupt_check,loras_slists=loras_slists,diff --git a/models/ltx2/ltx2_handler.py b/models/ltx2/ltx2_handler.pyindex 3e76563..4c7a5c5 100644--- a/models/ltx2/ltx2_handler.py+++ b/models/ltx2/ltx2_handler.py@@ -46,6 +46,20 @@ class family_handler:"sliding_window": True,"image_prompt_types_allowed": "TSEV","returns_audio": True,+ "any_audio_prompt": True,+ "audio_prompt_choices": True,+ "one_speaker_only": True,+ "audio_guide_label": "Audio Prompt (Soundtrack)",+ "audio_scale_name": "Audio Strength (if Audio Prompt provided)",+ "audio_prompt_type_sources": {+ "selection": ["", "A"],+ "labels": {+ "": "Generate Video & Soundtrack based on Text Prompt",+ "A": "Generate Video based on Soundtrack and Text Prompt",+ },+ "show_label": False,+ },+ "audio_guide_window_slicing": True,"profiles_dir": ["ltx2_19B"],}extra_model_def["sliding_window_defaults"] = {@@ -125,6 +139,14 @@ class family_handler:]return download_def+ @staticmethod+ def validate_generative_settings(base_model_type, model_def, inputs):+ audio_prompt_type = inputs.get("audio_prompt_type") or ""+ if "A" in audio_prompt_type and inputs.get("audio_guide") is None:+ audio_source = inputs.get("audio_source")+ if audio_source is not None:+ inputs["audio_guide"] = audio_source+@staticmethoddef load_model(model_filename,@@ -161,6 +183,7 @@ class family_handler:"text_embeddings_connector": ltx2_model.text_embeddings_connector,"vae": ltx2_model.video_decoder,"video_encoder": ltx2_model.video_encoder,+ "audio_encoder": ltx2_model.audio_encoder,"audio_decoder": ltx2_model.audio_decoder,"vocoder": ltx2_model.vocoder,"spatial_upsampler": ltx2_model.spatial_upsampler,@@ -187,6 +210,7 @@ class family_handler:"sliding_window_overlap": 9,})+ ui_defaults.setdefault("audio_scale", 1.0)pipeline_kind = model_def.get("ltx2_pipeline", "two_stage")if pipeline_kind != "distilled":ui_defaults.setdefault("guidance_phases", 2)diff --git a/models/ltx2/ltx_core/conditioning/__init__.py b/models/ltx2/ltx_core/conditioning/__init__.pyindex 821f178..72f5ce1 100644--- a/models/ltx2/ltx_core/conditioning/__init__.py+++ b/models/ltx2/ltx_core/conditioning/__init__.py@@ -2,11 +2,12 @@from .exceptions import ConditioningErrorfrom .item import ConditioningItem-from .types import VideoConditionByKeyframeIndex, VideoConditionByLatentIndex+from .types import AudioConditionByLatent, VideoConditionByKeyframeIndex, VideoConditionByLatentIndex__all__ = ["ConditioningError","ConditioningItem",+ "AudioConditionByLatent","VideoConditionByKeyframeIndex","VideoConditionByLatentIndex",]diff --git a/models/ltx2/ltx_core/conditioning/types/__init__.py b/models/ltx2/ltx_core/conditioning/types/__init__.pyindex ea83cb6..9ee69b9 100644--- a/models/ltx2/ltx_core/conditioning/types/__init__.py+++ b/models/ltx2/ltx_core/conditioning/types/__init__.py@@ -1,9 +1,10 @@"""Conditioning type implementations."""from .keyframe_cond import VideoConditionByKeyframeIndex-from .latent_cond import VideoConditionByLatentIndex+from .latent_cond import AudioConditionByLatent, VideoConditionByLatentIndex__all__ = ["VideoConditionByKeyframeIndex","VideoConditionByLatentIndex",+ "AudioConditionByLatent",]diff --git a/models/ltx2/ltx_core/conditioning/types/latent_cond.py b/models/ltx2/ltx_core/conditioning/types/latent_cond.pyindex 707bd33..b04be06 100644--- a/models/ltx2/ltx_core/conditioning/types/latent_cond.py+++ b/models/ltx2/ltx_core/conditioning/types/latent_cond.py@@ -3,7 +3,7 @@ import torchfrom ..exceptions import ConditioningErrorfrom ..item import ConditioningItemfrom ...tools import LatentTools-from ...types import LatentState+from ...types import AudioLatentShape, LatentStateclass VideoConditionByLatentIndex(ConditioningItem):@@ -42,3 +42,36 @@ class VideoConditionByLatentIndex(ConditioningItem):latent_state.denoise_mask[:, start_token:stop_token] = 1.0 - self.strengthreturn latent_state+++class AudioConditionByLatent(ConditioningItem):+ """+ Conditions audio generation by injecting a full latent sequence.+ Replaces tokens in the latent state with the provided audio latents,+ and sets denoise strength according to the strength parameter.+ """++ def __init__(self, latent: torch.Tensor, strength: float):+ self.latent = latent+ self.strength = strength++ def apply_to(self, latent_state: LatentState, latent_tools: LatentTools) -> LatentState:+ if not isinstance(latent_tools.target_shape, AudioLatentShape):+ raise ConditioningError("Audio conditioning requires an audio latent target shape.")++ cond_batch, cond_channels, cond_frames, cond_bins = self.latent.shape+ tgt_batch, tgt_channels, tgt_frames, tgt_bins = latent_tools.target_shape.to_torch_shape()++ if (cond_batch, cond_channels, cond_frames, cond_bins) != (tgt_batch, tgt_channels, tgt_frames, tgt_bins):+ raise ConditioningError(+ f"Can't apply audio conditioning item to latent with shape {latent_tools.target_shape}, expected "+ f"shape is ({tgt_batch}, {tgt_channels}, {tgt_frames}, {tgt_bins})."+ )++ tokens = latent_tools.patchifier.patchify(self.latent)+ latent_state = latent_state.clone()+ latent_state.latent[:, : tokens.shape[1]] = tokens+ latent_state.clean_latent[:, : tokens.shape[1]] = tokens+ latent_state.denoise_mask[:, : tokens.shape[1]] = 1.0 - self.strength++ return latent_statediff --git a/models/ltx2/ltx_pipelines/distilled.py b/models/ltx2/ltx_pipelines/distilled.pyindex d5f28ee..149bd68 100644--- a/models/ltx2/ltx_pipelines/distilled.py+++ b/models/ltx2/ltx_pipelines/distilled.py@@ -85,6 +85,7 @@ class DistilledPipeline:images: list[tuple[str, int, float]],tiling_config: TilingConfig | None = None,enhance_prompt: bool = False,+ audio_conditionings: list | None = None,callback: Callable[..., None] | None = None,interrupt_check: Callable[[], bool] | None = None,loras_slists: dict | None = None,@@ -176,6 +177,7 @@ class DistilledPipeline:video_state, audio_state = denoise_audio_video(output_shape=stage_1_output_shape,conditionings=stage_1_conditionings,+ audio_conditionings=audio_conditionings,noiser=noiser,sigmas=stage_1_sigmas,stepper=stepper,@@ -222,6 +224,7 @@ class DistilledPipeline:video_state, audio_state = denoise_audio_video(output_shape=stage_2_output_shape,conditionings=stage_2_conditionings,+ audio_conditionings=audio_conditionings,noiser=noiser,sigmas=stage_2_sigmas,stepper=stepper,diff --git a/models/ltx2/ltx_pipelines/ic_lora.py b/models/ltx2/ltx_pipelines/ic_lora.pyindex f849c37..eb84d13 100644--- a/models/ltx2/ltx_pipelines/ic_lora.py+++ b/models/ltx2/ltx_pipelines/ic_lora.py@@ -96,6 +96,7 @@ class ICLoraPipeline:images: list[tuple[str, int, float]],video_conditioning: list[tuple[str, float]],enhance_prompt: bool = False,+ audio_conditionings: list | None = None,tiling_config: TilingConfig | None = None,callback: Callable[..., None] | None = None,interrupt_check: Callable[[], bool] | None = None,@@ -189,6 +190,7 @@ class ICLoraPipeline:video_state, audio_state = denoise_audio_video(output_shape=stage_1_output_shape,conditionings=stage_1_conditionings,+ audio_conditionings=audio_conditionings,noiser=noiser,sigmas=stage_1_sigmas,stepper=stepper,@@ -268,6 +270,7 @@ class ICLoraPipeline:video_state, audio_state = denoise_audio_video(output_shape=stage_2_output_shape,conditionings=stage_2_conditionings,+ audio_conditionings=audio_conditionings,noiser=noiser,sigmas=distilled_sigmas,stepper=stepper,diff --git a/models/ltx2/ltx_pipelines/keyframe_interpolation.py b/models/ltx2/ltx_pipelines/keyframe_interpolation.pyindex 09ae0eb..0c0afc4 100644--- a/models/ltx2/ltx_pipelines/keyframe_interpolation.py+++ b/models/ltx2/ltx_pipelines/keyframe_interpolation.py@@ -93,6 +93,7 @@ class KeyframeInterpolationPipeline:images: list[tuple[str, int, float]],tiling_config: TilingConfig | None = None,enhance_prompt: bool = False,+ audio_conditionings: list | None = None,callback: Callable[..., None] | None = None,interrupt_check: Callable[[], bool] | None = None,loras_slists: dict | None = None,@@ -190,6 +191,7 @@ class KeyframeInterpolationPipeline:video_state, audio_state = denoise_audio_video(output_shape=stage_1_output_shape,conditionings=stage_1_conditionings,+ audio_conditionings=audio_conditionings,noiser=noiser,sigmas=sigmas,stepper=stepper,@@ -268,6 +270,7 @@ class KeyframeInterpolationPipeline:video_state, audio_state = denoise_audio_video(output_shape=stage_2_output_shape,conditionings=stage_2_conditionings,+ audio_conditionings=audio_conditionings,noiser=noiser,sigmas=distilled_sigmas,stepper=stepper,diff --git a/models/ltx2/ltx_pipelines/ti2vid_one_stage.py b/models/ltx2/ltx_pipelines/ti2vid_one_stage.pyindex 685dc65..ee7f38e 100644--- a/models/ltx2/ltx_pipelines/ti2vid_one_stage.py+++ b/models/ltx2/ltx_pipelines/ti2vid_one_stage.py@@ -79,6 +79,7 @@ class TI2VidOneStagePipeline:cfg_guidance_scale: float,images: list[tuple[str, int, float]],enhance_prompt: bool = False,+ audio_conditionings: list | None = None,callback: Callable[..., None] | None = None,interrupt_check: Callable[[], bool] | None = None,loras_slists: dict | None = None,@@ -171,6 +172,7 @@ class TI2VidOneStagePipeline:video_state, audio_state = denoise_audio_video(output_shape=stage_1_output_shape,conditionings=stage_1_conditionings,+ audio_conditionings=audio_conditionings,noiser=noiser,sigmas=sigmas,stepper=stepper,diff --git a/models/ltx2/ltx_pipelines/ti2vid_two_stages.py b/models/ltx2/ltx_pipelines/ti2vid_two_stages.pyindex 5f9c2b8..69c6f00 100644--- a/models/ltx2/ltx_pipelines/ti2vid_two_stages.py+++ b/models/ltx2/ltx_pipelines/ti2vid_two_stages.py@@ -104,6 +104,7 @@ class TI2VidTwoStagesPipeline:images_stage2: list[tuple[str, int, float]] | None = None,tiling_config: TilingConfig | None = None,enhance_prompt: bool = False,+ audio_conditionings: list | None = None,callback: Callable[..., None] | None = None,interrupt_check: Callable[[], bool] | None = None,loras_slists: dict | None = None,@@ -214,6 +215,7 @@ class TI2VidTwoStagesPipeline:video_state, audio_state = denoise_audio_video(output_shape=stage_1_output_shape,conditionings=stage_1_conditionings,+ audio_conditionings=audio_conditionings,noiser=noiser,sigmas=sigmas,stepper=stepper,@@ -293,6 +295,7 @@ class TI2VidTwoStagesPipeline:video_state, audio_state = denoise_audio_video(output_shape=stage_2_output_shape,conditionings=stage_2_conditionings,+ audio_conditionings=audio_conditionings,noiser=noiser,sigmas=distilled_sigmas,stepper=stepper,diff --git a/models/ltx2/ltx_pipelines/utils/helpers.py b/models/ltx2/ltx_pipelines/utils/helpers.pyindex 76f9de5..75ea5f5 100644--- a/models/ltx2/ltx_pipelines/utils/helpers.py+++ b/models/ltx2/ltx_pipelines/utils/helpers.py@@ -43,7 +43,7 @@ def cleanup_memory() -> None:def image_conditionings_by_replacing_latent(- images: list[tuple[str, int, float]],+ images: list[tuple],height: int,width: int,video_encoder: VideoEncoder,@@ -51,13 +51,19 @@ def image_conditionings_by_replacing_latent(device: torch.device,) -> list[ConditioningItem]:conditionings = []- for image_path, frame_idx, strength in images:+ for image_entry in images:+ if len(image_entry) == 4:+ image_path, frame_idx, strength, resample = image_entry+ else:+ image_path, frame_idx, strength = image_entry+ resample = Noneimage = load_image_conditioning(image_path=image_path,height=height,width=width,dtype=dtype,device=device,+ resample=resample,)encoded_image = video_encoder(image)conditionings.append(@@ -72,7 +78,7 @@ def image_conditionings_by_replacing_latent(def image_conditionings_by_adding_guiding_latent(- images: list[tuple[str, int, float]],+ images: list[tuple],height: int,width: int,video_encoder: VideoEncoder,@@ -80,13 +86,19 @@ def image_conditionings_by_adding_guiding_latent(device: torch.device,) -> list[ConditioningItem]:conditionings = []- for image_path, frame_idx, strength in images:+ for image_entry in images:+ if len(image_entry) == 4:+ image_path, frame_idx, strength, resample = image_entry+ else:+ image_path, frame_idx, strength = image_entry+ resample = Noneimage = load_image_conditioning(image_path=image_path,height=height,width=width,dtype=dtype,device=device,+ resample=resample,)encoded_image = video_encoder(image)conditionings.append(@@ -487,6 +499,7 @@ def denoise_audio_video( # noqa: PLR0913components: PipelineComponents,dtype: torch.dtype,device: torch.device,+ audio_conditionings: list[ConditioningItem] | None = None,noise_scale: float = 1.0,initial_video_latent: torch.Tensor | None = None,initial_audio_latent: torch.Tensor | None = None,@@ -504,7 +517,7 @@ def denoise_audio_video( # noqa: PLR0913audio_state, audio_tools = noise_audio_state(output_shape=output_shape,noiser=noiser,- conditionings=[],+ conditionings=audio_conditionings or [],components=components,dtype=dtype,device=device,diff --git a/models/ltx2/ltx_pipelines/utils/media_io.py b/models/ltx2/ltx_pipelines/utils/media_io.pyindex 2cc9c82..8bbde44 100644--- a/models/ltx2/ltx_pipelines/utils/media_io.py+++ b/models/ltx2/ltx_pipelines/utils/media_io.py@@ -36,7 +36,45 @@ def resize_aspect_ratio_preserving(image: torch.Tensor, long_side: int) -> torchreturn result[0] if result.shape[0] == 1 else result-def resize_and_center_crop(tensor: torch.Tensor, height: int, width: int) -> torch.Tensor:+def _get_lanczos_resample() -> int:+ if hasattr(Image, "Resampling"):+ return Image.Resampling.LANCZOS+ return Image.LANCZOS+++def _resize_and_center_crop_lanczos(tensor: torch.Tensor, height: int, width: int) -> torch.Tensor:+ if tensor.ndim == 3:+ frames = tensor.unsqueeze(0)+ elif tensor.ndim == 4:+ frames = tensor+ else:+ raise ValueError(f"Expected input with 3 or 4 dimensions; got shape {tensor.shape}.")++ _, src_h, src_w, _ = frames.shape+ if src_h == height and src_w == width:+ return rearrange(frames, "f h w c -> 1 c f h w")++ scale = max(height / src_h, width / src_w)+ new_h = math.ceil(src_h * scale)+ new_w = math.ceil(src_w * scale)+ frames = frames.detach().cpu()+ resample = _get_lanczos_resample()+ resized_frames = []+ for frame in frames:+ frame_np = frame.numpy()+ frame_np = np.clip(frame_np, 0, 255).astype(np.uint8)+ pil_frame = Image.fromarray(frame_np)+ pil_frame = pil_frame.resize((new_w, new_h), resample=resample)+ crop_top = (new_h - height) // 2+ crop_left = (new_w - width) // 2+ pil_frame = pil_frame.crop((crop_left, crop_top, crop_left + width, crop_top + height))+ resized_frames.append(torch.from_numpy(np.array(pil_frame).astype(np.float32)))++ resized = torch.stack(resized_frames, dim=0)+ return rearrange(resized, "f h w c -> 1 c f h w")+++def resize_and_center_crop(tensor: torch.Tensor, height: int, width: int, resample: str | None = None) -> torch.Tensor:"""Resize tensor preserving aspect ratio (filling target), then center crop to exact dimensions.Args:@@ -46,6 +84,9 @@ def resize_and_center_crop(tensor: torch.Tensor, height: int, width: int) -> torReturns:Tensor with shape (1, C, 1, height, width) for 3D input or (1, C, F, height, width) for 4D input"""+ if resample == "lanczos":+ return _resize_and_center_crop_lanczos(tensor, height, width)+if tensor.ndim == 3:tensor = rearrange(tensor, "h w c -> 1 c h w")elif tensor.ndim == 4:@@ -54,6 +95,8 @@ def resize_and_center_crop(tensor: torch.Tensor, height: int, width: int) -> torraise ValueError(f"Expected input with 3 or 4 dimensions; got shape {tensor.shape}.")_, _, src_h, src_w = tensor.shape+ if src_h == height and src_w == width:+ return rearrange(tensor, "f c h w -> 1 c f h w")scale = max(height / src_h, width / src_w)# Use ceil to avoid floating-point rounding causing new_h/new_w to be@@ -116,6 +159,7 @@ def load_image_conditioning(width: int,dtype: torch.dtype,device: torch.device,+ resample: str | None = None,) -> torch.Tensor:"""Loads an image from a path or tensor and preprocesses it for conditioning.@@ -130,7 +174,7 @@ def load_image_conditioning(image = _normalize_image_tensor(image)image = _scale_to_255(image)image = image.to(device=device)- image = resize_and_center_crop(image, height, width)+ image = resize_and_center_crop(image, height, width, resample=resample)image = normalize_latent(image, device, dtype)return imagediff --git a/models/ltx2/ltx_pipelines/utils/model_ledger.py b/models/ltx2/ltx_pipelines/utils/model_ledger.pyindex ac93e30..0d42ebe 100644--- a/models/ltx2/ltx_pipelines/utils/model_ledger.py+++ b/models/ltx2/ltx_pipelines/utils/model_ledger.py@@ -9,9 +9,12 @@ from ...ltx_core.loader.registry import DummyRegistry, Registryfrom ...ltx_core.loader.single_gpu_model_builder import SingleGPUModelBuilder as Builderfrom ...ltx_core.model.audio_vae import (AUDIO_VAE_DECODER_COMFY_KEYS_FILTER,+ AUDIO_VAE_ENCODER_COMFY_KEYS_FILTER,VOCODER_COMFY_KEYS_FILTER,AudioDecoder,AudioDecoderConfigurator,+ AudioEncoder,+ AudioEncoderConfigurator,Vocoder,VocoderConfigurator,)@@ -200,6 +203,18 @@ class ModelLedger:consume_shared_state_dict=True,)+ self.audio_encoder_builder = Builder(+ model_path=self.checkpoint_path,+ model_class_configurator=AudioEncoderConfigurator,+ model_sd_ops=AUDIO_VAE_ENCODER_COMFY_KEYS_FILTER,+ registry=self.registry,+ shared_state_dict=self._shared_state_dict,+ shared_quantization_map=self._shared_quantization_map,+ shared_config=self._shared_config,+ copy_shared_state_dict=True,+ consume_shared_state_dict=False,+ )+self.vocoder_builder = Builder(model_path=self.checkpoint_path,model_class_configurator=VocoderConfigurator,@@ -282,6 +297,7 @@ class ModelLedger:"transformer_builder","vae_decoder_builder","vae_encoder_builder",+ "audio_encoder_builder","audio_decoder_builder","vocoder_builder","text_encoder_builder",@@ -338,6 +354,14 @@ class ModelLedger:return self.vae_encoder_builder.build(device=self._target_device(), dtype=self.dtype).to(self.device).eval()+ def audio_encoder(self) -> AudioEncoder:+ if not hasattr(self, "audio_encoder_builder"):+ raise ValueError(+ "Audio encoder not initialized. Please provide a checkpoint path to the ModelLedger constructor."+ )++ return self.audio_encoder_builder.build(device=self._target_device(), dtype=self.dtype).to(self.device).eval()+def text_encoder(self) -> GemmaTextEncoderModel:if not hasattr(self, "text_encoder_builder"):raise ValueError(diff --git a/profiles/qwen/Lightning Qwen Edit 2511 - 8 Steps.json b/profiles/qwen/Lightning Qwen Edit 2511 - 8 Steps.jsonnew file mode 100644index 0000000..167bd2e--- /dev/null+++ b/profiles/qwen/Lightning Qwen Edit 2511 - 8 Steps.json@@ -0,0 +1,8 @@+{+ "activated_loras": [+ "https://huggingface.co/DeepBeepMeep/Qwen_image/resolve/main/loras_accelerators/Qwen-Image-Edit-2511-Lightning-8steps-V1.0-bf16.safetensors"+ ],+ "loras_multipliers": "1",+ "num_inference_steps": 4,+ "guidance_scale": 1+}diff --git a/wgp.py b/wgp.pyindex ac73d81..b207089 100644--- a/wgp.py+++ b/wgp.py@@ -4082,6 +4082,11 @@ def select_video(state, current_gallery_tab, input_file_list, file_selected, audvalues += [control_net_weight]labels += ["Control Net Weights"]+ audio_scale_name = model_def.get("audio_scale_name", "")+ if len(audio_scale_name) > 0:+ values += [configs.get("audio_scale", 1)]+ labels += [audio_scale_name]+video_skip_steps_cache_type = configs.get("skip_steps_cache_type", "")video_skip_steps_multiplier = configs.get("skip_steps_multiplier", 0)video_skip_steps_cache_start_step_perc = configs.get("skip_steps_start_step_perc", 0)@@ -5018,6 +5023,50 @@ def truncate_audio(generated_audio, trim_video_frames_beginning, trim_video_framend = len(generated_audio) - int(trim_video_frames_end * samples_per_frame)return generated_audio[start:end if end > 0 else None]+def slice_audio_window(audio_path, start_frame, num_frames, fps, output_dir, suffix=""):+ if audio_path is None or num_frames <= 0 or fps <= 0:+ return audio_path+ try:+ import soundfile as sf+ except Exception:+ return audio_path+ import numpy as np++ start_sec = float(start_frame) / float(fps)+ duration_sec = float(num_frames) / float(fps)+ if duration_sec <= 0:+ return audio_path++ with sf.SoundFile(audio_path) as audio_file:+ sample_rate = audio_file.samplerate+ channels = audio_file.channels+ total_frames = len(audio_file)+ start_sample = int(round(start_sec * sample_rate))+ pad_start = 0+ if start_sample < 0:+ pad_start = -start_sample+ start_sample = 0+ frames_to_read = int(round(duration_sec * sample_rate))+ if pad_start == 0 and start_sample == 0 and frames_to_read >= total_frames:+ return audio_path+ if start_sample > total_frames:+ data = np.zeros((0, channels), dtype=np.float32)+ else:+ audio_file.seek(min(start_sample, total_frames))+ data = audio_file.read(frames_to_read, dtype="float32", always_2d=True)++ if pad_start > 0:+ data = np.concatenate([np.zeros((pad_start, channels), dtype=np.float32), data], axis=0)+ target_frames = pad_start + frames_to_read+ if data.shape[0] < target_frames:+ pad_end = target_frames - data.shape[0]+ data = np.concatenate([data, np.zeros((pad_end, channels), dtype=np.float32)], axis=0)++ output_dir = output_dir or os.path.dirname(audio_path) or "."+ temp_path = get_available_filename(output_dir, audio_path, suffix=suffix, force_extension=".wav")+ sf.write(temp_path, data, sample_rate)+ return temp_path+def write_wav_file(file_path, audio_data, sampling_rate):if audio_data is None:@@ -5115,6 +5164,7 @@ def generate_video(model_switch_phase,alt_guidance_scale,audio_guidance_scale,+ audio_scale,flow_shift,sample_solver,embedded_guidance_scale,@@ -5420,7 +5470,6 @@ def generate_video(sliding_window = Falsesliding_window_size = current_video_lengthreuse_frames = 0-original_image_refs = image_refsimage_refs = None if image_refs is None else ([] + image_refs) # work on a copy as it is going to be modified# image_refs = None@@ -5468,7 +5517,7 @@ def generate_video(original_audio_guide2 = audio_guide2audio_proj_split = Noneaudio_proj_full = None- audio_scale = None+ audio_scale = audio_scale if model_def.get("audio_scale_name") else Noneaudio_context_lens = Noneif audio_guide != None:from models.wan.fantasytalking.infer import parse_audio@@ -5506,12 +5555,14 @@ def generate_video(audio_guide = get_vocals(original_audio_guide, get_available_filename(save_path, audio_guide, "_clean", ".wav"))temp_filenames_list += [audio_guide]- output_new_audio_filepath = original_audio_guide+ if model_def.get("audio_scale_name", None) is None:+ output_new_audio_filepath = original_audio_guidecurrent_video_length = min(int(fps * duration //latent_size) * latent_size + latent_size + 1, current_video_length)if fantasy:# audio_proj_split_full, audio_context_lens_full = parse_audio(audio_guide, num_frames= max_source_video_frames, fps= fps, padded_frames_for_embeddings= (reuse_frames if reset_control_aligment else 0), device= processing_device )- audio_scale = 1.0+ if audio_scale is None:+ audio_scale = 1.0elif multitalk:from models.wan.multitalk.multitalk import get_full_audio_embeddings# pad audio_proj_full if aligned to beginning of window to simulate source window overlap@@ -5662,6 +5713,21 @@ def generate_video(aligned_guide_start_frame = guide_start_frame - alignment_shiftaligned_guide_end_frame = guide_end_frame - alignment_shiftaligned_window_start_frame = window_start_frame - alignment_shift+ audio_guide_window = audio_guide+ if sliding_window and audio_guide is not None and model_def.get("audio_guide_window_slicing", False):+ audio_start_frame = aligned_window_start_frame+ if reset_control_aligment:+ audio_start_frame += source_video_overlap_frames_count+ audio_guide_window = slice_audio_window(+ audio_guide,+ audio_start_frame,+ current_video_length,+ fps,+ save_path,+ suffix=f"_win{window_no}",+ )+ if audio_guide_window != audio_guide:+ temp_filenames_list.append(audio_guide_window)if fantasy and audio_guide is not None:audio_proj_split , audio_context_lens = parse_audio(audio_guide, start_frame = aligned_window_start_frame, num_frames= current_video_length, fps= fps, device= processing_device )if multitalk:@@ -5911,6 +5977,8 @@ def generate_video(send_cmd("output")try:+ input_video_for_model = pre_video_guide+ prefix_frames_count = source_video_overlap_frames_count if window_no <= 1 else reuse_framessamples = wan_model.generate(input_prompt = prompt,image_start = image_start_tensor,@@ -5921,12 +5989,12 @@ def generate_video(input_ref_masks = src_ref_masks,input_masks = src_mask,input_masks2 = src_mask2,- input_video= pre_video_guide,+ input_video= input_video_for_model,input_faces = src_faces,input_custom = custom_guide,denoising_strength=denoising_strength,masking_strength=masking_strength,- prefix_frames_count = source_video_overlap_frames_count if window_no <= 1 else reuse_frames,+ prefix_frames_count = prefix_frames_count,frame_num= (current_video_length // latent_size)* latent_size + 1,batch_size = batch_size,height = image_size[0],@@ -5957,7 +6025,7 @@ def generate_video(cfg_zero_step = cfg_zero_step,alt_guide_scale= alt_guidance_scale,audio_cfg_scale= audio_guidance_scale,- audio_guide=audio_guide,+ audio_guide=audio_guide_window,audio_guide2=audio_guide2,audio_proj= audio_proj_split,audio_scale= audio_scale,@@ -6058,6 +6126,13 @@ def generate_video(if samples is not None:samples = samples.to("cpu")+ if (+ output_new_audio_filepath is None+ and generated_audio is None+ and original_audio_guide is not None+ and model_def.get("audio_guide_window_slicing", False)+ ):+ output_new_audio_filepath = original_audio_guideclear_gen_cache()offloadobj.unload_all()gc.collect()@@ -7291,6 +7366,9 @@ def prepare_inputs_dict(target, inputs, model_type = None, model_filename = Noneif not len(model_def.get("control_net_weight_alt_name", "")) >0:pop += ["control_net_weight_alt"]+ if model_def.get("audio_scale_name", None) is None:+ pop += ["audio_scale"]+if not model_def.get("motion_amplitude", False):pop += ["motion_amplitude"]@@ -7901,6 +7979,7 @@ def save_inputs(model_switch_phase,alt_guidance_scale,audio_guidance_scale,+ audio_scale,flow_shift,sample_solver,embedded_guidance_scale,@@ -8160,7 +8239,7 @@ def refresh_remove_background_sound(state, audio_prompt_type, remove_background_def refresh_audio_prompt_type_sources(state, audio_prompt_type, audio_prompt_type_sources):audio_prompt_type = del_in_sequence(audio_prompt_type, "XCPAB")audio_prompt_type = add_to_sequence(audio_prompt_type, audio_prompt_type_sources)- return audio_prompt_type, gr.update(visible = "A" in audio_prompt_type), gr.update(visible = "B" in audio_prompt_type), gr.update(visible = ("B" in audio_prompt_type or "X" in audio_prompt_type)), gr.update(visible= any_letters(audio_prompt_type, "ABX"))+ return audio_prompt_type, gr.update(visible = "A" in audio_prompt_type), gr.update(visible = "B" in audio_prompt_type), gr.update(visible = ("B" in audio_prompt_type or "X" in audio_prompt_type)), gr.update(visible= any_letters(audio_prompt_type, "ABX")), gr.update(visible= any_letters(audio_prompt_type,"AB"))def refresh_image_prompt_type_radio(state, image_prompt_type, image_prompt_type_radio):image_prompt_type = del_in_sequence(image_prompt_type, "VLTS")@@ -9076,32 +9155,62 @@ def generate_video_tab(update_form = False, state_dict = None, ui_defaults = Nonlabel="Automatic Removal of Background behind People or Objects in Reference Images", scale = 3, visible= "I" in video_prompt_type_value and not no_background_removal)- any_audio_prompt = model_def.get("any_audio_prompt", False)- audio_prompt_type_value = ui_get("audio_prompt_type", "A" if any_audio_prompt else "")- audio_prompt_type = gr.Text(value= audio_prompt_type_value, visible= False)+ any_audio_prompt = model_def.get("any_audio_prompt", False)+ audio_prompt_type_value = ui_get("audio_prompt_type", "A" if any_audio_prompt else "")any_multi_speakers = Falseif any_audio_prompt:+ audio_prompt_type_sources_def = model_def.get("audio_prompt_type_sources", None)any_single_speaker = not model_def.get("multi_speakers_only", False)- if not any_single_speaker and "A" in audio_prompt_type_value and not ("B" in audio_prompt_type_value or "X" in audio_prompt_type_value): audio_prompt_type_value = del_in_sequence(audio_prompt_type_value, "XCPAB")- any_multi_speakers = not (model_def.get("one_speaker_only", False)) and not audio_only- if not any_multi_speakers: audio_prompt_type_value = del_in_sequence(audio_prompt_type_value, "XCPB")-- speaker_choices=[("None", "")]- if any_single_speaker: speaker_choices += [("One Person Speaking Only", "A")]- if any_multi_speakers:speaker_choices += [- ("Two speakers, Auto Separation of Speakers (will work only if Voices are distinct)", "XA"),- ("Two speakers, Speakers Audio sources are assumed to be played in a Row", "CAB"),- ("Two speakers, Speakers Audio sources are assumed to be played in Parallel", "PAB")- ]+ any_multi_speakers = not model_def.get("one_speaker_only", False) and not audio_only+ audio_prompt_type_sources_labels_all = {+ "": "None",+ "A": "One Person Speaking Only",+ "XA": "Two speakers, Auto Separation of Speakers (will work only if Voices are distinct)",+ "CAB": "Two speakers, Speakers Audio sources are assumed to be played in a Row",+ "PAB": "Two speakers, Speakers Audio sources are assumed to be played in Parallel",+ }+ if not isinstance(audio_prompt_type_sources_def, dict):+ has_multi_letter = "B" in audio_prompt_type_value or "X" in audio_prompt_type_value+ if not any_single_speaker and "A" in audio_prompt_type_value and not has_multi_letter:+ audio_prompt_type_value = del_in_sequence(audio_prompt_type_value, "XCPAB")+ if not any_multi_speakers:+ audio_prompt_type_value = del_in_sequence(audio_prompt_type_value, "XCPB")+ selection = [""]+ if any_single_speaker:+ selection.append("A")+ if any_multi_speakers:+ selection.extend(["XA", "CAB", "PAB"])+ audio_prompt_type_sources_def = { "selection": selection, "label": "Voices", "scale": 3, "show_label": True, "visible": True, }++ selection = audio_prompt_type_sources_def.get("selection", list(audio_prompt_type_sources_labels_all.keys()))+ audio_prompt_type_sources_labels = audio_prompt_type_sources_def.get("labels", {})+ audio_prompt_type_sources_choices = []+ for choice in selection:+ label = audio_prompt_type_sources_labels.get(choice, audio_prompt_type_sources_labels_all.get(choice, choice))+ audio_prompt_type_sources_choices.append((label, choice))+ if len(audio_prompt_type_sources_choices) == 0:+ audio_prompt_type_sources_choices = [(audio_prompt_type_sources_labels_all[""], "")]+ letters_filter = audio_prompt_type_sources_def.get("letters_filter", "XCPAB")+ default_choice = audio_prompt_type_sources_def.get("default", "")+ audio_prompt_type_sources_value = filter_letters(audio_prompt_type_value, letters_filter, default_choice)+ audio_prompt_type_sources_value = get_default_value(audio_prompt_type_sources_choices, audio_prompt_type_sources_value, default_choice)+ audio_prompt_type_value = del_in_sequence(audio_prompt_type_value, "XCPAB")+ audio_prompt_type_value = add_to_sequence(audio_prompt_type_value, audio_prompt_type_sources_value)+ sources_visible = model_def.get("audio_prompt_choices") is not None and not image_outputs and audio_prompt_type_sources_def.get("visible", True)audio_prompt_type_sources = gr.Dropdown(- choices=speaker_choices,- value= filter_letters(audio_prompt_type_value, "XCPAB"),- label="Voices", scale = 3, visible = model_def.get("audio_prompt_choices") is not None and not image_outputs+ audio_prompt_type_sources_choices,+ value=audio_prompt_type_sources_value,+ label=audio_prompt_type_sources_def.get("label", "Voices"),+ scale=audio_prompt_type_sources_def.get("scale", 3),+ visible=sources_visible,+ show_label=audio_prompt_type_sources_def.get("show_label", True),)else:- audio_prompt_type_sources = gr.Dropdown( choices= [""], value = "", visible=False)+ audio_prompt_type_sources = gr.Dropdown(choices=[""], value="", visible=False)++ audio_prompt_type = gr.Text(value=audio_prompt_type_value, visible=False)- with gr.Row(visible = any_audio_prompt and not image_outputs) as audio_guide_row:+ with gr.Row(visible = any_audio_prompt and any_letters(audio_prompt_type_value,"AB") and not image_outputs) as audio_guide_row:any_audio_guide = any_audio_prompt and not image_outputsany_audio_guide2 = any_multi_speakersaudio_guide = gr.Audio(value= ui_defaults.get("audio_guide", None), type="filepath", label= model_def.get("audio_guide_label","Voice to follow"), show_download_button= True, visible= any_audio_prompt and "A" in audio_prompt_type_value )@@ -9278,11 +9387,14 @@ def generate_video_tab(update_form = False, state_dict = None, ui_defaults = Noncontrol_net_weight_alt_name = model_def.get("control_net_weight_alt_name", "")control_net_weight_name = model_def.get("control_net_weight_name", "")control_net_weight_size = model_def.get("control_net_weight_size", 0)+ audio_scale_name = model_def.get("audio_scale_name", "")+ audio_scale_visible = len(audio_scale_name) > 0- with gr.Row(len(control_net_weight_name) or len(control_net_weight_alt_name) ) as control_net_weights_row:+ with gr.Row(visible=control_net_weight_size >= 1 or len(control_net_weight_alt_name) > 0 or audio_scale_visible) as control_net_weights_row:control_net_weight = gr.Slider(0.0, 2.0, value=ui_get("control_net_weight"), step=0.01, label=f"{control_net_weight_name} Weight" + ("" if control_net_weight_size<=1 else " #1"), visible=control_net_weight_size >= 1, show_reset_button= False)control_net_weight2 = gr.Slider(0.0, 2.0, value=ui_get("control_net_weight2"), step=0.01, label=f"{control_net_weight_name} Weight" + ("" if control_net_weight_size<=1 else " #2"), visible=control_net_weight_size >=2, show_reset_button= False)control_net_weight_alt = gr.Slider(0.0, 2.0, value=ui_get("control_net_weight_alt"), step=0.01, label=control_net_weight_alt_name + " Weight", visible=len(control_net_weight_alt_name) >0, show_reset_button= False)+ audio_scale = gr.Slider(0.0, 2.0, value=ui_get("audio_scale", 1), step=0.01, label=audio_scale_name, visible=audio_scale_visible, show_reset_button= False)with gr.Row(visible = not (hunyuan_t2v or hunyuan_i2v or no_negative_prompt)) as negative_prompt_row:negative_prompt = gr.Textbox(label="Negative Prompt (ignored if no Guidance that is if CFG = 1)", value=ui_get("negative_prompt") )with gr.Column(visible = model_def.get("NAG", False)) as NAG_col:@@ -9780,7 +9892,7 @@ def generate_video_tab(update_form = False, state_dict = None, ui_defaults = Nonguidance_phases.change(fn=change_guidance_phases, inputs= [state, guidance_phases], outputs =[model_switch_phase, guidance_phases_row, switch_threshold, switch_threshold2, guidance2_scale, guidance3_scale ])audio_prompt_type_remux.change(fn=refresh_audio_prompt_type_remux, inputs=[state, audio_prompt_type, audio_prompt_type_remux], outputs=[audio_prompt_type])remove_background_sound.change(fn=refresh_remove_background_sound, inputs=[state, audio_prompt_type, remove_background_sound], outputs=[audio_prompt_type])- audio_prompt_type_sources.change(fn=refresh_audio_prompt_type_sources, inputs=[state, audio_prompt_type, audio_prompt_type_sources], outputs=[audio_prompt_type, audio_guide, audio_guide2, speakers_locations_row, remove_background_sound])+ audio_prompt_type_sources.change(fn=refresh_audio_prompt_type_sources, inputs=[state, audio_prompt_type, audio_prompt_type_sources], outputs=[audio_prompt_type, audio_guide, audio_guide2, speakers_locations_row, remove_background_sound, audio_guide_row])image_prompt_type_radio.change(fn=refresh_image_prompt_type_radio, inputs=[state, image_prompt_type, image_prompt_type_radio], outputs=[image_prompt_type, image_start_row, image_end_row, video_source, keep_frames_video_source, image_prompt_type_endcheckbox], show_progress="hidden" )image_prompt_type_endcheckbox.change(fn=refresh_image_prompt_type_endcheckbox, inputs=[state, image_prompt_type, image_prompt_type_radio, image_prompt_type_endcheckbox], outputs=[image_prompt_type, image_end_row] )video_prompt_type_image_refs.input(fn=refresh_video_prompt_type_image_refs, inputs = [state, video_prompt_type, video_prompt_type_image_refs,image_mode], outputs = [video_prompt_type, image_refs_row, remove_background_images_ref, image_refs_relative_size, frames_positions,video_guide_outpainting_col], show_progress="hidden")