
     `ic                        d dl mZ d dlmZ d dlZd dlmZ d dl	m
Z
mZmZ d dl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 dd	lmZmZ d
dlmZ dZ dZ! G d dej"                  Z# G d dej"                  Z$ G d dej"                  Z% G d dej"                  Z& G d dej"                  Z' G d dej"                  Z( G d dej"                  Z) G d dej"                  Z* G d dej"                  Z+ G d  d!ej"                  Z, G d" d#ej"                  Z- G d$ d%e          Z. G d& d'ej"                  Z/ ed(e            G d) d*e.                      Z0d+Z1 ee0e1            ee0ee,            G d- d.ej"                  Z2 ed/e            G d0 d1e.                      Z3d2Z4 ee3e4            ee3ee,           g d3Z5dS )4    )OptionalN)
FrozenDictfreezeunfreeze)dot_product_attention_weights)flatten_dictunflatten_dict   )FlaxBaseModelOutputFlaxBaseModelOutputWithPoolingFlaxSequenceClassifierOutput)ACT2FNFlaxPreTrainedModel append_replace_return_docstringsoverwrite_call_docstring)add_start_docstrings%add_start_docstrings_to_model_forward   )	ViTConfiga  

    This model inherits from [`FlaxPreTrainedModel`]. Check the superclass documentation for the generic methods the
    library implements for all its model (such as downloading, saving and converting weights from PyTorch models)

    This model is also a
    [flax.linen.Module](https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html) subclass. Use it as
    a regular Flax linen Module and refer to the Flax documentation for all matter related to general usage and
    behavior.

    Finally, this model supports inherent JAX features such as:

    - [Just-In-Time (JIT) compilation](https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit)
    - [Automatic Differentiation](https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation)
    - [Vectorization](https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap)
    - [Parallelization](https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap)

    Parameters:
        config ([`ViTConfig`]): Model configuration class with all the parameters of the model.
            Initializing with a config file does not load the weights associated with the model, only the
            configuration. Check out the [`~FlaxPreTrainedModel.from_pretrained`] method to load the model weights.
        dtype (`jax.numpy.dtype`, *optional*, defaults to `jax.numpy.float32`):
            The data type of the computation. Can be one of `jax.numpy.float32`, `jax.numpy.float16` (on GPUs) and
            `jax.numpy.bfloat16` (on TPUs).

            This can be used to enable mixed-precision training or half-precision inference on GPUs or TPUs. If
            specified all the computation will be performed with the given `dtype`.

            **Note that this only specifies the dtype of the computation and does not influence the dtype of model
            parameters.**

            If you wish to change the dtype of the model parameters, see [`~FlaxPreTrainedModel.to_fp16`] and
            [`~FlaxPreTrainedModel.to_bf16`].
a  
    Args:
        pixel_values (`numpy.ndarray` of shape `(batch_size, num_channels, height, width)`):
            Pixel values. Pixel values can be obtained using [`AutoImageProcessor`]. See [`ViTImageProcessor.__call__`]
            for details.

        output_attentions (`bool`, *optional*):
            Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
            tensors for more detail.
        output_hidden_states (`bool`, *optional*):
            Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
            more detail.
        return_dict (`bool`, *optional*):
            Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
c                   H    e Zd ZU eed<   ej        Zej        ed<   d Zd Z	dS )FlaxViTPatchEmbeddingsconfigdtypec                 B   | j         j        }| j         j        }||z  ||z  z  }|| _        | j         j        | _        t          j        | j         j        ||f||fd| j        t          j        j
                            | j         j        dz  dd                    | _        d S )NVALID   fan_intruncated_normal)kernel_sizestridespaddingr   kernel_init)r   
image_size
patch_sizenum_patchesnum_channelsnnConvhidden_sizer   jaxinitializersvariance_scalinginitializer_range
projection)selfr#   r$   r%   s       }/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/transformers/models/vit/modeling_flax_vit.pysetupzFlaxViTPatchEmbeddings.setup\   s    [+
[+
!Z/J*4LM& K4'K##Z0,*+<<-q0(<N 	
 	
 	
    c                     |j         d         }|| j        k    rt          d          |                     |          }|j         \  }}}}t	          j        ||d|f          S )NzeMake sure that the channel dimension of the pixel values match with the one set in the configuration.)shaper&   
ValueErrorr.   jnpreshape)r/   pixel_valuesr&   
embeddings
batch_size_channelss          r0   __call__zFlaxViTPatchEmbeddings.__call__m   so    #)"-4,,,w   __\22
%/%5"
Aq({:
B'ABBBr2   N
__name__
__module____qualname__r   __annotations__r7   float32r   r1   r>    r2   r0   r   r   X   sY         {E39"""
 
 
"C C C C Cr2   r   c                   N    e Zd ZU dZeed<   ej        Zej        ed<   d Z	ddZ
dS )	FlaxViTEmbeddingsz7Construct the CLS token, position and patch embeddings.r   r   c                    |                      dt          j        j                            | j        j        dz  dd          dd| j        j        f          | _        t          | j        | j
                  | _        | j        j        }|                      dt          j        j                            | j        j        dz  dd          d|dz   | j        j        f          | _        t          j        | j        j                  | _        d S )	N	cls_tokenr   r   r   r   r   position_embeddingsrate)paramr*   r'   r+   r,   r   r-   r)   rI   r   r   patch_embeddingsr%   rK   Dropouthidden_dropout_probdropout)r/   r%   s     r0   r1   zFlaxViTEmbeddings.setup~   s    F001NPQ1QS[]opp4;*+
 

 !7t{$* U U U+7#'::!F001NPQ1QS[]oppa!89$
 $
 
 zt{'FGGGr2   Tc                 
   |j         d         }|                     |          }t          j        | j        |d| j        j        f          }t          j        ||fd          }|| j        z   }| 	                    ||          }|S )Nr   r   )axisdeterministic)
r5   rO   r7   broadcast_torI   r   r)   concatenaterK   rR   )r/   r9   rV   r;   r:   
cls_tokenss         r0   r>   zFlaxViTEmbeddings.__call__   s    !'*
**<88
%dnz1dkF]6^__
_j*%=AFFF
$"::
\\*M\JJ
r2   NT)r@   rA   rB   __doc__r   rC   r7   rD   r   r1   r>   rE   r2   r0   rG   rG   x   sb         AA{E39"""H H H	 	 	 	 	 	r2   rG   c                   T    e Zd ZU eed<   ej        Zej        ed<   d Zd
de	de	fdZ
d	S )FlaxViTSelfAttentionr   r   c           	         | j         j        | j         j        z  dk    rt          d          t	          j        | j         j        | j        t          j        j        	                    | j         j
        dz  dd          | j         j                  | _        t	          j        | j         j        | j        t          j        j        	                    | j         j
        dz  dd          | j         j                  | _        t	          j        | j         j        | j        t          j        j        	                    | j         j
        dz  dd          | j         j                  | _        d S )Nr   z`config.hidden_size`: {self.config.hidden_size} has to be a multiple of `config.num_attention_heads`: {self.config.num_attention_heads}r   r   r   )modedistribution)r   r"   use_bias)r   r)   num_attention_headsr6   r'   Denser   r*   r+   r,   r-   qkv_biasquerykeyvaluer/   s    r0   r1   zFlaxViTSelfAttention.setup   sW   ;"T[%DDII5  
 XK#*+<<-q0xN` =   [)
 
 

 8K#*+<<-q0xN` =   [)
 
 
 XK#*+<<-q0xN` =   [)
 
 



