
     `i	                     "   d Z ddlZddlmZ ddlmZmZmZmZ ddl	Z	ddl	m
Z
 ddlmZ ddlmZ dd	lmZmZmZmZ dd
lmZmZ ddlmZmZmZ ddlmZmZmZmZm Z  ddl!m"Z"m#Z#m$Z$  e j%        e&          Z'e ed           G d de                                  Z(e ed           G d de                                  Z)ee G d de                                  Z*de	j+        de	j+        fdZ,de	j+        de	j+        fdZ-de$de.fdZ/d[d!ee.e0f         d"e1fd#Z2 G d$ d%e
j3                  Z4 G d& d'e
j5                  Z6 G d( d)e
j3                  Z7 G d* d+e
j3                  Z8 G d, d-e
j3                  Z9 G d. d/e
j3                  Z: G d0 d1e
j3                  Z; G d2 d3e
j3                  Z< G d4 d5e
j3                  Z=	 	 d\d7e
j3        d8e	j+        d9e	j+        d:e	j+        d;ee	j+                 d<e>d=e>d>ee	j+                 fd?Z? G d@ dAe
j3                  Z@ G dB dCe
j3                  ZA G dD dEe
j3                  ZB G dF dGe
j3                  ZC G dH dIe
j3                  ZD G dJ dKe          ZE G dL dMe
j3                  ZF G dN dOe
j3                  ZGe G dP dQe                      ZH edR           G dS dTeH                      ZI edU           G dV dWeH                      ZJe G dX dYeH                      ZKg dZZLdS )]zPyTorch ALIGN model.    N)	dataclass)AnyCallableOptionalUnion)nn   )ACT2FN)GradientCheckpointingLayer)BaseModelOutputBaseModelOutputWithNoAttentionBaseModelOutputWithPooling(BaseModelOutputWithPoolingAndNoAttention)ALL_ATTENTION_FUNCTIONSPreTrainedModel)apply_chunking_to_forward find_pruneable_heads_and_indicesprune_linear_layer)ModelOutputauto_docstringcan_return_tuplefilter_out_non_signature_kwargslogging   )AlignConfigAlignTextConfigAlignVisionConfigz}
    Base class for vision model's outputs that also contains image embeddings of the pooling of the last hidden states.
    )custom_introc                       e Zd ZU dZdZeej                 ed<   dZ	eej                 ed<   dZ
eeej                          ed<   dS )AlignVisionModelOutputz
    image_embeds (`torch.FloatTensor` of shape `(batch_size, output_dim)` *optional* returned when model is initialized with `with_projection=True`):
        The image embeddings obtained by applying the projection layer to the pooler_output.
    Nimage_embedslast_hidden_statehidden_states)__name__
__module____qualname____doc__r!   r   torchFloatTensor__annotations__r"   r#   tuple     |/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/transformers/models/align/modeling_align.pyr    r    )   sl          
 15L(5,-44459x 129998<M8E%"345<<<<<r-   r    ze
    Base class for text model's outputs that also contains a pooling of the last hidden states.
    c                       e Zd ZU dZdZeej                 ed<   dZ	eej                 ed<   dZ
eeej                          ed<   dZeeej                          ed<   dS )AlignTextModelOutputz
    text_embeds (`torch.FloatTensor` of shape `(batch_size, output_dim)` *optional* returned when model is initialized with `with_projection=True`):
        The text embeddings obtained by applying the projection layer to the pooler_output.
    Ntext_embedsr"   r#   
attentions)r$   r%   r&   r'   r1   r   r(   r)   r*   r"   r#   r+   r2   r,   r-   r.   r0   r0   :   s          
 04K%+,33359x 129998<M8E%"345<<<59Ju01299999r-   r0   c                       e Zd ZU dZdZeej                 ed<   dZ	eej                 ed<   dZ
eej                 ed<   dZeej                 ed<   dZeej                 ed<   dZeed<   dZeed	<   d
ee         fdZdS )AlignOutputar  
    loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `return_loss` is `True`):
        Contrastive loss for image-text similarity.
    logits_per_image (`torch.FloatTensor` of shape `(image_batch_size, text_batch_size)`):
        The scaled dot product scores between `image_embeds` and `text_embeds`. This represents the image-text
        similarity scores.
    logits_per_text (`torch.FloatTensor` of shape `(text_batch_size, image_batch_size)`):
        The scaled dot product scores between `text_embeds` and `image_embeds`. This represents the text-image
        similarity scores.
    text_embeds (`torch.FloatTensor` of shape `(batch_size, output_dim`):
        The text embeddings obtained by applying the projection layer to the pooled output of [`AlignTextModel`].
    image_embeds (`torch.FloatTensor` of shape `(batch_size, output_dim`):
        The output of [`AlignVisionModel`].
    text_model_output (`BaseModelOutputWithPooling`):
        The output of the [`AlignTextModel`].
    vision_model_output (`BaseModelOutputWithPoolingAndNoAttention`):
        The output of the [`AlignVisionModel`].
    Nlosslogits_per_imagelogits_per_textr1   r!   text_model_outputvision_model_outputreturnc                 ^     t           fd                                 D                       S )Nc              3   t   K   | ]2}|d vr|         n!t          |                                          V  3dS ))r8   r9   N)getattrto_tuple).0kselfs     r.   	<genexpr>z'AlignOutput.to_tuple.<locals>.<genexpr>k   sc       
 
  LLLDGGRYZ^`aRbRbRkRkRmRm
 
 
 
 
 
r-   )r+   keysrA   s   `r.   r>   zAlignOutput.to_tuplej   sC     
 
 
 
YY[[
 
 
 
 
 	
r-   )r$   r%   r&   r'   r5   r   r(   r)   r*   r6   r7   r1   r!   r8   r   r9   r   r+   r   r>   r,   r-   r.   r4   r4   L   s          & )-D(5$
%,,,48hu0188837OXe/0777/3K%+,33304L(5,-444481888DHAHHH
%* 
 
 
 
 
 
r-   r4   logitsr:   c                     t           j                            | t          j        t          |           | j                  d          S )Ndeviceg?)label_smoothing)r   
functionalcross_entropyr(   arangelenrH   )rE   s    r.   contrastive_lossrN   s   s9    =&&vu|CKKPVP]/^/^/^ps&tttr-   
similarityc                 r    t          |           }t          |                                           }||z   dz  S )Ng       @)rN   t)rO   caption_loss
image_losss      r.   
align_lossrT   w   s4    #J//L!*,,..11J:%,,r-   confignum_channelsc                     | j         }|| j        z  }t          |t          ||dz  z             |z  |z            }|d|z  k     r||z  }t          |          S )z<
    Round number of filters based on depth multiplier.
       g?)depth_divisorwidth_coefficientmaxint)rU   rV   divisornew_dims       r.   round_filtersr_   ~   sk     "GF,,L'3|gk9::gEOPPG |###7w<<r-   Tkernel_sizeadjustc                     t          | t                    r| | f} | d         dz  | d         dz  f}|r$|d         dz
  |d         |d         dz
  |d         fS |d         |d         |d         |d         fS )aJ  
    Utility function to get the tuple padding value for the depthwise convolution.

    Args:
        kernel_size (`int` or `tuple`):
            Kernel size of the convolution layers.
        adjust (`bool`, *optional*, defaults to `True`):
            Adjusts padding value to apply to right and bottom sides of the input.
    r   rX   r   )
isinstancer\   )r`   ra   corrects      r.   correct_padre      s     +s## 1"K01~"KNa$78G @
Q
GAJNGAJGG
GAJ
GAJ??r-   c                   L     e Zd ZdZdef fdZdej        dej        fdZ xZ	S )AlignVisionEmbeddingszL
    A module that corresponds to the stem module of the original work.
    rU   c                 |   t                                                       t          |d          | _        t	          j        d          | _        t	          j        |j        | j        dddd          | _	        t	          j
        | j        |j        |j        	          | _        t          |j                 | _        d S )
