+
    Lja                        ^ RI t ^ RIHt ^ RIt^ RIHt ^RIHtHt ^RI	H
t
 ^RIHt ]
P                  ! ]4      t ! R R]4      t ! R R	]]4      t ! R
 R]P$                  4      t ! R R]P$                  4      t ! R R]P$                  4      t ! R R]P$                  4      t ! R R]P$                  4      t ! R R]P$                  4      t ! R R]P$                  4      tR# )    N)Callable)ConfigMixinregister_to_config)logging)
ModelMixinc                      a a ] tR t^t oRtV3R lV 3R lltRV3R lR lltRV3R lR llt]V3R lR	 l4       t	R
t
VtV ;t# )MultiAdaptera}  
MultiAdapter is a wrapper model that contains multiple adapter models and merges their outputs according to
user-assigned weighting.

This model inherits from [`ModelMixin`]. Check the superclass documentation for common methods such as downloading
or saving.

Args:
    adapters (`list[T2IAdapter]`, *optional*, defaults to None):
        A list of `T2IAdapter` model instances.
c                .   < V ^8  d   QhRS[ R,          /# )   adapters
T2IAdapter)list)format__classdict__s   "D/app/.local/lib/python3.14/site-packages/diffusers/models/adapter.py__annotate__MultiAdapter.__annotate__)   s     !? !?l!3 !?    c                `  < \         \        V `  4        \        V4      V n        \
        P                  ! V4      V n        \        V4      ^ 8X  d   \        R4      h\        V4      ^8X  d   \        R4      hV^ ,          P                  pV^ ,          P                  p\        ^\        V4      4       Fn  pW,          P                  V8w  g   W,          P                  V8w  g   K3  \        RV RV RV RW,          P                   RV RW,          P                   24      h	  W n	        W0n
        R# )	r   zExpecting at least one adapterzQFor a single adapter, please use the `T2IAdapter` class instead of `MultiAdapter`zjExpecting all adapters to have the same downscaling behavior, but got:
adapters[0].total_downscale_factor=z
adapters[0].downscale_factor=z

adapter[`z`].total_downscale_factor=z`].downscale_factor=N)superr	   __init__lennum_adapternn
ModuleListr   
ValueErrortotal_downscale_factordownscale_factorrange)selfr   $first_adapter_total_downscale_factorfirst_adapter_downscale_factoridx	__class__s   &&   r   r   MultiAdapter.__init__)   s$   lD*,x=h/x=A=>>x=Apqq 08{/Q/Q,)1!)E)E&CM*C448\\=115SS ::^9_ `44R3S T  #u$>x}?c?c>d e  #u$89W9W8X	Z  + 'K# >r   c                   < V ^8  d   QhRS[ P                  RS[S[,          R,          RS[S[ P                  ,          /# )r   xsadapter_weightsNreturn)torchTensorr   float)r   r   s   "r   r   r   L   s<        %,,  et9K  W[\a\h\hWi  r   c                   Vf;   \         P                  ! ^V P                  ,          .V P                  ,          4      pM\         P                  ! V4      pRp\        WV P                  4       F~  w  rEpV! V4      pVf1   Tp\        \        V4      4       F  pWSV,          ,          W8&   K  	  KB  \        \        V4      4       F$  pW8;;,          WWV,          ,          ,          uu&   K&  	  K  	  V# )a  
Args:
    xs (`torch.Tensor`):
        A tensor of shape (batch, channel, height, width) representing input images for multiple adapter
        models, concatenated along dimension 1(channel dimension). The `channel` dimension should be equal to
        `num_adapter` * number of channel per image.

    adapter_weights (`list[float]`, *optional*, defaults to None):
        A list of floats representing the weights which will be multiplied by each adapter's output before
        summing them together. If `None`, equal weights will be used for all adapters.

Returns:
    `list[torch.Tensor]`:
        A list of feature tensors, one per scale, obtained by summing the per-scale features of each adapter
        weighted by `adapter_weights`.