r2   TFrV   output_attentionsc           
         | j         j        | j         j        z  }|                     |                              |j        d d         | j         j        |fz             }|                     |                              |j        d d         | j         j        |fz             }|                     |                              |j        d d         | j         j        |fz             }d }|s%| j         j        dk    r| 	                    d          }t          |||| j         j        d|| j        d           }	t          j        d|	|          }
|
                    |
j        d d         dz             }
|r|
|	fn|
f}|S )Nr   g        rR   T)dropout_rngdropout_ratebroadcast_dropoutrV   r   	precisionz...hqk,...khd->...qhd)r4   )r   r)   rb   re   r8   r5   rg   rf   attention_probs_dropout_probmake_rngr   r   r7   einsum)r/   hidden_statesrV   ri   head_dimquery_statesvalue_states
key_statesrk   attn_weightsattn_outputoutputss               r0   r>   zFlaxViTSelfAttention.__call__   s   ;*dk.MMzz-0088#t{'F&QQ
 
 zz-0088#t{'F&QQ
 
 XXm,,44#t{'F&QQ
 

  	3!IC!O!O--	22K4#A"'*	
 	
 	
 j!8,UU!))+*;BQB*?%*GHH1BV;--r2   NTFr@   rA   rB   r   rC   r7   rD   r   r1   boolr>   rE   r2   r0   r]   r]      sn         {E39"""
 
 
@   T  UY            r2   r]   c                   P    e Zd ZU eed<   ej        Zej        ed<   d Zdde	fdZ
dS )	FlaxViTSelfOutputr   r   c                    t          j        | j        j        t          j         j                            | j        j        dz  dd          | j                  | _	        t          j
        | j        j                  | _        d S Nr   r   r   r"   r   rL   r'   rc   r   r)   r*   r+   r,   r-   r   denserP   rQ   rR   rh   s    r0   r1   zFlaxViTSelfOutput.setup   r    XK#+<<-q0(<N  *
 
 

 zt{'FGGGr2   TrV   c                 ^    |                      |          }|                     ||          }|S NrU   r   rR   )r/   rr   input_tensorrV   s       r0   r>   zFlaxViTSelfOutput.__call__   s.    

=11]-PPr2   NrZ   r{   rE   r2   r0   r~   r~      sh         {E39"""H H H 4      r2   r~   c                   P    e Zd ZU eed<   ej        Zej        ed<   d Zd	de	fdZ
dS )
FlaxViTAttentionr   r   c                     t          | j        | j                  | _        t	          | j        | j                  | _        d S NrJ   )r]   r   r   	attentionr~   outputrh   s    r0   r1   zFlaxViTAttention.setup   s6    -dkLLL'4:FFFr2   TFri   c                     |                      |||          }|d         }|                     |||          }|f}|r||d         fz  }|S NrV   ri   r   rU   r   )r   r   )r/   rr   rV   ri   attn_outputsrx   ry   s          r0   r>   zFlaxViTAttention.__call__   s`    ~~m=du~vv"1oKm\\ " 	*Q))Gr2   Nrz   r{   rE   r2   r0   r   r      sh         {E39"""G G G
 