N    )r   r   r   r   paddingr	   rX   validFr`   striderk   bias)epsmomentum)super__init__r_   out_dimr   	ZeroPad2drk   Conv2drV   convolutionBatchNorm2dbatch_norm_epsbatch_norm_momentum	batchnormr
   
hidden_act
activationrA   rU   	__class__s     r.   rs   zAlignVisionEmbeddings.__init__   s    $VR00|L99991QPW^c
 
 
 &:OZ`Ztuuu !23r-   pixel_valuesr:   c                     |                      |          }|                     |          }|                     |          }|                     |          }|S N)rk   rw   r{   r}   )rA   r   featuress      r.   forwardzAlignVisionEmbeddings.forward   sM    <<--##H-->>(++??8,,r-   )
r$   r%   r&   r'   r   rs   r(   Tensorr   __classcell__r   s   @r.   rg   rg      su         	40 	4 	4 	4 	4 	4 	4EL U\        r-   rg   c                   .     e Zd Z	 	 	 	 	 	 	 d fd	Z xZS )AlignVisionDepthwiseConv2dr   r	   r   Tzerosc	                 f    ||z  }	t                                          ||	|||||||	  	         d S )N)	in_channelsout_channelsr`   rn   rk   dilationgroupsro   padding_mode)rr   rs   )rA   r   depth_multiplierr`   rn   rk   r   ro   r   r   r   s             r.   rs   z#AlignVisionDepthwiseConv2d.__init__   sV     #%55#%#% 	 
	
 
	
 
	
 
	
 
	
r-   )r   r	   r   r   r   Tr   )r$   r%   r&   rs   r   r   s   @r.   r   r      sT         
 
 
 
 
 
 
 
 
 
r-   r   c                   X     e Zd ZdZdedededef fdZdej        dej	        fd	Z
 xZS )
AlignVisionExpansionLayerz_
    This corresponds to the expansion phase of each block in the original implementation.
    rU   in_dimrt   rn   c                     t                                                       t          j        ||ddd          | _        t          j        ||j                  | _        t          |j	                 | _
        d S )Nr   sameFr   r   r`   rk   ro   )num_featuresrp   )rr   rs   r   rv   expand_convrx   ry   	expand_bnr
   r|   
expand_act)rA   rU   r   rt   rn   r   s        r.   rs   z"AlignVisionExpansionLayer.__init__   so    9 
 
 
 W&BWXXX !23r-   r#   r:   c                     |                      |          }|                     |          }|                     |          }|S r   )r   r   r   rA   r#   s     r.   r   z!AlignVisionExpansionLayer.forward   s=    ((77}5566r-   )r$   r%   r&   r'   r   r\   rs   r(   r)   r   r   r   r   s   @r.   r   r      s         
40 
4# 
4 
4UX 
4 
4 
4 
4 
4 
4U%6 5<        r-   r   c            
       \     e Zd ZdZdededededef
 fdZdej	        d	ej
        fd
Z xZS )AlignVisionDepthwiseLayerzk
    This corresponds to the depthwise convolution phase of each block in the original implementation.
    rU   r   rn   r`   adjust_paddingc                 v   t                                                       || _        | j        dk    rdnd}t          ||          }t	          j        |          | _        t          ||||d          | _        t	          j	        ||j
        |j                  | _        t          |j                 | _        d S )	NrX   rl   r   )ra   rj   Frm   r   rp   rq   )rr   rs   rn   re   r   ru   depthwise_conv_padr   depthwise_convrx   ry   rz   depthwise_normr
   r|   depthwise_act)	rA   rU   r   rn   r`   r   conv_padrk   r   s	           r.   rs   z"AlignVisionDepthwiseLayer.__init__   s     	"kQ..77Fk.AAA"$,w"?"?"?8FHSX
 
 
 !nV%:VE_
 
 
 $F$56r-   r#   r:   c                     | j         dk    r|                     |          }|                     |          }|                     |          }|                     |          }|S )NrX   )rn   r   r   r   r   r   s     r.   r   z!AlignVisionDepthwiseLayer.forward  sa    ;! 33MBBM++M::++M::**=99r-   r$   r%   r&   r'   r   r\   boolrs   r(   r)   r   r   r   r   s   @r.   r   r      s         7!7 7 	7
 7 7 7 7 7 7 7,	U%6 	5< 	 	 	 	 	 	 	 	r-   r   c            	       Z     e Zd ZdZddedededef fdZdej	        d	ej
        fd
Z xZS )AlignVisionSqueezeExciteLayerzl
    This corresponds to the Squeeze and Excitement phase of each block in the original implementation.
    FrU   r   
expand_dimexpandc                    t                                                       |r|n|| _        t          dt	          ||j        z                      | _        t          j        d          | _	        t          j
        | j        | j        dd          | _        t          j
        | j        | j        dd          | _        t          |j                 | _        t          j                    | _        d S )Nr   )output_sizer   )r   r   r`   rk   )rr   rs   dimr[   r\   squeeze_expansion_ratiodim_ser   AdaptiveAvgPool2dsqueezerv   reducer   r
   r|   
act_reduceSigmoid
act_expand)rA   rU   r   r   r   r   s        r.   rs   z&AlignVisionSqueezeExciteLayer.__init__   s    !'3::V!S&*H!HIIJJ+:::i	
 
 
 i	
 
 
 !!23*,,r-   r#   r:   c                    |}|                      |          }|                     |          }|                     |          }|                     |          }|                     |          }t          j        ||          }|S r   )r   r   r   r   r   r(   mul)rA   r#   inputss      r.   r   z%AlignVisionSqueezeExciteLayer.forward5  ss    ]33M2266M2266	&-88r-   )Fr   r   s   @r.   r   r     s         ' '0 '# '3 'X\ ' ' ' ' ' '*
