o >gT@sddlZddlZddlZddlZddlmZmZddl Z e dddZ GdddZ dd l mZddlZe dd d ZGd d d Ze edZd diZdS)N)trangetqdm@bislerpc  CsD|durin|}|durtt|ddd}n |d7}t|t|d}td||dd} |} ||jdg} tt|d|dD]X} |||| | fi|} |durh||| || || | d| }| t| krt j |t | d| | t | d| | |d }|| ddkr||| dt |7}qG|S) N?rdisablexisigma sigma_hatdenoiseddisabled)maxlenminnplinspacesizenew_onesshapercomfyutilscommon_upscaleroundtorch randn_like)modelr sigmas extra_argscallbackr total_upscaleupscale_method upscale_stepsZupscales orig_shapes_inr rr+N/home/comdoleger1/zen-flux-style-shape/comfy_extras/nodes_advanced_samplers.pysample_lcm_upscale s& 4r-c@s4eZdZgdZeddZdZdZdZddZ d S) SamplerLCMUpscale)rz nearest-exactbilinearareabicubiccCs0dddddddfdd d d d df|jfd iS) NrequiredFLOATrg?g4@g{Gz?)defaultrrstepINTrir) scale_ratio scale_stepsr')upscale_methodssr+r+r, INPUT_TYPES(s zSamplerLCMUpscale.INPUT_TYPESSAMPLERz!sampling/custom_sampling/samplers get_samplercCs*|dkrd}tjjt|||dd}|fS)Nr)r&r(r') extra_options)rsamplersKSAMPLERr-)selfr7r8r'samplerr+r+r,r?5szSamplerLCMUpscale.get_samplerN) __name__ __module__ __qualname__r9 classmethodr< RETURN_TYPESCATEGORYFUNCTIONr?r+r+r+r,r.%s  r.)to_dcs|durin|}dgfdd}|di}tjj||dd|d<||jdg}tt|d|dD]=} || } ||| |fi|} t || d|| | } |durf||| || | | d || d| } || | }q7|S) Nrcs|dd<|dS)Nuncond_denoisedrrr+)argstempr+r,post_cfg_functionCs z*sample_euler_pp..post_cfg_function model_optionsT)disable_cfg1_optimizationrr r ) getcopyr model_patcher#set_model_options_post_cfg_functionrrrrrL)r"r r#r$r%r rQrRr*r rrddtr+rOr,sample_euler_pp>s rZc@s,eZdZeddZdZdZdZddZdS) SamplerEulerCFGppcCsddddgfiiS)Nr2versionregular alternativer+r:r+r+r,r<Ws zSamplerEulerCFGpp.INPUT_TYPESr= _for_testingr?cCs,|dkr tjt}|fStjd}|fS)Nr^ euler_cfg_pp)rrArBrZksampler)rCr\rDr+r+r,r?bs   zSamplerEulerCFGpp.get_samplerN) rErFrGrHr<rIrJrKr?r+r+r+r,r[Vs  r[)r.r[zSamplerEulerCFG++)NNNrrN)NNN)comfy.samplersr comfy.utilsr numpyr tqdm.autorrmathno_gradr-r.Zcomfy.k_diffusion.samplingrLcomfy.model_patcherrZr[NODE_CLASS_MAPPINGSNODE_DISPLAY_NAME_MAPPINGSr+r+r+r,s&