T 
 
 
 
 
 
r2   r   c                   H    e Zd ZU eed<   ej        Zej        ed<   d Zd Z	dS )FlaxViTIntermediater   r   c                     t          j        | j        j        t          j         j                            | j        j        dz  dd          | j                  | _	        t          | j        j                 | _        d S Nr   r   r   r   )r'   rc   r   intermediate_sizer*   r+   r,   r-   r   r   r   
hidden_act
activationrh   s    r0   r1   zFlaxViTIntermediate.setup  sj    XK)+<<-q0(<N  *
 
 

 !!78r2   c                 Z    |                      |          }|                     |          }|S Nr   r   )r/   rr   s     r0   r>   zFlaxViTIntermediate.__call__  s*    

=1166r2   Nr?   rE   r2   r0   r   r   	  sT         {E39"""9 9 9    r2   r   c                   P    e Zd ZU eed<   ej        Zej        ed<   d Zdde	fdZ
dS )	FlaxViTOutputr   r   c                    t          j        | j        j        t          j         j                            | j        j        dz  dd          | j                  | _	        t          j
        | j        j                  | _        d S r   r   rh   s    r0   r1   zFlaxViTOutput.setup!  r   r2   TrV   c                 h    |                      |          }|                     ||          }||z   }|S r   r   )r/   rr   attention_outputrV   s       r0   r>   zFlaxViTOutput.__call__+  s9    

=11]-PP%(88r2   NrZ   r{   rE   r2   r0   r   r     sh         {E39"""H H H t      r2   r   c                   T    e Zd ZU eed<   ej        Zej        ed<   d Zd
de	de	fdZ
d	S )FlaxViTLayerr   r   c                 n   t          | j        | j                  | _        t	          | j        | j                  | _        t          | j        | j                  | _        t          j	        | j        j
        | j                  | _        t          j	        | j        j
        | j                  | _        d S NrJ   )epsilonr   )r   r   r   r   r   intermediater   r   r'   	LayerNormlayer_norm_epslayernorm_beforelayernorm_afterrh   s    r0   r1   zFlaxViTLayer.setup6  s    )$+TZHHH/4:NNN#DKtzBBB "T[5OW[Wa b b b!|DK4NVZV`aaar2   TFrV   ri   c                    |                      |                     |          ||          }|d         }||z   }|                     |          }|                     |          }|                     |||          }|f}|r||d         fz  }|S r   )r   r   r   r   r   )r/   rr   rV   ri   attention_outputsr   layer_outputry   s           r0   r>   zFlaxViTLayer.__call__=  s     NN!!-00'/ + 
 
 -Q/ ,m; ++,<==)),77M3CS`aa " 	/)!,..Gr2   Nrz   r{   rE   r2   r0   r   r   2  sp         {E39"""b b b T UY      r2   r   c            	       d    e Zd ZU eed<   ej        Zej        ed<   d Z	 	 	 	 dde	de	de	d	e	fd
Z
dS )FlaxViTLayerCollectionr   r   c                 \      fdt           j        j                  D              _        d S )Nc                 b    g | ]+}t          j        t          |          j                   ,S ))namer   )r   r   strr   ).0ir/   s     r0   
<listcomp>z0FlaxViTLayerCollection.setup.<locals>.<listcomp>[  s?     
 
 
IJL3q66DDD
 
 
r2   )ranger   num_hidden_layerslayersrh   s   `r0   r1   zFlaxViTLayerCollection.setupZ  s@    
 
 
 