U%6 
5< 
 
 
 
 
 
 
 
r-   r   c                   n     e Zd ZdZdedededededef fdZd	e	j
        d
e	j
        de	j        fdZ xZS )AlignVisionFinalBlockLayerz[
    This corresponds to the final phase of each block in the original implementation.
    rU   r   rt   rn   	drop_rateid_skipc                     t                                                       |dk    o| | _        t          j        ||ddd          | _        t          j        ||j        |j                  | _	        t          j
        |          | _        d S )Nr   r   Fr   r   )p)rr   rs   apply_dropoutr   rv   project_convrx   ry   rz   
project_bnDropoutdropout)rA   rU   r   rt   rn   r   r   r   s          r.   rs   z#AlignVisionFinalBlockLayer.__init__G  s     	#q[8[I 
 
 
 . f&;fF`
 
 
 zI...r-   
embeddingsr#   r:   c                     |                      |          }|                     |          }| j        r|                     |          }||z   }|S r   )r   r   r   r   )rA   r   r#   s      r.   r   z"AlignVisionFinalBlockLayer.forwardX  sR    ))-8866 	7 LL77M)J6Mr-   r$   r%   r&   r'   r   r\   floatr   rs   r(   r)   r   r   r   r   s   @r.   r   r   B  s         /'/14/?B/LO/\a/lp/ / / / / /"%"3 EDU Z_Zf        r-   r   c                   l     e Zd ZdZdededededededed	ed
ef fdZde	j
        de	j        fdZ xZS )AlignVisionBlocka  
    This corresponds to the block module of original the EfficientNet vision encoder implementation.

    Args:
        config ([`AlignVisionConfig`]):
            Model configuration class.
        in_dim (`int`):
            Number of input channels.
        out_dim (`int`):
            Number of output channels.
        stride (`int`):
            Stride size to be used in convolution layers.
        expand_ratio (`int`):
            Expand ratio to set the output dimensions for the expansion and squeeze-excite layers.
        kernel_size (`int`):
            Kernel size for the depthwise convolution layer.
        drop_rate (`float`):
            Dropout rate to be used in the final phase of each block.
        id_skip (`bool`):
            Whether to apply dropout and sum the final hidden states with the input embeddings during the final phase
            of each block. Set to `True` for the first block of each stage.
        adjust_padding (`bool`):
            Whether to apply padding to only right and bottom side of the input kernel before the depthwise convolution
            operation, set to `True` for inputs with odd input sizes.
    rU   r   rt   rn   expand_ratior`   r   r   r   c
                    t                                                       || _        | j        dk    | _        ||z  }
| j        rt	          |||
|          | _        t          || j        r|
n||||	          | _        t          |||
| j                  | _	        t          || j        r|
n|||||          | _        d S )Nr   )rU   r   rt   rn   )rU   r   rn   r`   r   )rU   r   r   r   )rU   r   rt   rn   r   r   )rr   rs   r   r   r   	expansionr   r   r   squeeze_exciter   
projection)rA   rU   r   rt   rn   r   r`   r   r   r   expand_in_dimr   s              r.   rs   zAlignVisionBlock.__init__~  s     	('1,-; 	6fmF  DN 8$(K;==V#)
 
 
 <&]4;
 
 
 5$(K;==V
 
 
r-   r#   r:   c                     |}| j         dk    r|                     |          }|                     |          }|                     |          }|                     ||          }|S Nr   )r   r   r   r   r   )rA   r#   r   s      r.   r   zAlignVisionBlock.forward  sg    "
!! NN=99M++M:: ++M::
MBBr-   r   r   s   @r.   r   r   c  s         4'
!'
 '
 	'

 '
 '
 '
 '
 '
 '
 '
 '
 '
 '
 '
R
U%6 
5< 
 
 
 
 
 
 
 
r-   r   c            	       h     e Zd ZdZdef fdZ	 	 ddej        dee	         dee	         d	e
fd
Z xZS )AlignVisionEncoderz
    Forward propagates the embeddings through each vision encoder (EfficientNet) block.

    Args:
        config ([`AlignVisionConfig`]):
            Model configuration class.
    rU   c                     t                                                       |j         _         fdt          |j                  }t          fd|j        D                       }d}g }t          |          D ]}t          ||j        |                   }t          ||j	        |                   }|j
        |         }	|j        |         }
|j        |         }t           |j        |                             D ]d}|dk    }|dk    rdn|	}	|dk    r|n|}||j        v}|j        |z  |z  }t          ||||	|
||||	  	        }|                    |           |dz  }et#          j        |           _        d S )Nc                 V    t          t          j        j        | z                      S r   )r\   mathceildepth_coefficient)repeatsrA   s    r.   round_repeatsz2AlignVisionEncoder.__init__.<locals>.round_repeats  s#    ty!7'!ABBCCCr-   c              3   .   K   | ]} |          V  d S r   r,   )r?   nr   s     r.   rB   z.AlignVisionEncoder.__init__.<locals>.<genexpr>  s-      LLaq))LLLLLLr-   r   r   )	rU   r   rt   rn   r`   r   r   r   r   )rr   rs   r   rM   r   sumnum_block_repeatsranger_   r   strideskernel_sizesexpand_ratiosdepthwise_paddingdrop_connect_rater   appendr   
ModuleListblocks)rA   rU   num_base_blocks
num_blockscurr_block_numr   ir   rt   rn   r`   r   jr   r   r   blockr   r   s   `                @r.   rs   zAlignVisionEncoder.__init__  s   !'!9	D 	D 	D 	D 	D f011LLLL63KLLLLL
'' 	$ 	$A"66+=a+@AAF#FF,?,BCCG^A&F -a0K!/2L==)A!)DEEFF $ $q&!ee$%EEv!/v7O!O"4~E
R	(!!#! +!-'##1
 
 
 e$$$!#'$* mF++r-   FTr#   output_hidden_statesreturn_dictr:   c                     |r|fnd }| j         D ]} ||          }|r||fz  }|st          d ||fD                       S t          ||          S )Nc              3      K   | ]}||V  	d S r   r,   )r?   vs     r.   rB   z-AlignVisionEncoder.forward.<locals>.<genexpr>  s"      XXq!-----XXr-   )r"   r#   )r   r+   r   )rA   r#   r   r   all_hidden_statesr   s         r.   r   zAlignVisionEncoder.forward  s     1EN],,$[ 	6 	6E!E-00M# 6!m%55! 	YXX]4E$FXXXXXX-++
 
 
 	
r-   )FT)r$   r%   r&   r'   r   rs   r(   r)   r   r   r   r   r   r   s   @r.   r   r     s         ),0 ), ), ), ), ), ),\ 05&*	
 