N)r*   tensorr   zipr   r   r   )	r    r'   r(   accume_statexwadapterfeaturesis	   &&&      r   forwardMultiAdapter.forwardL   s    " "#llA0@0@,@+ADDTDT+TUO#ll?;O dmmDMA'qzH#'s<01A&'q/&9LO 2 s8}-A OqA;6O . E r   c                j   < V ^8  d   QhRS[ S[P                  ,          RS[RS[RS[RS[ R,          /# )r   save_directoryis_main_processsave_functionsafe_serializationvariantN)strosPathLikeboolr   )r   r   s   "r   r   r   n   sQ     (@ (@bkk)(@ (@  	(@
 !(@ t(@r   c           	         ^ pTpV P                    F.  pVP                  VVVVVR7       V^,          pVRV 2,           pK0  	  R# )a  
Save a model and its configuration file to a specified directory, allowing it to be re-loaded with the
`[`~models.adapter.MultiAdapter.from_pretrained`]` class method.

Args:
    save_directory (`str` or `os.PathLike`):
        The directory where the model will be saved. If the directory does not exist, it will be created.
    is_main_process (`bool`, optional, defaults=True):
        Indicates whether current process is the main process or not. Useful for distributed training (e.g.,
        TPUs) and need to call this function on all processes. In this case, set `is_main_process=True` only
        for the main process to avoid race conditions.
    save_function (`Callable`):
        Function used to save the state dictionary. Useful for distributed training (e.g., TPUs) to replace
        `torch.save` with another method. Can also be configured using`DIFFUSERS_SAVE_MODE` environment
        variable.
    safe_serialization (`bool`, optional, defaults=True):
        If `True`, save the model using `safetensors`. If `False`, save the model with `pickle`.
    variant (`str`, *optional*):
        If specified, weights are saved in the format `pytorch_model.<variant>.bin`.
)r:   r;   r<   r=   _N)r   save_pretrained)	r    r9   r:   r;   r<   r=   r#   model_path_to_saver3   s	   &&&&&&   r   rD   MultiAdapter.save_pretrainedn   s[    8 +}}G##" /+#5 $  1HC!3#i!? %r   c                R   < V ^8  d   QhRS[ S[P                  ,          R,          /# )r   pretrained_model_pathN)r>   r?   r@   )r   r   s   "r   r   r      s%     A AC"++4E4L Ar   c                   ^ p. pTp\         P                  P                  V4      '       d@   \        P                  ! V3/ VB pVP                  V4       V^,          pVRV 2,           pKd  \        P                  \        V4       RV R24       \        V4      ^ 8X  d7   \        R\         P                  P                  V4       RVR,            R24      hV ! V4      # )ag  
Instantiate a pretrained `MultiAdapter` model from multiple pre-trained adapter models.

The model is set in evaluation mode by default using `model.eval()` (Dropout modules are deactivated). To train
the model, set it back to training mode using `model.train()`.

Warnings:
    *Weights from XXX not initialized from pretrained model* means that the weights of XXX are not pretrained
    with the rest of the model. It is up to you to train those weights with a downstream fine-tuning. *Weights
    from XXX not used in YYY* means that the layer XXX is not used by YYY, so those weights are discarded.