NSTXT_TqNrNr
 
 
r2   TFrV   ri   output_hidden_statesreturn_dictc                    |rdnd }|rdnd }t          | j                  D ]1\  }}	|r||fz  } |	|||          }
|
d         }|r||
d         fz  }2|r||fz  }|f}|st          d |D                       S t          |||          S )NrE   r   r   r   c              3      K   | ]}||V  	d S r   rE   )r   vs     r0   	<genexpr>z2FlaxViTLayerCollection.__call__.<locals>.<genexpr>z  s"      ==qq}}}}}==r2   )last_hidden_staterr   
attentions)	enumerater   tupler   )r/   rr   rV   ri   r   r   all_attentionsall_hidden_statesr   layerlayer_outputsry   s               r0   r>   zFlaxViTLayerCollection.__call___  s      1:d"6@BBD!$+.. 		6 		6HAu# 6!m%55!!E-}`qrrrM)!,M  6=#3"55 	2-!11 " 	>==G======"+;LYg
 
 
 	
r2   NTFFTr{   rE   r2   r0   r   r   V  s         {E39"""
 
 
 #"'%* 
 
 
  	

 #
 
 
 
 
 
 
r2   r   c            	       d    e Zd ZU eed<   ej        Zej        ed<   d Z	 	 	 	 dde	de	de	d	e	fd
Z
dS )FlaxViTEncoderr   r   c                 F    t          | j        | j                  | _        d S r   )r   r   r   r   rh   s    r0   r1   zFlaxViTEncoder.setup  s    +DKtzJJJ


r2   TFrV   ri   r   r   c                 6    |                      |||||          S )NrV   ri   r   r   )r   )r/   rr   rV   ri   r   r   s         r0   r>   zFlaxViTEncoder.__call__  s.     zz'/!5#  
 
 	
r2   Nr   r{   rE   r2   r0   r   r     s         {E39"""K K K #"'%* 
 
 
  	

 #
 
 
 
 
 
 
r2   r   c                   H    e Zd ZU eed<   ej        Zej        ed<   d Zd Z	dS )FlaxViTPoolerr   r   c                     t          j        | j        j        t          j         j                            | j        j        dz  dd          | j                  | _	        t          | j        j                 | _        d S r   )r'   rc   r   pooler_output_sizer*   r+   r,   r-   r   r   r   
pooler_actr   rh   s    r0   r1   zFlaxViTPooler.setup  sj    XK*+<<-q0(<N  *
 
 

 !!78r2   c                 n    |d d df         }|                      |          }|                     |          S )Nr   r   )r/   rr   cls_hidden_states      r0   r>   zFlaxViTPooler.__call__  s;    (A.::&677/000r2   Nr?   rE   r2   r0   r   r     sT         {E39"""9 9 91 1 1 1 1r2   r   c                   `    e Zd ZU dZeZdZdZdZe	j
        ed<   ddej        dfded	ed
ej        def fdZddej        j        dededefdZ ee                    d                    	 	 	 	 	 	 ddee         dej        j        dedee         dee         dee         fd            Z xZS )FlaxViTPreTrainedModelz
    An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
    models.
    vitr9   Nmodule_classr   Tr   seedr   _do_initc                      | j         d||d|}|d|j        |j        |j        f}t                                          ||||||           d S )N)r   r   r   )input_shaper   r   r   rE   )r   r#   r&   super__init__)	r/   r   r   r   r   r   kwargsmodule	__class__s	           r0   r   zFlaxViTPreTrainedModel.__init__  sn     #"H&HHHHf/1BFDWXK[tSXcklllllr2   rngr   paramsreturnc                    t          j        || j                  }t          j                            |          \  }}||d}| j                            ||d          d         }||t          t          |                    }t          t          |                    }| j
        D ]}	||	         ||	<   t                      | _
        t          t          |                    S |S )NrJ   )r   rR   F)r   r   )r7   zerosr   r*   randomsplitr   initr   r   _missing_keyssetr   r	   )
r/   r   r   r   r9   
params_rngrk   rngsrandom_paramsmissing_keys
             r0   init_weightsz#FlaxViTPreTrainedModel.init_weights  s    yDJ???"%*"2"23"7"7
K$==((|(OOPXY(-)@)@AAM!(6"2"233F#1 A A&3K&@{##!$D.00111  r2   zbatch_size, sequence_lengthFrk   trainri   r   r   c           	      0   ||n| j         j        }||n| j         j        }||n| j         j        }t	          j        |d          }i }|||d<   | j                            d|p| j        it	          j	        |t          j
                  | ||||          S )N)r   r   r
   r   rR   r   rJ   )r   )r   ri   r   r   r7   	transposer   applyr   arrayrD   )	r/   r9   r   rk   r   ri   r   r   r   s	            r0   r>   zFlaxViTPreTrainedModel.__call__  s     2C1N--TXT_Tq$8$D  $+Jj 	 &1%<kk$+BY}\<@@")DO{  v,-Il#+666I  ! 
 
 	
r2   r   )NNFNNN)r@   rA   rB   r[   r   config_classbase_model_prefixmain_input_namer   r'   ModulerC   r7   rD   intr   r|   r   r*   r   PRNGKeyr   r   r   r   VIT_INPUTS_DOCSTRINGformatr   dictr>   __classcell__)r   s   @r0   r   r     s         
 L$O"L")"""
 ;m mm 	m
 ym m m m m m m! !
 2 ! !PZ !fp ! ! ! !& +*+?+F+FGd+e+eff "&*.,0/3&*
 
 
 Z'	

 
 $D>
 'tn
 d^
 
 
 gf
 
 
 
 
r2   r   c            	       r    e Zd ZU eed<   ej        Zej        ed<   dZe	ed<   d Z
	 	 	 	 dde	de	d	e	d
e	fdZdS )FlaxViTModuler   r   Tadd_pooling_layerc                 ,   t          | j        | j                  | _        t	          | j        | j                  | _        t          j        | j        j        | j                  | _	        | j
        rt          | j        | j                  nd | _        d S r   )rG   r   r   r:   r   encoderr'   r   r   	layernormr  r   poolerrh   s    r0   r1   zFlaxViTModule.setup   s{    +DKtzJJJ%dkDDDdk.HPTPZ[[[FJF\fmDKtzBBBBbfr2   FrV   ri   r   r   c                 V   |                      ||          }|                     |||||          }|d         }|                     |          }| j        r|                     |          nd }|s||f|dd          z   S ||f|dd          z   S t          |||j        |j                  S )NrU   r   r   r   )r   pooler_outputrr   r   )r:   r  r  r  r  r   rr   r   )	r/   r9   rV   ri   r   r   rr   ry   pooleds	            r0   r>   zFlaxViTModule.__call__  s     MRR,,'/!5#  
 
  
}55/3/EO]+++4 	9~%''!""+55!6*WQRR[88-+ !/)	
 
 
 	