(
 'tn
 d^	

 
2
 
 
 
 
 
 
 
r-   r   c                        e Zd ZdZ fdZ	 	 	 	 d
deej                 deej                 deej                 deej                 dej	        f
d	Z
 xZS )AlignTextEmbeddingszGConstruct the embeddings from word, position and token_type embeddings.c                    t                                                       t          j        |j        |j        |j                  | _        t          j        |j        |j                  | _	        t          j        |j
        |j                  | _        t          j        |j        |j                  | _        t          j        |j                  | _        t#          |dd          | _        |                     dt)          j        |j                                      d          d           |                     d	t)          j        | j                                        t(          j        
          d           d S )N)padding_idxrp   position_embedding_typeabsoluteposition_ids)r   F)
persistenttoken_type_ids)dtype)rr   rs   r   	Embedding
vocab_sizehidden_sizepad_token_idword_embeddingsmax_position_embeddingsposition_embeddingstype_vocab_sizetoken_type_embeddings	LayerNormlayer_norm_epsr   hidden_dropout_probr   r=   r   register_bufferr(   rL   r   r   r   sizelongr~   s     r.   rs   zAlignTextEmbeddings.__init__  sK   !|F,=v?Q_e_rsss#%<0NPVPb#c#c %'\&2H&J\%]%]" f&8f>STTTz&"<=='.v7PR\']']$EL)GHHOOPWXXej 	 	
 	
 	
 	ek$*;*@*@*B*B%*UUUbg 	 	
 	
 	
 	
 	
r-   N	input_idsr  r   inputs_embedsr:   c                    ||                                 }n|                                 d d         }|d         }|| j        d d d |f         }|mt          | d          r2| j        d d d |f         }|                    |d         |          }|}n+t          j        |t
          j        | j        j                  }|| 	                    |          }| 
                    |          }	||	z   }
| j        dk    r|                     |          }|
|z  }
|                     |
          }
|                     |
          }
|
S )Nr   r   r  r   r  rH   r   )r  r   hasattrr  r   r(   r   r  rH   r  r  r   r
  r  r   )rA   r  r  r   r  input_shape
seq_lengthbuffered_token_type_ids buffered_token_type_ids_expandedr  r   r
  s               r.   r   zAlignTextEmbeddings.forward  sd     #..**KK',,..ss3K ^
,QQQ^<L
 !t-.. m*.*=aaa*n*M'3J3Q3QR]^_R`bl3m3m0!A!&[
SWSdSk!l!l!l  00;;M $ : :> J J"%::
':55"&":":<"H"H--J^^J//
\\*--
r-   )NNNN)r$   r%   r&   r'   rs   r   r(   
LongTensorr)   r   r   r   r   s   @r.   r   r     s        QQ
 
 
 
 
* 15593759& &E,-& !!12& u/0	&
   12& 
& & & & & & & &r-   r           modulequerykeyvalueattention_maskscalingr   	head_maskc                 8   t          j        ||                    dd                    |z  }	|$|d d d d d d d |j        d         f         }
|	|
z   }	t          j                            |	dt           j                                      |j	                  }	t          j        
                    |	|| j                  }	||	|                    dddd          z  }	t          j        |	|          }|                    dd                                          }||	fS )NrX   r	   r   )r   r  )r   trainingr   )r(   matmul	transposeshaper   rJ   softmaxfloat32tor  r   r'  view
contiguous)r  r  r   r!  r"  r#  r   r$  kwargsattn_weightscausal_maskattn_outputs               r.   eager_attention_forwardr4  =  s    <s}}Q':':;;gEL!$QQQ111o	"o%=>#k1=((2U](SSVVW\WbccL=((6?([[L#innQAq&A&AA,|U33K''1--88::K$$r-   c                        e Zd Z fdZ	 	 	 d
dej        deej                 deej                 dee         de	ej                 f
d	Z
 xZS )AlignTextSelfAttentionc                    t                                                       |j        |j        z  dk    r0t	          |d          s t          d|j         d|j         d          || _        |j        | _        t          |j        |j        z            | _        | j        | j        z  | _	        t          j        |j        | j	                  | _        t          j        |j        | j	                  | _        t          j        |j        | j	                  | _        t          j        |j                  | _        |j        | _        | j        dz  | _        d S )Nr   embedding_sizezThe hidden size (z6) is not a multiple of the number of attention heads ()g      )rr   rs   r  num_attention_headsr  
ValueErrorrU   r\   attention_head_sizeall_head_sizer   Linearr  r   r!  r   attention_probs_dropout_probr   attention_dropoutr#  r~   s     r.   rs   zAlignTextSelfAttention.__init__Y  s:    ::a??PVXhHiHi?8F$6 8 8 48 8 8  
 #)#= #&v'9F<V'V#W#W !58PPYv143EFF