Args:
    pretrained_model_path (`os.PathLike`):
        A path to a *directory* containing model weights saved using
        [`~diffusers.models.adapter.MultiAdapter.save_pretrained`], e.g., `./my_model_directory/adapter`.
    torch_dtype (`torch.dtype`, *optional*):
        Override the default `torch.dtype` and load the model under this dtype.
    output_loading_info(`bool`, *optional*, defaults to `False`):
        Whether or not to also return a dictionary containing missing keys, unexpected keys and error messages.
    device_map (`str` or `dict[str, int | str | torch.device]`, *optional*):
        A map that specifies where each submodule should go. It doesn't need to be refined to each
        parameter/buffer name, once a given module name is inside, every submodule of it will be sent to the
        same device.

        To have Accelerate compute the most optimized `device_map` automatically, set `device_map="auto"`. For
        more information about each option see [designing a device
        map](https://hf.co/docs/accelerate/main/en/usage_guides/big_modeling#designing-a-device-map).
    max_memory (`Dict`, *optional*):
        A dictionary mapping device identifiers to their maximum memory. Default to the maximum memory
        available for each GPU and the available CPU RAM if unset.
    low_cpu_mem_usage (`bool`, *optional*, defaults to `True` if torch version >= 1.9.0 else `False`):
        Speed up model loading by not initializing the weights and only loading the pre-trained weights. This
        also tries to not use more than 1x model size in CPU memory (including peak memory) while loading the
        model. This is only supported when torch version >= 1.9.0. If you are using an older version of torch,
        setting this argument to `True` will raise an error.
    variant (`str`, *optional*):
        If specified, load weights from a `variant` file (*e.g.* pytorch_model.<variant>.bin). `variant` will
        be ignored when using `from_flax`.
    use_safetensors (`bool`, *optional*, defaults to `None`):
        If `None`, the `safetensors` weights will be downloaded if available **and** if`safetensors` library is
        installed. If `True`, the model will be forcibly loaded from`safetensors` weights. If `False`,
        `safetensors` is not used.
rC   z adapters loaded from .zNo T2IAdapters found under z. Expected at least _0)r?   pathisdirr   from_pretrainedappendloggerinfor   r   dirname)clsrH   kwargsr#   r   model_path_to_loadr3   s   &&,    r   rN   MultiAdapter.from_pretrained   s    Z 
 3ggmm.// 001CNvNGOOG$1HC!61SE!Bs8}o%;<Q;RRSTUx=A-bggoo>S.T-UUij  CG  kG  jH  HI  J  8}r   )r   r   r   r   N)TNTN)__name__