r2   Nr   )r@   rA   rB   r   rC   r7   rD   r   r  r|   r1   r>   rE   r2   r0   r  r    s         {E39""""t"""g g g #"'%*  
  
  
  	 

 # 
  
  
  
  
  
  
r2   r  z]The bare ViT Model transformer outputting raw hidden-states without any specific head on top.c                       e Zd ZeZdS )FlaxViTModelN)r@   rA   rB   r  r   rE   r2   r0   r  r  )  s        
 !LLLr2   r  a  
    Returns:

    Examples:

    ```python
    >>> from transformers import AutoImageProcessor, FlaxViTModel
    >>> from PIL import Image
    >>> import requests

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

    >>> image_processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224-in21k")
    >>> model = FlaxViTModel.from_pretrained("google/vit-base-patch16-224-in21k")

    >>> inputs = image_processor(images=image, return_tensors="np")
    >>> outputs = model(**inputs)
    >>> last_hidden_states = outputs.last_hidden_state
    ```
)output_typer   c                   Z    e Zd ZU eed<   ej        Zej        ed<   d Z	 	 	 	 	 dde	fdZ
dS )	#FlaxViTForImageClassificationModuler   r   c           	          t          | j        | j        d          | _        t	          j        | j        j        | j        t          j        j        	                    | j        j
        dz  dd                    | _        d S )NF)r   r   r  r   r   r   )r   r"   )r  r   r   r   r'   rc   