9V/1CDDYv143EFF
z&"EFF!'!D/5r-   NFr#   r"  r$  output_attentionsr:   c                    |j         d d         }g |d| j        R }|                     |                              |                              dd          }|                     |                              |                              dd          }	|                     |                              |                              dd          }
t          }| j        j	        dk    rt          | j        j	                 } || ||	|
|f| j        sdn| j        | j        |d|\  }} |j        g |dR                                  }|r||fn|f}|S )Nr   r   rX   eagerr  )r   r#  r$  )r*  r<  r  r.  r)  r   r!  r4  rU   _attn_implementationr   r'  r@  r#  reshaper/  )rA   r#   r"  r$  rA  r0  r  hidden_shapequery_states
key_statesvalue_statesattention_interfacer3  r1  outputss                  r.   r   zAlignTextSelfAttention.forwardn  s    $)#2#.CCbC$*BCCzz-0055lCCMMaQRSSXXm,,11,??II!QOO
zz-0055lCCMMaQRSS(?;+w66"9$+:Z"[$7$7
%
  $}HCC$2HL
%
 
%
 
%
 
%
!\ *k);;;;;;FFHH1BV;--r-   NNF)r$   r%   r&   rs   r(   r   r   r)   r   r+   r   r   r   s   @r.   r6  r6  X  s        6 6 6 6 60 7;15,1! !|! !!23! E-.	!
 $D>! 
u|	! ! ! ! ! ! ! !r-   r6  c                   P     e Zd Z fdZdej        dej        dej        fdZ xZS )AlignTextSelfOutputc                    t                                                       t          j        |j        |j                  | _        t          j        |j        |j                  | _        t          j        |j	                  | _
        d S Nr   )rr   rs   r   r>  r  denser  r  r   r  r   r~   s     r.   rs   zAlignTextSelfOutput.__init__  sf    Yv163EFF
f&8f>STTTz&"<==r-   r#   input_tensorr:   c                     |                      |          }|                     |          }|                     ||z             }|S r   rQ  r   r  rA   r#   rR  s      r.   r   zAlignTextSelfOutput.forward  @    

=11]33}|'CDDr-   r$   r%   r&   rs   r(   r   r   r   r   s   @r.   rN  rN    i        > > > > >U\  RWR^        r-   rN  c                        e Zd Z fdZd Z	 	 	 ddej        deej                 deej                 dee	         d	e
ej                 f
d
Z xZS )AlignTextAttentionc                     t                                                       t          |          | _        t	          |          | _        t                      | _        d S r   )rr   rs   r6  rA   rN  outputsetpruned_headsr~   s     r.   rs   zAlignTextAttention.__init__  sI    *622	)&11EEr-   c                    t          |          dk    rd S t          || j        j        | j        j        | j                  \  }}t          | j        j        |          | j        _        t          | j        j        |          | j        _        t          | j        j	        |          | j        _	        t          | j
        j        |d          | j
        _        | j        j        t          |          z
  | j        _        | j        j        | j        j        z  | j        _        | j                            |          | _        d S )Nr   r   )r   )rM   r   rA   r:  r<  r^  r   r  r   r!  r\  rQ  r=  union)rA   headsindexs      r.   prune_headszAlignTextAttention.prune_heads  s    u::??F7490$)2OQUQb
 
u
 -TY_eDD	*49=%@@	,TY_eDD	.t{/@%QOOO )-	(EE

(R	%"&)"?$)B_"_	 -33E::r-   NFr#   r"  r$  rA  r:   c                 ~     | j         |f|||d|}|                     |d         |          }|f|dd          z   }|S N)r"  r$  rA  r   r   )rA   r\  )	rA   r#   r"  r$  rA  r0  self_outputsattention_outputrK  s	            r.   r   zAlignTextAttention.forward  sl     !ty
)/	
 

 
 
  ;;|AFF#%QRR(88r-   rL  )r$   r%   r&   rs   rc  r(   r   r   r)   r   r+   r   r   r   s   @r.   rZ  rZ    s        " " " " "; ; ;* 7;15,1 | !!23 E-.	
 $D> 
u|	       r-   rZ  c                   B     e Zd Z fdZdej        dej        fdZ xZS )AlignTextIntermediatec                    t                                                       t          j        |j        |j                  | _        t          |j        t                    rt          |j                 | _        d S |j        | _        d S r   )rr   rs   r   r>  r  intermediate_sizerQ  rc   r|   strr
   intermediate_act_fnr~   s     r.   rs   zAlignTextIntermediate.__init__  sn    Yv163KLL
f'-- 	9'-f.?'@D$$$'-'8D$$$r-   r#   r:   c                 Z    |                      |          }|                     |          }|S r   )rQ  rm  r   s     r.   r   zAlignTextIntermediate.forward  s,    

=1100??r-   rW  r   s   @r.   ri  ri    s^        9 9 9 9 9U\ el        r-   ri  c                   P     e Zd Z fdZdej        dej        dej        fdZ xZS )AlignTextOutputc                    t                                                       t          j        |j        |j                  | _        t          j        |j        |j                  | _        t          j	        |j
                  | _        d S rP  )rr   rs   r   r>  rk  r  rQ  r  r  r   r  r   r~   s     r.   rs   zAlignTextOutput.__init__  sf    Yv79KLL
f&8f>STTTz&"<==r-   r#   rR  r:   c                     |                      |          }|                     |          }|                     ||z             }|S r   rT  rU  s      r.   r   zAlignTextOutput.forward  rV  r-   rW  r   s   @r.   rp  rp    rX  r-   rp  c                        e Zd Z fdZ	 	 	 ddej        deej                 deej                 dee         de	ej                 f
d	Z
d
 Z xZS )AlignTextLayerc                     t                                                       |j        | _        d| _        t	          |          | _        t          |          | _        t          |          | _	        d S r   )
