
    +j                         d dl mZ d dlmZ d dlZd dlZd dlmZm	Z	 d dl
Z
 G d de	j                  Z G d de	j                  Z G d	 d
e          ZdefdZdS )    )override)CallableN)ComfyExtensionioc            
       l    e Zd Zedej        fd            Zedddedededej        fd            Z	d	S )
EmptyChromaRadianceLatentImagereturnc                 r   t          j        ddt           j                            dddt          j        d          t           j                            dddt          j        d          t           j                            dd	d	d
          gt          j                                                    g          S )Nr   zmodel/latent/chroma_radiancewidthi      )iddefaultminmaxstepheight
batch_size   i   )r   r   r   r   )node_idcategoryinputsoutputs)r   SchemaIntInputnodesMAX_RESOLUTIONLatentOutputclss    B/home/wildlama/comfy/ComfyUI/comfy_extras/nodes_chroma_radiance.pydefine_schemaz,EmptyChromaRadianceLatentImage.define_schema   s    y4325CW^`aa$BEDX_abbaQDII
 Y[[''))*	
 	
 	
 		
    r   )r   r   r   r   c                    t          j        |d||ft          j                                                  }t          j        d|i          S )N   )devicesamples)torchzeroscomfymodel_managementintermediate_devicer   
NodeOutput)r!   r   r   r   latents        r"   executez&EmptyChromaRadianceLatentImage.execute   sC    j!VU;EDZDnDnDpDpqqq}i/000r$   N)
__name__
__module____qualname__classmethodr   r   r#   intr.   r0    r$   r"   r   r      s        

bi 

 

 

 [

 AB 1 1 1s 1C 1S 1r} 1 1 1 [1 1 1r$   r   c                       e Zd Zedej        fd            Zedej        j        de	de
de
dede	dej        fd	            Zd
S )ChromaRadianceOptionsr	   c                    t          j        dddt           j                            d          t           j                            ddd	          t           j                            d
ddddd          t           j                            dddddd          t           j                            ddddd          t           j                            dddd          gt           j                                        g          S )Nr8   zmodel/patch/chroma_radiancez>Allows setting advanced options for the Chroma Radiance model.model)r   preserve_wrapperTzqWhen enabled, will delegate to an existing model function wrapper if it exists. Generally should be left enabled.)r   r   tooltipstart_sigmag      ?g        z1First sigma that these options will be in effect.)r   r   r   r   r<   advanced	end_sigmaz0Last sigma that these options will be in effect.nerf_tile_sizezAllows overriding the default NeRF tile size. -1 means use the default (32). 0 means use non-tiling mode (may require a lot of VRAM).)r   r   r   r<   r>   force_sequential_txt_idsFzForce usage of sequential text token IDs instead of zeroes. Should be used for checkpoints from 2026-05-22 to 2026-06-01 that are trained in this way but do not contain the __sequential__ key in the state dict.)r   r   r<   r>   )r   r   descriptionr   r   )r   r   Modelr   BooleanFloatr   r   r    s    r"   r#   z#ChromaRadianceOptions.define_schema    s'   y+2X'**
  )  P !  
 $O!    "N!    ' d!    
  1! q!	 !  =$J X__&&'S*
 *
 *
 *	
r$   r:   r;   r=   r?   r@   rB   c                V  	 i 	|dk    r|	d<   |rd	d<   	st          j        |          S |j                            d          dt          dt
          dt          j        f	fd	}|                                }|	                    |           t          j        |          S )
Nr   r@   Tuse_sequential_txt_idsmodel_function_wrapperapply_modelargsr	   c                    |d                                          }|d                                                                                                                                         }|cxk    r	k    rGn nD|                    di                                            }                                 |d<   ||d<   rs | |d         |d         fi |S  | |d|iz            S )Nctimesteptransformer_optionschroma_radiance_optionsinput)copyr   detachcpuitemget)
rJ   rK   rM   sigmarO   r?   old_wrapperr;   radiance_optionsr=   s
        r"   rI   z=ChromaRadianceOptions.execute.<locals>.model_function_wrappere   s   S	  A$((**11337799>>@@EE0000[00000&'ee,A2&F&F&K&K&M&M#AQAVAVAXAX#$=>+>'($ I I"{4=$z2BHHaHHH;{DC8O<<<r$   )
r   r.   model_optionsrV   r   dictr)   Tensorcloneset_model_unet_function_wrapper)
r!   r:   r;   r=   r?   r@   rB   rI   rX   rY   s
     ```   @@r"   r0   zChromaRadianceOptions.executeN   s     Q1?-.# 	>9=56 	(=''')--.FGG		= 		= 		= 		= 		= 		= 		= 		= 		= 		= 		= 		= 		= --.DEEE}U###r$   N)r1   r2   r3   r4   r   r   r#   rD   Typeboolfloatr5   r.   r0   r6   r$   r"   r8   r8      s        +
bi +
 +
 +
 [+
Z #$ x}#$ 	#$
 #$ #$ #$ #'#$ 
#$ #$ #$ [#$ #$ #$r$   r8   c                   L    e Zd Zedeeej                          fd            ZdS )ChromaRadianceExtensionr	   c                 "   K   t           t          gS N)r   r8   )selfs    r"   get_node_listz%ChromaRadianceExtension.get_node_listv   s       +!
 	
r$   N)	r1   r2   r3   r   listtyper   	ComfyNoderg   r6   r$   r"   rc   rc   u   sE        
T$r|*<%= 
 
 
 X
 
 
r$   rc   r	   c                  "   K   t                      S re   )rc   r6   r$   r"   comfy_entrypointrl   ~   s      "$$$r$   )typing_extensionsr   typingr   r)   comfy.model_managementr+   comfy_api.latestr   r   r   rj   r   r8   rc   rl   r6   r$   r"   <module>rq      s   & & & & & &            / / / / / / / / 1 1 1 1 1R\ 1 1 1(S$ S$ S$ S$ S$BL S$ S$ S$l
 
 
 
 
n 
 
 
% 7 % % % % % %r$   