o >g@sddlZddlZddlZddlZddlZddlZGdddZGdddZGdddZ Gdd d Z Gd d d Z eee e e d Z dS) Nc@s.eZdZeddZdZdZdZd ddZd S) EmptyLTXVLatentVideoc CsNddddtjddfdddtjddfddd tjd dfdd d d d fd iS)NrequiredINT@ defaultminmaxstepar r r )widthheightlength batch_sizenodesMAX_RESOLUTIONsr?/home/comdoleger1/zen-flux-style-shape/comfy_extras/nodes_lt.py INPUT_TYPES s z EmptyLTXVLatentVideo.INPUT_TYPESLATENTgeneratezlatent/video/ltxvrcCs<tj|d|ddd|d|dgtjd}d|ifS)Nrrrdevicesamples)torchzeroscomfymodel_managementintermediate_device)selfrrrrlatentrrrr!s2 zEmptyLTXVLatentVideo.generateN)r) __name__ __module__ __qualname__ classmethodr RETURN_TYPESFUNCTIONCATEGORYr!rrrrrs rc@0eZdZeddZdZdZdZdZddZ d S) LTXVImgToVideoc CsVddddddddtjdd fdd dtjdd fdd d tjd d fdddddfdiS)Nr CONDITIONING)VAE)IMAGErrrrrr r rrrr)positivenegativevaeimagerrrrrrrrrrszLTXVImgToVideo.INPUT_TYPES)r7r7r )r;r<r,conditioning/video_modelsr!c Cstj|dd||dddd} | ddddddddf} || } t|d| i}t|d| i}tj|d|ddd|d |d gtj d } | | ddddd| j d f<||d | ifS) Nrbilinearcenterguiding_latentr"rrr#r%) r(utilscommon_upscalemovedimencode node_helpersconditioning_set_valuesr&r'r)r*shape) r+r;r<r>r=rrrrpixels encode_pixelstr,rrrr!+s$  2 zLTXVImgToVideo.generateN) r-r.r/r0rr1 RETURN_NAMESr3r2r!rrrrr5s   r5c@r4) LTXVConditioningc Csdddddddddfd iS) Nrr6FLOATg9@g@@{Gz?r)r;r< frame_raterrrrrr8szLTXVConditioning.INPUT_TYPES)r7r7)r;r<appendr?cCs(t|d|i}t|d|i}||fS)NrU)rJrK)r+r;r<rUrrrrVDszLTXVConditioning.appendN) r-r.r/r0rr1rPr2r3rVrrrrrQ7s  rQc@.eZdZeddZdZdZdZd ddZdS) ModelSamplingLTXVcCs2dddddddfddddddfd d d id S) NMODELrRffffff@rSY@rTrffffff?)model max_shift base_shiftr,rroptionalrrrrrrKs zModelSamplingLTXV.INPUT_TYPESrYpatchzadvanced/modelNcCs|}|dur d}n t|djdd}d}d}||||} || |} || | } tjj} tjj} Gddd| | }||jj }|j | d| d||fS) Nrr%rEc@s eZdZdS)z6ModelSamplingLTXV.patch..ModelSamplingAdvancedN)r-r.r/rrrrModelSamplingAdvancedjsre)shiftmodel_sampling) clonemathprodrLr(rgModelSamplingFluxCONSTr^ model_configset_parametersadd_object_patch)r+r^r_r`r,mtokensx1x2mmbrf sampling_base sampling_typerergrrrrcYs      zModelSamplingLTXV.patchN) r-r.r/r0rr1r2r3rcrrrrrXJs rXc@rW) LTXVSchedulerc Cs\dddddfdddd d d fdd dd d d fd dddfddddd ddfdddidS)Nrri'rrRr[rSr\rTrr]BOOLEANTz4Stretch the sigmas to be in the range [terminal, 1].)r tooltipg?gGz?z2The terminal value of the sigmas after stretching.)r r r r r|)stepsr_r`stretchterminalr,rrarrrrrrtszLTXVScheduler.INPUT_TYPES)SIGMASz#sampling/custom_sampling/schedulers get_sigmasNcCs|durd}n t|djdd}tdd|d}d} d} ||| | } || | } || | } d}t|dkt| t| d|d|d}|ro|dk}||}d|}|d d|}d||}|||<|fS) Nrr%rEg?rSrrdrr@)rirjrLr&linspacewhereexp)r+r}r_r`r~rr,rqsigmasrrrsrtruZ sigma_shiftpowerZ non_zero_maskZnon_zero_sigmasZ one_minus_z scale_factorZ stretchedrrrrs.  " zLTXVScheduler.get_sigmasrx) r-r.r/r0rr1r3r2rrrrrryss ry)rr5rXrQry) rrJr&Zcomfy.model_managementr(comfy.model_samplingrirr5rQrXryNODE_CLASS_MAPPINGSrrrrs")=