__module____qualname____firstlineno____doc__r   r6   rD   classmethodrN   __static_attributes____classdictcell____classcell__r$   r   s   @@r   r	   r	      sI     
!? !?F   D(@ (@T A A Ar   r	   c                      a a ] tR t^t oRt]^. R
O^^R3V3R lV 3R lll4       tV3R lR lt]R 4       t	]R 4       t
R	tVtV ;t# )r   a  
A simple ResNet-like model that accepts images containing control signals such as keyposes and depth. The model
generates multiple feature maps that are used as additional conditioning in [`UNet2DConditionModel`]. The model's
architecture follows the original implementation of
[Adapter](https://github.com/TencentARC/T2I-Adapter/blob/686de4681515662c0ac2ffa07bf5dda83af1038a/ldm/modules/encoders/adapter.py#L97)
 and
 [AdapterLight](https://github.com/TencentARC/T2I-Adapter/blob/686de4681515662c0ac2ffa07bf5dda83af1038a/ldm/modules/encoders/adapter.py#L235).

This model inherits from [`ModelMixin`]. Check the superclass documentation for the common methods, such as
downloading or saving.

Args:
    in_channels (`int`, *optional*, defaults to `3`):
        The number of channels in the adapter's input (*control image*). Set it to 1 if you're using a gray scale
        image.
    channels (`list[int]`, *optional*, defaults to `(320, 640, 1280, 1280)`):
        The number of channels in each downsample block's output hidden state. The `len(block_out_channels)`
        determines the number of downsample blocks in the adapter.
    num_res_blocks (`int`, *optional*, defaults to `2`):
        Number of ResNet blocks in each downsample block.
    downscale_factor (`int`, *optional*, defaults to `8`):
        A factor that determines the total downscale factor of the Adapter.
    adapter_type (`str`, *optional*, defaults to `full_adapter`):
        Adapter type (`full_adapter` or `full_adapter_xl` or `light_adapter`) to use.
full_adapterc          
      H   < V ^8  d   QhRS[ RS[S[ ,          RS[ RS[ RS[/# )r   in_channelschannelsnum_res_blocksr   adapter_type)intr   r>   )r   r   s   "r   r   T2IAdapter.__annotate__   sA       s) 	
  r   c                   < \         SV `  4        VR 8X  d   \        WW44      V n        R# VR8X  d   \	        WW44      V n        R# VR8X  d   \        WW44      V n        R# \        RV R24      h)rc   full_adapter_xllight_adapterzUnsupported adapter_type: 'zH'. Choose either 'full_adapter' or 'full_adapter_xl' or 'light_adapter'.N)r   r   FullAdapterr3   FullAdapterXLLightAdapterr   )r    re   rf   rg   r   rh   r$   s   &&&&&&r   r   T2IAdapter.__init__   sq     	>)&{n_DL..(aDL_,'~`DL-l^ <8 8 r   c                ^   < V ^8  d   QhRS[ P                  RS[S[ P                  ,          /# r   r1   r)   r*   r+   r   )r   r   s   "r   r   rj     s(       $u||*< r   c                $    V P                  V4      # )a  
This function processes the input tensor `x` through the adapter model and returns a list of feature tensors,
each representing information extracted at a different scale from the input. The length of the list is
determined by the number of downsample blocks in the Adapter, as specified by the `channels` and
`num_res_blocks` parameters during initialization.

Args:
    x (`torch.Tensor`):
        The input tensor to process through the adapter model.

Returns:
    `list[torch.Tensor]`:
        A list of feature tensors, each representing information extracted at a different scale from the input.
        The length of the list equals the number of downsample blocks in the adapter.
r3   r    r1   s   &&r   r6   T2IAdapter.forward  s      ||Ar   c                .    V P                   P                  # rW   )r3   r   r    s   &r   r   !T2IAdapter.total_downscale_factor!  s    ||222r   c                B    V P                   P                  P                  # )zThe downscale factor applied in the T2I-Adapter's initial pixel unshuffle operation. If an input image's dimensions are
not evenly divisible by the downscale_factor then an exception will be raised.
)r3   	unshuffler   rz   s   &r   r   T2IAdapter.downscale_factor%  s    
 ||%%666r   rv   @       r   )rX   rY   rZ   r[   r\   r   r   r6   propertyr   r   r^   r_   r`   ra   s   @@r   r   r      sk     4  4 !*  , $ 3 3 7 7 7r   r   c                   d   a a ] tR tRt oRt^. RO^^3V3R lV 3R llltV3R lR ltRtVtV ;t	# )	rn   i0  *
See [`T2IAdapter`] for more information.
c                B   < V ^8  d   QhRS[ RS[S[ ,          RS[ RS[ /# r   re   rf   rg   r   ri   r   )r   r   s   "r   r   FullAdapter.__annotate__5  s=     R RR s)R 	R
 Rr   c                
  < \         SV `  4        W^,          ,          p\        P                  ! V4      V n        \        P
                  ! W^ ,          ^^R7      V n        \        P                  ! \        V^ ,          V^ ,          V4      .\        ^\        V4      4       Uu. uF%  p\        W%^,
          ,          W%,          VRR7      NK'  	  upO4      V n        V^\        V4      ^,
          ,          ,          V n        R# u upi r   kernel_sizepaddingTdownN)r   r   r   PixelUnshuffler}   Conv2dconv_inr   AdapterBlockr   r   bodyr   r    re   rf   rg   r   r5   r$   s   &&&&& r   r   FullAdapter.__init__5  s     	!a$77**+;<yyqkqRSTMMXa[(1+~F #1c(m44 !a%(+~TXY4
	 '7s8}q?P9Q&Q#s   !+D 
c                ^   < V ^8  d   QhRS[ P                  RS[S[ P                  ,          /# rs   rt   )r   r   s   "r   r   r   O  s(       $u||*< r   c                    V P                  V4      pV P                  V4      p. pV P                   F  pV! V4      pVP                  V4       K  	  V# )a  
This method processes the input tensor `x` through the FullAdapter model and performs operations including
pixel unshuffling, convolution, and a stack of AdapterBlocks. It returns a list of feature tensors, each
capturing information at a different stage of processing within the FullAdapter model. The number of feature
tensors in the list is determined by the number of downsample blocks specified during initialization.
r}   r   r   rO   r    r1   r4   blocks   &&  r   r6   FullAdapter.forwardO  sN     NN1LLOYYEaAOOA  r   r   r   r   r}   r   
rX   rY   rZ   r[   r\   r   r6   r^   r_   r`   ra   s   @@r   rn   rn   0  s3      4 !R R4  r   rn   c                   d   a a ] tR tRt oRt^. RO^^3V3R lV 3R llltV3R lR ltRtVtV ;t	# )	ro   ib  r   c                B   < V ^8  d   QhRS[ RS[S[ ,          RS[ RS[ /# r   r   )r   r   s   "r   r   FullAdapterXL.__annotate__g  s7     ; ;; s); 	;
 ;r   c           
       < \         SV `  4        W^,          ,          p\        P                  ! V4      V n        \        P
                  ! W^ ,          ^^R7      V n        . V n        \        \        V4      4       F  pV^8X  d<   V P                  P                  \        W%^,
          ,          W%,          V4      4       KE  V^8X  d>   V P                  P                  \        W%^,
          ,          W%,          VRR7      4       K  V P                  P                  \        W%,          W%,          V4      4       K  	  \        P                  ! V P                  4      V n        V^,          V n        R# r   )r   r   r   r   r}   r   r   r   r   r   rO   r   r   r   r   s   &&&&& r   r   FullAdapterXL.__init__g  s     	!a$77**+;<yyqkqRST	s8}%AAv		  h1uox{N![\a		  h1uox{Nae!fg		  hk8;!WX & MM$)),	&6&:#r   c                ^   < V ^8  d   QhRS[ P                  RS[S[ P                  ,          /# rs   rt   )r   r   s   "r   r   r     s(       $u||*< r   c                    V P                  V4      pV P                  V4      p. pV P                   F  pV! V4      pVP                  V4       K  	  V# )z
This method takes the tensor x as input and processes it through FullAdapterXL model. It consists of operations
including unshuffling pixels, applying convolution layer and appending each block into list of feature tensors.
r   r   s   &&  r   r6   FullAdapterXL.forward  sN    
 NN1LLOYYEaAOOA  r   r   r   r   ra   s   @@r   ro   ro   b  s1      4 "; ;8  r   ro   c                   X   a a ] tR tRt oRtRV3R lV 3R llltV3R lR ltRtVtV ;t	# )	r   i  a  
An AdapterBlock is a helper model that contains multiple ResNet-like blocks. It is used in the `FullAdapter` and
`FullAdapterXL` models.

Args:
    in_channels (`int`):
        Number of channels of AdapterBlock's input.
    out_channels (`int`):
        Number of channels of AdapterBlock's output.
    num_res_blocks (`int`):
        Number of ResNet blocks in the AdapterBlock.
    down (`bool`, *optional*, defaults to `False`):
        If `True`, perform downsampling on AdapterBlock's input.
c                2   < V ^8  d   QhRS[ RS[ RS[ RS[/# r   re   out_channelsrg   r   ri   rA   )r   r   s   "r   r   AdapterBlock.__annotate__  s*     
 
C 
s 
C 
W[ 
r   c                R  < \         SV `  4        R V n        V'       d   \        P                  ! ^^RR7      V n        R V n        W8w  d   \        P                  ! W^R7      V n        \        P                  ! \        V4       Uu. uF  p\        V4      NK  	  up!  V n
        R # u upi )NTr   stride	ceil_moder   )r   r   
downsampler   	AvgPool2din_convr   
Sequentialr   AdapterResnetBlockresnets)r    re   r   rg   r   rC   r$   s   &&&&& r   r   AdapterBlock.__init__  s}     llqdSDO&99[ANDL}}8=n8MN8M1 .8MN
Ns   B$c                N   < V ^8  d   QhRS[ P                  RS[ P                  /# rs   r*   r+   )r   r   s   "r   r   r     s#       %,, r   c                    V P                   e   V P                  V4      pV P                  e   V P                  V4      pV P                  V4      pV# )z
This method takes tensor x as input and performs operations downsampling and convolutional layers if the
self.downsample and self.in_conv properties of AdapterBlock model are specified. Then it applies a series of
residual blocks to the input tensor.
r   r   r   rw   s   &&r   r6   AdapterBlock.forward  sE     ??&"A<<#QALLOr   r   Fr   ra   s   @@r   r   r     s#     
 
  r   r   c                   T   a a ] tR tRt oRtV3R lV 3R lltV3R lR ltRtVtV ;t	# )r   i  z
An `AdapterResnetBlock` is a helper model that implements a ResNet-like block.

Args:
    channels (`int`):
        Number of channels of AdapterResnetBlock's input and output.
c                    < V ^8  d   QhRS[ /# r   rf   ri   )r   r   s   "r   r   AdapterResnetBlock.__annotate__  s     C C Cr   c                   < \         SV `  4        \        P                  ! W^^R7      V n        \        P
                  ! 4       V n        \        P                  ! W^R7      V n        R# )   r   r   Nr   r   r   r   block1ReLUactblock2r    rf   r$   s   &&r   r   AdapterResnetBlock.__init__  sA    ii1M779iiBr   c                N   < V ^8  d   QhRS[ P                  RS[ P                  /# rs   r   )r   r   s   "r   r   r     #     	 	 	%,, 	r   c                t    V P                  V P                  V4      4      pV P                  V4      pW!,           # )z
This method takes input tensor x and applies a convolutional layer, ReLU activation, and another convolutional
layer on the input tensor. It returns addition with the input tensor.
r   r   r   r    r1   hs   && r   r6   AdapterResnetBlock.forward  .     HHT[[^$KKNur   r   r   ra   s   @@r   r   r     s%     C C	 	 	r   r   c                   d   a a ] tR tRt oRt^. RO^^3V3R lV 3R llltV3R lR ltRtVtV ;t	# )	rp   i  r   c                B   < V ^8  d   QhRS[ RS[S[ ,          RS[ RS[ /# r   r   )r   r   s   "r   r   LightAdapter.__annotate__  s=     N NN s)N 	N
 Nr   c                  < \         SV `  4        W^,          ,          p\        P                  ! V4      V n        \        P
                  ! \        W^ ,          V4      .\        \        V4      ^,
          4       Uu. uF%  p\        W%,          W%^,           ,          VRR7      NK'  	  upO\        VR,          VR,          VRR7      N4      V n	        V^\        V4      ,          ,          V n
        R# u upi )r   Tr   N)r   r   r   r   r}   r   LightAdapterBlockr   r   r   r   r   s   &&&&& r   r   LightAdapter.__init__  s     	!a$77**+;<MM!+{NK #3x=1#455 &hk8E?NY]^5 "(2,nSWX	
	 '7!s8}:L&M#s   :+C/
c                ^   < V ^8  d   QhRS[ P                  RS[S[ P                  ,          /# rs   rt   )r   r   s   "r   r   r     s(       $u||*< r   c                    V P                  V4      p. pV P                   F  pV! V4      pVP                  V4       K  	  V# )z
This method takes the input tensor x and performs downscaling and appends it in list of feature tensors. Each
feature tensor corresponds to a different level of processing within the LightAdapter.
)r}   r   rO   r   s   &&  r   r6   LightAdapter.forward  sA    
 NN1YYEaAOOA  r   )r   r   r}   )r   r   r   r   ra   s   @@r   rp   rp     s3      . !N N4  r   rp   c                   X   a a ] tR tRt oRtRV3R lV 3R llltV3R lR ltRtVtV ;t	# )	r   i  a  
A `LightAdapterBlock` is a helper model that contains multiple `LightAdapterResnetBlocks`. It is used in the
`LightAdapter` model.

Args:
    in_channels (`int`):
        Number of channels of LightAdapterBlock's input.
    out_channels (`int`):
        Number of channels of LightAdapterBlock's output.
    num_res_blocks (`int`):
        Number of LightAdapterResnetBlocks in the LightAdapterBlock.
    down (`bool`, *optional*, defaults to `False`):
        If `True`, perform downsampling on LightAdapterBlock's input.
c                2   < V ^8  d   QhRS[ RS[ RS[ RS[/# r   r   )r   r   s   "r   r   LightAdapterBlock.__annotate__!  s0     
M 
MC 
Ms 
MC 
MW[ 
Mr   c                  < \         SV `  4        V^,          pRV n        V'       d   \        P                  ! ^^RR7      V n        \        P
                  ! W^R7      V n        \        P                  ! \        V4       Uu. uF  p\        V4      NK  	  up!  V n
        \        P
                  ! WR^R7      V n        R# u upi )   NTr   r   )r   r   r   r   r   r   r   r   r   LightAdapterResnetBlockr   out_conv)r    re   r   rg   r   mid_channelsrC   r$   s   &&&&&  r   r   LightAdapterBlock.__init__!  s    #q( llqdSDOyyJ}}V[\jVk&lVkQR'>|'LVk&lm		,!L 'ms    B=c                N   < V ^8  d   QhRS[ P                  RS[ P                  /# rs   r   )r   r   s   "r   r   r   -  s#       %,, r   c                    V P                   e   V P                  V4      pV P                  V4      pV P                  V4      pV P                  V4      pV# )z
This method takes tensor x as input and performs downsampling if required. Then it applies in convolution
layer, a sequence of residual blocks, and out convolutional layer.
)r   r   r   r   rw   s   &&r   r6   LightAdapterBlock.forward-  sI    
 ??&"ALLOLLOMM!r   )r   r   r   r   r   r   ra   s   @@r   r   r     s%     
M 
M  r   r   c                   T   a a ] tR tRt oRtV3R lV 3R lltV3R lR ltRtVtV ;t	# )r   i<  z
A `LightAdapterResnetBlock` is a helper model that implements a ResNet-like block with a slightly different
architecture than `AdapterResnetBlock`.

Args:
    channels (`int`):
        Number of channels of LightAdapterResnetBlock's input and output.
c                    < V ^8  d   QhRS[ /# r   r   )r   r   s   "r   r   $LightAdapterResnetBlock.__annotate__F  s     N N Nr   c                   < \         SV `  4        \        P                  ! W^^R7      V n        \        P
                  ! 4       V n        \        P                  ! W^^R7      V n        R# )r   r   Nr   r   s   &&r   r    LightAdapterResnetBlock.__init__F  sC    ii1M779ii1Mr   c                N   < V ^8  d   QhRS[ P                  RS[ P                  /# rs   r   )r   r   s   "r   r   r   L  r   r   c                t    V P                  V P                  V4      4      pV P                  V4      pW!,           # )z
This function takes input tensor x and processes it through one convolutional layer, ReLU activation, and
another convolutional layer and adds it to input tensor.
r   r   s   && r   r6   LightAdapterResnetBlock.forwardL  r   r   r   r   ra   s   @@r   r   r   <  s%     N N	 	 	r   r   )r?   typingr   r*   torch.nnr   configuration_utilsr   r   utilsr   modeling_utilsr   
get_loggerrX   rP   r	   r   Modulern   ro   r   r   rp   r   r    r   r   <module>r      s    
    A  & 
		H	%~: ~BM7[ M7f/")) /d/BII /d-299 -` <,299 ,^(		 (Vbii r   