num_labelsr*   r+   r,   r-   
classifierrh   s    r0   r1   z)FlaxViTForImageClassificationModule.setupO  sp     4:Y^___(K"*+<<-q0(<N 
 
 
r2   NTrV   c                    ||n| j         j        }|                     |||||          }|d         }|                     |d d dd d f                   }|s|f|dd          z   }	|	S t	          ||j        |j                  S )Nr   r   r   )logitsrr   r   )r   use_return_dictr   r  r   rr   r   )
r/   r9   rV   ri   r   r   ry   rr   r  r   s
             r0   r>   z,FlaxViTForImageClassificationModule.__call__Y  s     &1%<kk$+B](('/!5#  
 
  
qqq!QQQw!788 	Y,FM+!/)
 
 
 	
r2   )NTNNNr{   rE   r2   r0   r  r  K  sy         {E39"""
 
 
 "!
 
 
 
 
 
 
 
r2   r  z
    ViT Model transformer with an image classification head on top (a linear layer on top of the final hidden state of
    the [CLS] token) e.g. for ImageNet.
    c                       e Zd ZeZdS )FlaxViTForImageClassificationN)r@   rA   rB   r  r   rE   r2   r0   r  r  y  s         7LLLr2   r  ag  
    Returns:

    Example:

    ```python
    >>> from transformers import AutoImageProcessor, FlaxViTForImageClassification
    >>> from PIL import Image
    >>> import jax
    >>> import requests

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

    >>> image_processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224")
    >>> model = FlaxViTForImageClassification.from_pretrained("google/vit-base-patch16-224")

    >>> inputs = image_processor(images=image, return_tensors="np")
    >>> outputs = model(**inputs)
    >>> logits = outputs.logits

    >>> # model predicts one of the 1000 ImageNet classes
    >>> predicted_class_idx = jax.numpy.argmax(logits, axis=-1)
    >>> print("Predicted class:", model.config.id2label[predicted_class_idx.item()])
    ```
)r  r  r   )6typingr   
flax.linenlinenr'   r*   	jax.numpynumpyr7   flax.core.frozen_dictr   r   r   flax.linen.attentionr   flax.traverse_utilr   r	   modeling_flax_outputsr   r   r   modeling_flax_utilsr   r   r   r   utilsr   r   configuration_vitr   VIT_START_DOCSTRINGr   r   r   rG   r]   r~   r   r   r   r   r   r   r   r   r  r  FLAX_VISION_MODEL_DOCSTRINGr  r  FLAX_VISION_CLASSIF_DOCSTRING__all__rE   r2   r0   <module>r(     s                



       > > > > > > > > > > > > > > > > ; ; ; ; ; ; ; ; v v v v v v v v v v            Q P P P P P P P ( ( ( ( ( (! F "C C C C CRY C C C@    	   BD D D D D29 D D DN    	   (    ry   *    ")   (    BI   *! ! ! ! !29 ! ! !H(
 (
 (
 (
 (
RY (
 (
 (
V
 
 
 
 
RY 
 
 
01 1 1 1 1BI 1 1 1(K
 K
 K
 K
 K
0 K
 K
 K
\+
 +
 +
 +
 +
BI +
 +
 +
\ c ! ! ! ! !) ! !	 ! ,  'B C C C    ;Yhq r r r r+
 +
 +
 +
 +
") +
 +
 +
\   7 7 7 7 7$: 7 7 7! 6  68U V V V    !/KZc   
 V
U
Ur2   