rr   rs   chunk_size_feed_forwardseq_len_dimrZ  	attentionri  intermediaterp  r\  r~   s     r.   rs   zAlignTextLayer.__init__  s^    '-'E$+F331&99%f--r-   NFr#   r"  r$  rA  r:   c                      | j         |f|||d|}|d         }|dd          }t          | j        | j        | j        |          }	|	f|z   }|S re  )rx  r   feed_forward_chunkrv  rw  )
rA   r#   r"  r$  rA  r0  self_attention_outputsrg  rK  layer_outputs
             r.   r   zAlignTextLayer.forward  s     "0"
)/	"
 "

 "
 "
 2!4(,0#T%A4CSUe
 
  /G+r-   c                 \    |                      |          }|                     ||          }|S r   )ry  r\  )rA   rg  intermediate_outputr}  s       r.   r{  z!AlignTextLayer.feed_forward_chunk  s2    "//0@AA{{#68HIIr-   rL  )r$   r%   r&   rs   r(   r   r   r)   r   r+   r   r{  r   r   s   @r.   rt  rt    s        . . . . . 7;15,1 | !!23 E-.	
 $D> 
u|	   2      r-   rt  c                        e Zd Z fdZe	 	 	 	 	 ddej        deej                 deej                 dee	         d	ee	         d
ee	         de
eej                 ef         fd            Z xZS )AlignTextEncoderc                     t                                                       | _        t          j        fdt          j                  D                       | _        d| _        d S )Nc                 .    g | ]}t                    S r,   )rt  )r?   r   rU   s     r.   
<listcomp>z-AlignTextEncoder.__init__.<locals>.<listcomp>  s!    #d#d#dqN6$:$:#d#d#dr-   F)	rr   rs   rU   r   r   r   num_hidden_layerslayergradient_checkpointingr~   s    `r.   rs   zAlignTextEncoder.__init__  s`    ]#d#d#d#dE&JbDcDc#d#d#dee
&+###r-   NFTr#   r"  r$  rA  r   r   r:   c           	          |rdnd }|rdnd }	t          | j                  D ]<\  }
}|r||fz   }|||
         nd } |d||||d|}|d         }|r|	|d         fz   }	=|r||fz   }t          |||	          S )Nr,   )r#   r"  r$  rA  r   r   )r"   r#   r2   )	enumerater  r   )rA   r#   r"  r$  rA  r   r   r0  r   all_self_attentionsr   layer_modulelayer_head_masklayer_outputss                 r.   r   zAlignTextEncoder.forward  s     #7@BBD$5?bb4(44 	P 	POA|# I$58H$H!.7.CillO(L +-)"3	 
  M *!,M  P&9]1=M<O&O# 	E 1]4D D++*
 
 
 	
r-   )NNFFT)r$   r%   r&   rs   r   r(   r   r   r)   r   r   r+   r   r   r   r   s   @r.   r  r    s        , , , , ,  7;15,1/4&*&
 &
|&
 !!23&
 E-.	&

 $D>&
 'tn&
 d^&
 
uU\"O3	4&
 &
 &
 &
 &
 &
 &
 &
r-   r  c                   B     e Zd Z fdZdej        dej        fdZ xZS )AlignTextPoolerc                     t                                                       t          j        |j        |j                  | _        t          j                    | _        d S r   )rr   rs   r   r>  r  rQ  Tanhr}   r~   s     r.   rs   zAlignTextPooler.__init__H  sC    Yv163EFF
'))r-   r#   r:   c                 r    |d d df         }|                      |          }|                     |          }|S )Nr   )rQ  r}   )rA   r#   first_token_tensorpooled_outputs       r.   r   zAlignTextPooler.forwardM  s@     +111a40

#56666r-   rW  r   s   @r.   r  r  G  s^        $ $ $ $ $
U\ el        r-   r  c                   8    e Zd ZU eed<   dZdZdej        fdZ	dS )AlignPreTrainedModelrU   alignTr  c                    | j         j        }t          |t          j        t          j        f          rG|j        j                            d|           |j	        |j	        j        
                                 nt          |t                    rvt          j                            |j        j                   |j        j	        j        
                                 |j        j                            | j         j                   nkt          |t          j                  rQ|j        j                            d|           |j        )|j        j        |j                 
                                 t          |t          j        t          j        f          r?|j	        j        
                                 |j        j                            d           dS dS )zInitialize the weightsr  )meanstdNg      ?)rU   initializer_rangerc   r   r>  rv   weightdatanormal_ro   zero_
AlignModelinitxavier_uniform_text_projectiontemperaturefill_temperature_init_valuer  r   r  rx   )rA   r  r  s      r.   _init_weightsz"AlignPreTrainedModel._init_weights\  s   k+fry")455 	?M&&CS&999{& &&(((
++ 	?G##F$:$ABBB"',22444#))$+*LMMMM-- 	?M&&CS&999!-"6#56<<>>>fr|R^<== 	*K""$$$M$$S)))))	* 	*r-   N)
r$   r%   r&   r   r*   base_model_prefixsupports_gradient_checkpointingr   Moduler  r,   r-   r.   r  r  V  sK         &*#*BI * * * * * *r-   r  zJ
    The text model from ALIGN without any head or projection on top.
    c                   d    e Zd ZU eed<   dgZddedef fdZd Zd Z	e
e	 	 	 	 	 	 	 	 	 dd	eej                 d
eej                 deej                 deej                 deej                 deej                 dee         dee         dee         deeef         fd                        Z xZS )AlignTextModelrU   r   Tadd_pooling_layerc                     t                                          |           || _        t          |          | _        t          |          | _        |rt          |          nd| _        | 	                                 dS )zv
        add_pooling_layer (bool, *optional*, defaults to `True`):
            Whether to add a pooling layer
        N)
rr   rs   rU   r   r   r  encoderr  pooler	post_init)rA   rU   r  r   s      r.   rs   zAlignTextModel.__init__y  ss    
 	   -f55'//1BLof--- 	r-   c                     | j         j        S r   r   r  rD   s    r.   get_input_embeddingsz#AlignTextModel.get_input_embeddings  s    ..r-   c                     || j         _        d S r   r  )rA   r!  s     r.   set_input_embeddingsz#AlignTextModel.set_input_embeddings  s    */'''r-   Nr  r"  r  r   r$  r  rA  r   r   r:   c
           	         ||n| j         j        }||n| j         j        }|	|	n| j         j        }	||t	          d          |+|                     ||           |                                }n.||                                dd         }nt	          d          |\  }}||j        n|j        }|t          j	        ||f|          }|gt          | j        d          r1| j        j        ddd|f         }|                    ||          }|}n!t          j        |t          j        |          }|                     ||          }|                     || j         j                  }|                     ||||          } | j        |f||||d	d
|
}|d         }| j        |                     |          nd}t+          |||j        |j                  S )a-  
        Examples:

        ```python
        >>> from transformers import AutoTokenizer, AlignTextModel

        >>> model = AlignTextModel.from_pretrained("kakaobrain/align-base")
        >>> tokenizer = AutoTokenizer.from_pretrained("kakaobrain/align-base")

        >>> inputs = tokenizer(["a photo of a cat", "a photo of a dog"], padding=True, return_tensors="pt")

        >>> outputs = model(**inputs)
        >>> last_hidden_state = outputs.last_hidden_state
        >>> pooled_output = outputs.pooler_output  # pooled (EOS token) states
        ```NzDYou cannot specify both input_ids and inputs_embeds at the same timer   z5You have to specify either input_ids or inputs_embedsrG   r  r  )r  r   r  r  T)r"  r$  rA  r   r   r   )r"   pooler_outputr#   r2   )rU   rA  r   use_return_dictr;  %warn_if_padding_and_no_attention_maskr  rH   r(   onesr  r   r  r   r   r  get_extended_attention_maskget_head_maskr  r  r  r   r#   r2   )rA   r  r"  r  r   r$  r  rA  r   r   r0  r  
