o
    ̳i	                     @   sr   d dl mZ d dlmZmZmZ ddddg dddd	d
f	dededededee dededededefddZdS )    )List)FluxAutoencoderFluxDecoderFluxEncoder         )         r      r
   gxz,C?g=U?
resolutionch_inch_outch_basech_multsch_zn_layers_per_resample_blockscale_factorshift_factorreturnc	                    sZ    fdd|D }	t |||	|||d}
t||tt|	|d ||d}t|| | f|
|dS )a  
    The image autoencoder for all current Flux diffusion models:
    - FLUX.1-dev
    - FLUX.1-schnell
    - FLUX.1-Canny-dev
    - FLUX.1-Depth-dev
    - FLUX.1-Fill-dev

    ch = number of channels (size of the channel dimension)

    Args:
        resolution (int): The height/width of the square input image.
        ch_in (int): The number of channels of the input image.
        ch_out (int): The number of channels of the output image.
        ch_base (int): The base number of channels.
            This gets multiplied by `ch_mult` values to get the number of inner channels during downsampling/upsampling.
        ch_mults (List[int]): The channel multiple per downsample/upsample block.
            This gets multiplied by `ch_base` to get the number of inner channels during downsampling/upsampling.
        ch_z (int): The number of latent channels (dimension of the latent vector `z`).
        n_layers_per_resample_block (int): Number of resnet layers per downsample/upsample block.
        scale_factor (float): Constant for scaling `z`.
        shift_factor (float): Constant for shifting `z`.

    Returns:
        FluxAutoencoder
    c                    s   g | ]} | qS  r   ).0multr   r   Y/home/ubuntu/.local/lib/python3.10/site-packages/torchtune/models/flux/_model_builders.py
<listcomp>0   s    z&flux_1_autoencoder.<locals>.<listcomp>)r   r   channelsn_layers_per_down_blockr   r   r	   )r   r   r   n_layers_per_up_blockr   r   )	img_shapeencoderdecoder)r   r   listreversedr   )r   r   r   r   r   r   r   r   r   r   r!   r"   r   r   r   flux_1_autoencoder   s,   %	

r%   N)	typingr   "torchtune.models.flux._autoencoderr   r   r   intfloatr%   r   r   r   r   <module>   s@   	
