ó
    
3jÞ  ã                   ó|   • S r SSKrSSKrSSKJr  SSKJr  \" SS9 " S S5      5       r\" S	S9 " S
 S	5      5       r	g)aù  Audio-only (text-to-audio) mode for the LTX-2 audio/video model.

The LTX-2 transformer in ComfyUI core (``comfy/ldm/lightricks/av_model.py``)
already supports an audio-only path: every block reads ``run_vx``,
``a2v_cross_attn`` and ``v2a_cross_attn`` from ``transformer_options`` and skips
the video self-attention/FFN and the audio<->video cross-attention when they are
``False``. These flags default to ``True``, so the model normally runs jointly.

``LTXVAudioOnlyModel`` flips those flags, which is the equivalent of the
reference pipeline's ``video=None``: the audio is denoised with no dependence on
the video latent, and the video stream is skipped for speed.

Note: the model splits its input positionally into ``[video, audio]``, so the
sampler still needs a (tiny) dummy video latent at index 0. Use
``LTXVAudioOnlyEmptyVideoLatent`` (a fixed 64x64 single-frame placeholder) joined
with the audio latent via ``LTXVConcatAVLatent``. With ``LTXVAudioOnlyModel``
active that dummy video is never attended to.
é    N)ÚModelPatcheré   )Ú
comfy_nodeÚLTXVAudioOnlyModel)Únamec                   óF   • \ rS rSr\S 5       rSrSrSrSr	Sr
S\4S	 jrS
rg)r   é   c                 ó   • SSSSS0400$ )NÚrequiredÚmodelÚMODELÚtooltipz6The LTX-2 audio/video model to run in audio-only mode.© ©Úss    ÚH/home/wildlama/comfy/ComfyUI/custom_nodes/ComfyUI-LTXVideo/audio_only.pyÚINPUT_TYPESÚLTXVAudioOnlyModel.INPUT_TYPES   s,   € ð ØØà!Ð#[ðððð	
ð 		
ó    )r   )r   ÚpatchúLightricks/audioa«  Run the LTX-2 audio/video model in audio-only mode for text-to-audio. Skips the video stream and disables the audio<->video cross-attention, so the generated audio does not depend on the video latent. The sampler still needs a minimal dummy video latent (EmptyLTXVLatentVideo at 64x64 length 1, joined with LTXVConcatAVLatent); it is never attended to. Remove or bypass this node to restore normal joint audio+video generation.r   c                 ód   • UR                  5       nUR                  S   nSUS'   SUS'   SUS'   U4$ )NÚtransformer_optionsFÚrun_vxÚa2v_cross_attnÚv2a_cross_attn)ÚcloneÚmodel_options)Úselfr   Ú	new_modelr   s       r   r   ÚLTXVAudioOnlyModel.patch7   sJ   € Ø—K‘K“Mˆ	Ø'×5Ñ5Ð6KÑLÐØ(-Ð˜HÑ%Ø05ÐÐ,Ñ-Ø05ÐÐ,Ñ-Øˆ|Ðr   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Úclassmethodr   ÚRETURN_TYPESÚRETURN_NAMESÚFUNCTIONÚCATEGORYÚDESCRIPTIONr   r   Ú__static_attributes__r   r   r   r   r      sA   † àñ

ó ð

ð €LØ€LØ€HØ!€Hð	Dð ð˜<÷ r   ÚLTXVAudioOnlyEmptyVideoLatentc                   ó>   • \ rS rSr\S 5       rSrSrSrSr	Sr
S rS	rg
)r-   é@   c                 ó
   • S0 0$ )Nr   r   r   s    r   r   Ú)LTXVAudioOnlyEmptyVideoLatent.INPUT_TYPESB   s   € à˜BÐÐr   )ÚLATENT)ÚlatentÚgenerater   a@  Fixed minimal placeholder video latent for audio-only (text-to-audio) generation - a single 64x64 frame. LTX-2 needs a video latent at input index 0, but with LTXV Audio Only Model it is never attended to, so the dimensions are fixed (and hidden) to avoid confusion. Join it with the audio latent via LTXVConcatAVLatent.c                 ór   • [         R                  " / SQ[        R                  R	                  5       S9nSU04$ )N)r   é€   r   é   r7   )ÚdeviceÚsamples)ÚtorchÚzerosÚcomfyÚmodel_managementÚintermediate_device)r   r3   s     r   r4   Ú&LTXVAudioOnlyEmptyVideoLatent.generateR   s7   € ô —’ÚÜ×)Ñ)×=Ñ=Ó?ñ
ˆð ˜FÐ#Ð%Ð%r   r   N)r"   r#   r$   r%   r&   r   r'   r(   r)   r*   r+   r4   r,   r   r   r   r-   r-   @   s9   † àñ ó ð ð €LØ€LØ€HØ!€Hð	/ð õ&r   )
Ú__doc__Úcomfy.model_managementr<   r:   Úcomfy.model_patcherr   Únodes_registryr   r   r-   r   r   r   Ú<module>rD      sW   ðñó& Û Ý ,å &ñ Ð%Ñ&÷!ð !ó 'ð!ñH Ð0Ñ1÷&ð &ó 2ñ&r   