batch_sizer  rH   r  r  extended_attention_maskembedding_outputencoder_outputssequence_outputr  s                         r.   r   zAlignTextModel.forward  sY   < 2C1N--TXT_Tq$8$D  $+Jj 	 &1%<kk$+B] ]%>cddd"66y.QQQ#..**KK&',,..ss3KKTUUU!,
J%.%:!!@T!"Z*j)A6RRRN!t(899 [*./*HKZK*X'3J3Q3QR\^h3i3i0!A!&[
SY!Z!Z!Z 150P0PQ_al0m0m &&y$+2OPP	??%)'	 + 
 
 '$,
2/!5
 
 
 
 *!,8<8OO444UY)-')7&1	
 
 
 	
r-   T)	NNNNNNNNN)r$   r%   r&   r   r*   _no_split_modulesr   rs   r  r  r   r   r   r(   r   r)   r   r+   r   r   r   r   s   @r.   r  r  p  s         ./  4       / / /0 0 0  -11515/31504,0/3&*\
 \
EL)\
 !.\
 !.	\

 u|,\
 E-.\
  -\
 $D>\
 'tn\
 d^\
 
u00	1\
 \
 \
 ^ \
 \
 \
 \
 \
r-   r  zL
    The vision model from ALIGN without any head or projection on top.
    c                        e Zd ZU eed<   dZdZdef fdZdej	        fdZ
ee	 	 	 ddeej                 dee         d	ee         deeef         fd
                        Z xZS )AlignVisionModelrU   r   Fc                    t                                          |           || _        t          |          | _        t          |          | _        |j        dk    r!t          j	        |j
        d          | _        nC|j        dk    r!t          j        |j
        d          | _        nt          d|j                   |                                  d S )Nr  T)	ceil_moder[   z2config.pooling must be one of ['mean', 'max'] got )rr   rs   rU   rg   r   r   r  pooling_typer   	AvgPool2d
