
    bi&              
          d dl mZ ddlmZmZ ddlmZ ddlmZm	Z	m
Z
mZmZ ddlmZ ddlmZ dd	lmZmZ  ej(                  e      Z G d
 de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z edefde
fdefdefdefdefg      Z edefdefde
fde	fdefdefdefg      Z edefdefdefdefdefg      Z eee d Z!y!)"   )logging   )AutoPipelineBlocksSequentialPipelineBlocks)InsertableDict   )FluxImg2ImgPrepareLatentsStepFluxImg2ImgSetTimestepsStepFluxInputStepFluxPrepareLatentsStepFluxSetTimestepsStep)FluxDecodeStep)FluxDenoiseStep)FluxTextEncoderStepFluxVaeEncoderStepc                   .    e Zd ZegZdgZdgZed        Zy)FluxAutoVaeEncoderStepimg2imgimagec                      	 y)Na  Vae encoder step that encode the image inputs into their latent representations.
This is an auto pipeline block that works for img2img tasks.
 - `FluxVaeEncoderStep` (img2img) is used when only `image` is provided. - if `image` is provided, step will be skipped. selfs    j/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/diffusers/modular_pipelines/flux/modular_blocks.pydescriptionz"FluxAutoVaeEncoderStep.description'   s    A	
    N)	__name__
__module____qualname__r   block_classesblock_namesblock_trigger_inputspropertyr   r   r   r   r   r   "   s+    '(M+K#9
 
r   r   c                   .    e Zd ZeeegZg dZed        Z	y)FluxBeforeDenoiseStep)inputprepare_latentsset_timestepsc                      	 y)Na"  Before denoise step that prepare the inputs for the denoise step.
This is a sequential pipeline blocks:
 - `FluxInputStep` is used to adjust the batch size of the model inputs
 - `FluxPrepareLatentsStep` is used to prepare the latents
 - `FluxSetTimestepsStep` is used to set the timesteps
r   r   s    r   r   z!FluxBeforeDenoiseStep.description:   s    I	
r   N)
r   r   r   r   r   r   r    r!   r#   r   r   r   r   r%   r%   2   s,    M
 @K
 
r   r%   c                   .    e Zd ZeeegZg dZed        Z	y)FluxImg2ImgBeforeDenoiseStep)r&   r(   r'   c                      	 y)NaA  Before denoise step that prepare the inputs for the denoise step for img2img task.
This is a sequential pipeline blocks:
 - `FluxInputStep` is used to adjust the batch size of the model inputs
 - `FluxImg2ImgSetTimestepsStep` is used to set the timesteps
 - `FluxImg2ImgPrepareLatentsStep` is used to prepare the latents
r   r   s    r   r   z(FluxImg2ImgBeforeDenoiseStep.descriptionJ   s    T	
r   N)
r   r   r   r   r
   r	   r    r!   r#   r   r   r   r   r+   r+   F   s'    "$?A^_M?K
 
r   r+   c                   4    e Zd ZeegZddgZddgZed        Z	y)FluxAutoBeforeDenoiseStep
text2imager   Nimage_latentsc                      	 y)Na  Before denoise step that prepare the inputs for the denoise step.
This is an auto pipeline block that works for text2image.
 - `FluxBeforeDenoiseStep` (text2image) is used.
 - `FluxImg2ImgBeforeDenoiseStep` (img2img) is used when only `image_latents` is provided.
r   r   s    r   r   z%FluxAutoBeforeDenoiseStep.description[   s    m	
r   )
r   r   r   r%   r+   r    r!   r"   r#   r   r   r   r   r.   r.   V   s4    *,HIM+K /2
 
r   r.   c                   4    e Zd ZegZdgZdgZedefd       Z	y)FluxAutoDenoiseStepdenoiseNreturnc                      	 y)NzDenoise step that iteratively denoise the latents. This is a auto pipeline block that works for text2image and img2img tasks. - `FluxDenoiseStep` (denoise) for text2image and img2img tasks.r   r   s    r   r   zFluxAutoDenoiseStep.descriptionk   s    O	
r   )
r   r   r   r   r    r!   r"   r#   strr   r   r   r   r3   r3   f   s2    $%M+K 6
S 
 
r   r3   c                   .    e Zd ZegZdgZdgZed        Zy)FluxAutoDecodeStepznon-inpaintNc                      y)NzTDecode step that decode the denoised latents into image outputs.
 - `FluxDecodeStep`r   r   s    r   r   zFluxAutoDecodeStep.descriptionz   s    fr   )	r   r   r   r   r    r!   r"   r#   r   r   r   r   r9   r9   u   s-    #$M /K 6g gr   r9   c                   2    e Zd ZeeeeegZg dZ	e
d        Zy)FluxAutoBlocks)text_encoderimage_encoderbefore_denoiser4   decoderc                      	 y)NzAuto Modular pipeline for text-to-image and image-to-image using Flux.
- for text-to-image generation, all you need to provide is `prompt`
- for image-to-image generation, you need to provide either `image` or `image_latents`r   r   s    r   r   zFluxAutoBlocks.description   s    g	
r   N)r   r   r   r   r   r.   r3   r9   r    r!   r#   r   r   r   r   r<   r<      s2    !M \K
 
r   r<   r=   r&   r(   r'   r4   decoder>   r?   )r/   r   autoN)"utilsr   modular_pipeliner   r   modular_pipeline_utilsr   r?   r	   r
   r   r   r   decodersr   r4   r   encodersr   r   
get_loggerr   loggerr   r%   r+   r.   r3   r9   r<   TEXT2IMAGE_BLOCKSIMAGE2IMAGE_BLOCKSAUTO_BLOCKS
ALL_BLOCKSr   r   r   <module>rO      sw    K 3  % $ = 
		H	%
/ 
 
4 
(
#; 
 
 2 
 
, 
g+ g
- 
& #	,-	- 	./	23	O$	>"	  $	,-	,-	- 	56	9:	O$	>"
  	,-	01	45	'(	%& .:LVab
r   