hidden_dimr  	MaxPool2dr;  poolingr  r~   s     r.   rs   zAlignVisionModel.__init__  s       /77)&11 &((,v'8DIIIDKK E)),v'8DIIIDKKbRXR`bbccc 	r-   r:   c                 $    | j         j        j        S r   )vision_modelr   rw   rD   s    r.   r  z%AlignVisionModel.get_input_embeddings  s     +77r-   Nr   r   c                 j   ||n| j         j        }||n| j         j        }|t          d          |                     |          }|                     ||d          }|d         }|                     |          }|                    |j        dd                   }t          |||j
                  S )a  
        Examples:

        ```python
        >>> from PIL import Image
        >>> import requests
        >>> from transformers import AutoProcessor, AlignVisionModel

        >>> model = AlignVisionModel.from_pretrained("kakaobrain/align-base")
        >>> processor = AutoProcessor.from_pretrained("kakaobrain/align-base")

        >>> url = "http://images.cocodataset.org/val2017/000000039769.jpg"
        >>> image = Image.open(requests.get(url, stream=True).raw)

        >>> inputs = processor(images=image, return_tensors="pt")

        >>> outputs = model(**inputs)
        >>> last_hidden_state = outputs.last_hidden_state
        >>> pooled_output = outputs.pooler_output  # pooled CLS states
        ```Nz You have to specify pixel_valuesT)r   r   r   rX   )r"   r  r#   )rU   r   r  r;  r   r  r  rE  r*  r   r#   )rA   r   r   r   r  r  r"   r  s           r.   r   zAlignVisionModel.forward  s    : %9$D  $+Jj 	 &1%<kk$+B]?@@@??<88,,!5 ' 
 
 ,A.$566%--m.A"1".EFF7/')7
 
 
 	
r-   )NNN)r$   r%   r&   r   r*   main_input_namer  rs   r   r  r  r   r   r   r(   r)   r   r   r+   r   r   r   r   s   @r.   r  r    s          $O&+#0      "8bi 8 8 8 8  59/3&*	2
 2
u012
 'tn2
 d^	2

 
u>>	?2
 2
 2
 ^ 2
 2
 2
 2
 2
r-   r  c                       e Zd ZU eed<   def fdZ e            e	 	 	 	 	 	 ddee	j
                 dee	j
                 dee	j
                 dee	j
                 dee	j
                 d	ee	j
                 d
e	j        fd                        Z e            ede	j        d
e	j        fd                        Zee	 	 	 	 	 	 	 	 	 	 	 ddee	j                 dee	j                 dee	j
                 dee	j
                 dee	j
                 dee	j
                 d	ee	j
                 dee         dee         dee         dee         d
eeef         fd                        Z xZS )r  rU   c                    t                                          |           t          |j        t                    s%t          dt          |j                   d          t          |j        t                    s%t          dt          |j                   d          |j        }|j        }|j	        | _	        |j
        | _        t          |          | _        t          |          | _        t!          j        | j        | j	                  | _        t!          j        t)          j        | j        j                            | _        |                                  d S )NzLconfig.text_config is expected to be of type AlignTextConfig but is of type .zPconfig.vision_config is expected to be of type AlignVisionConfig but is of type )rr   rs   rc   text_configr   	TypeErrortypevision_configr   projection_dimr  text_embed_dimr  
text_modelr  r  r   r>  r  	Parameterr(   tensorrU   r  r  r  )rA   rU   r  r  r   s       r.   rs   zAlignModel.__init__I  sJ      &,o>> 	0+,,0 0 0  
 &.0ABB 	2-..2 2 2  
 (,$3)5(55,];;!y)<d>QRR<T[5W(X(XYY 	r-   Nr  r"  r  r   r$  r  r:   c                     |                      ||||||          }|d         dddddf         }|                     |          }	|	S )a  
        Returns:
            text_features (`torch.FloatTensor` of shape `(batch_size, output_dim`): The text embeddings obtained by
            applying the projection layer to the pooled output of [`AlignTextModel`].

        Examples:

        ```python
        >>> import torch
        >>> from transformers import AutoTokenizer, AlignModel

        >>> model = AlignModel.from_pretrained("kakaobrain/align-base")
        >>> tokenizer = AutoTokenizer.from_pretrained("kakaobrain/align-base")

        >>> inputs = tokenizer(["a photo of a cat", "a photo of a dog"], padding=True, return_tensors="pt")
        >>> with torch.inference_mode():
        ...     text_features = model.get_text_features(**inputs)
        ```)r  r"  r  r   r$  r  r   N)r  r  )
rA   r  r"  r  r   r$  r  text_outputsr"   text_featuress
             r.   get_text_featureszAlignModel.get_text_featuresg  sg    : ))%' ' 
 
 )OAAAq!!!G4,,->??r-   r   c                 @    |                      |          }|j        }|S )a]  
        Returns:
            image_features (`torch.FloatTensor` of shape `(batch_size, output_dim`): The image embeddings obtained by
            applying the projection layer to the pooled output of [`AlignVisionModel`].

        Examples:

        ```python
        >>> import torch
        >>> from transformers import AutoProcessor, AlignModel
        >>> from transformers.image_utils import load_image

        >>> model = AlignModel.from_pretrained("kakaobrain/align-base")
        >>> processor = AutoProcessor.from_pretrained("kakaobrain/align-base")

        >>> url = "http://images.cocodataset.org/val2017/000000039769.jpg"
        >>> image = load_image(url)

        >>> inputs = processor(images=image, return_tensors="pt")
        >>> with torch.inference_mode():
        ...     image_features = model.get_image_features(**inputs)
        ```)r   )r  r  )rA   r   vision_outputsimage_featuress       r.   get_image_featureszAlignModel.get_image_features  s(    2 ***EE'5r-   return_lossrA  r   r   c                 v   |	|	n| j         j        }	|
|
n| j         j        }
||n| j         j        }|                     ||
d          }|                     |||||||	|
d	  	        }|d         }|d         dddddf         }|                     |          }||                    ddd	          z  }||                    ddd	          z  }t          j	        ||
                                          | j        z  }|
                                }d}|rt          |          }t          |||||||
          S )a  
        return_loss (`bool`, *optional*):
            Whether or not to return the contrastive loss.

        Examples:

        ```python
        >>> import torch
        >>> from transformers import AutoProcessor, AlignModel
        >>> from transformers.image_utils import load_image

        >>> model = AlignModel.from_pretrained("kakaobrain/align-base")
        >>> processor = AutoProcessor.from_pretrained("kakaobrain/align-base")

        >>> url = "http://images.cocodataset.org/val2017/000000039769.jpg"
        >>> image = load_image(url)

        >>> inputs = processor(
        ...     images=image, text=["a photo of a cat", "a photo of a dog"], return_tensors="pt", padding=True
        ... )

        >>> with torch.inference_mode():
        ...     outputs = model(**inputs)
        >>> logits_per_image = outputs.logits_per_image  # this is the image-text similarity score
        >>> probs = logits_per_image.softmax(dim=1)  # we can take the softmax to get the label probabilities
        ```NT)r   r   r   )	r  r"  r  r   r$  r  rA  r   r   r   r   rX   r   )r   r   keepdim)r5   r6   r7   r1   r!   r8   r9   )rU   rA  r   r  r  r  r  normr(   r(  rQ   r  rT   r4   )rA   r  r   r"  r  r   r$  r  r  rA  r   r   r  r  r!   r1   r7   r6   r5   s                      r.   r   zAlignModel.forward  s   V 2C1N--TXT_Tq$8$D  $+Jj 	 &1%<kk$+B]**%!5 + 
 
 ))%'/!5 ' 

 

 &a("1oaaaAAAg.**;77 $l&7&7!T&7&R&RR!K$4$4qb$$4$O$OO  ,{LNN4D4DEEHXX*,,.. 	/o..D-+#%* .
 
 
 	
r-   )NNNNNN)NNNNNNNNNNN)r$   r%   r&   r   r*   rs   r   r   r   r(   r   r)   r  r  r   r  r   r   r+   r4   r   r   r   s   @r.   r  r  E  s        {      < %$&& -11515/3,004& &EL)& !.& !.	&
 u|,& EL)&  -& 
	& & & ^ '&&P %$&&u/@ UEV    ^ '&6  15481515/3,004&*,0/3&*Y
 Y
E,-Y
 u01Y
 !.	Y

 !.Y
 u|,Y
 EL)Y
  -Y
 d^Y
 $D>Y
 'tnY
 d^Y
 
uk!	"Y
 Y
 Y
 ^ Y
 Y
 Y
 Y
 Y
r-   r  )r  r  r  r  r  )r  N)Mr'   r   dataclassesr   typingr   r   r   r   r(   r   activationsr
   modeling_layersr   modeling_outputsr   r   r   r   modeling_utilsr   r   pytorch_utilsr   r   r   utilsr   r   r   r   r   configuration_alignr   r   r   
get_loggerr$   loggerr    r0   r4   r   rN   rT   r\   r_   r+   r   re   r  rg   rv   r   r   r   r   r   r   r   r   r   r4  r6  rN  rZ  ri  rp  rt  r  r  r  r  r  r  __all__r,   r-   r.   <module>r     s      ! ! ! ! ! ! 1 1 1 1 1 1 1 1 1 1 1 1        ! ! ! ! ! ! 9 9 9 9 9 9            G F F F F F F F l l l l l l l l l l l l l l l l l l l l l l l l P P P P P P P P P P 
	H	%	%   
= = = = =[ = =  =   
	: 	: 	: 	: 	:; 	: 	:  	:  
  
  
  
  
+  
  
   
JuU\ uel u u u u-5< -EL - - - -+ 3     @ @U3:. @ @ @ @ @*    BI   4
 
 
 
 
 
 
 
6    	   6$ $ $ $ $	 $ $ $P$ $ $ $ $BI $ $ $N       BN N N N Nry N N NbG
 G
 G
 G
 G
 G
 G
 G
T< < < < <") < < <L (,% %I%<% 
% <	%
 U\*% % % %% % % %67 7 7 7 7RY 7 7 7v    ")   * * * * * * * *\    BI        bi   % % % % %/ % % %P.
 .
 .
 .
 .
ry .
 .
 .
d    bi    * * * * *? * * *2   
x
 x
 x
 x
 x
) x
 x
 
x
v   
M
 M
 M
 M
 M
+ M
 M
 
M
` C
 C
 C
 C
 C
% C
 C
 C
L W
V
Vr-   