
    Z j                        S r SSKJr  SSKJr  SSKJrJr  SSKJ	r	J
r
  \R                  " \5      r\" SS	9\ " S
 S\5      5       5       r\" SS	9\ " S S\5      5       5       r\" SS	9\ " S S\5      5       5       r/ SQrg)zIdefics2 model configuration    )strict   )PreTrainedConfig)auto_docstringlogging   )CONFIG_MAPPING
AutoConfigzHuggingFaceM4/idefics2-8b)
checkpointc                       \ rS rSr% SrSrSrSr\\	S'   Sr
\\	S'   S	r\\	S
'   S	r\\	S'   Sr\\	S'   Sr\\\   -  \\\4   -  \	S'   Sr\\\   -  \\\4   -  \	S'   Sr\\	S'   Sr\\	S'   Sr\\-  \	S'   Sr\\	S'   Srg)Idefics2VisionConfig   aY  
Example:

```python
>>> from transformers.models.idefics2.modeling_idefics2 import Idefics2VisionTransformer
>>> from transformers.models.idefics2.configuration_idefics2 import Idefics2VisionConfig

>>> # Initializing a Idefics2VisionConfig with google/siglip-base-patch16-224 style configuration
>>> configuration = Idefics2VisionConfig()

>>> # Initializing a Idefics2VisionTransformer (with random weights) from the google/siglip-base-patch16-224 style configuration
>>> model = Idefics2VisionTransformer(configuration)

>>> # Accessing the model configuration
>>> configuration = model.config
```idefics2_visionvision_configi   hidden_sizei   intermediate_size   num_hidden_layersnum_attention_headsr   num_channels   
image_size    
patch_sizegelu_pytorch_tanh
hidden_actư>layer_norm_eps        attention_dropout{Gz?initializer_range N)__name__
__module____qualname____firstlineno____doc__
model_typebase_config_keyr   int__annotations__r   r   r   r   r   listtupler   r   strr   floatr    r"   __static_attributes__r#       ڄ/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/transformers/models/idefics2/configuration_idefics2.pyr   r      s    " #J%OK!s!s!!L#47Jd3i%S/1746Jd3i%S/16)J) NE %(us{(#u#r2   r   c                       \ rS rSr% SrSrSr\\S'   Sr	\
\S'   Sr\\S	'   S
r\
\S'   Sr\
\S'   Sr\
\S'   Sr\
\S'   Sr\
\S'   Sr\\
-  \S'   Sr\\S'   S rSrg)Idefics2PerceiverConfig=   a4  
resampler_n_latents (`int`, *optional*, defaults to 64):
    Number of latent embeddings to resample ("compress") the input sequence to (usually < 128).
resampler_depth (`int`, *optional*, defaults to 3):
    Depth of the Perceiver Resampler (Transformer w/ cross attention). Should be shallow (<= 3).
resampler_n_heads (`int`, *optional*, defaults to 16):
    Number of heads in each Transformer block (for multi-headed self-attention).
resampler_head_dim (`int`, *optional*, defaults to 96):
    Dimensionality of each head projection in the Transformer block.
idefics2_perceiversilur   i   r   r   rms_norm_eps@   resampler_n_latentsr   resampler_depth   resampler_n_heads`   resampler_head_dim   num_key_value_headsr   r    r!   r"   c                     U R                   U R                  :  a%  [        SU R                    SU R                   35      eg)zOPart of `@strict`-powered validation. Validates the architecture of the config.znum_key_value_heads=z1 must be less than or equal to resampler_n_heads=N)rB   r>   
ValueError)selfs    r3   validate_architecture-Idefics2PerceiverConfig.validate_architectureX   sM    ##d&<&<<&t'?'?&@ A&&*&<&<%=?  =r2   r#   N)r$   r%   r&   r'   r(   r)   r   r/   r,   r   r+   r9   r0   r;   r<   r>   r@   rB   r    r"   rF   r1   r#   r2   r3   r5   r5   =   s    	 &JJKL%!!OSs    %(us{(#u#r2   r5   c                      ^  \ rS rSr% SrSr\\\S.r	Sr
\\S'   Sr\\S'   S	r\\S
'   Sr\\-  S-  \S'   Sr\\-  S-  \S'   Sr\\-  S-  \S'   U 4S jrSrU =r$ )Idefics2Configa   a  
perceiver_config (`IdeficsPerceiverConfig` or `dict`, *optional*):
    Custom perceiver config or dict

Example:
```python
>>> from transformers import Idefics2Model, Idefics2Config
>>> # Initializing configuration
>>> configuration = Idefics2Config()
>>> # Initializing a model from the configuration
>>> model = Idefics2Model(configuration)
>>> # Accessing the model configuration
>>> configuration = model.config
```idefics2)text_configperceiver_configr   T	use_cachei}  image_token_idFtie_word_embeddingsNr   rM   rL   c                 @  > U R                   c%  [        5       U l         [        R                  S5        O9[	        U R                   [
        5      (       a  [        S0 U R                   D6U l         U R                  c%  [        5       U l        [        R                  S5        O9[	        U R                  [
        5      (       a  [        S0 U R                  D6U l        [	        U R                  [
        5      (       aU  U R                  R                  SS5      U R                  S'   [        U R                  S      " S0 U R                  D6U l        O6U R                  c)  [        R                  S5        [        S   " SSSS	9U l        U R                  R                  U R                   R                  :w  a_  U R                  R                  U R                   l        U R                  R                  U R                   l        [        R                  S
5        [        TU ]<  " S0 UD6  g )Nz7perciver_config is None, using default perceiver configz2vision_config is None, using default vision configr)   mistralz.text_config is None, using default text configi   gh㈵>r   )max_position_embeddingsr9   pad_token_idzPerceiver config has a different `hidden_size` than text config, which means default values were used. In your model's config on the hub, add `hidden_size` and `rms_norm_eps` keys under the `perceiver_config` dict. r#   )rM   r5   loggerinfo
isinstancedictr   r   rL   getr	   r   r9   warning_oncesuper__post_init__)rE   kwargs	__class__s     r3   r\   Idefics2Config.__post_init__   s     ($;$=D!KKQR--t44$;$Td>S>S$TD!%!5!7DKKLM**D11!5!K8J8J!KDd&&---1-=-=-A-A,PY-ZD\*-d.>.>|.LMaPTP`P`aD%KKHI-i8(0!	 D ''4+@+@+L+LL040@0@0L0LD!!-151A1A1N1ND!!.C
 	''r2   )rM   rL   r   )r$   r%   r&   r'   r(   r)   r
   r5   r   sub_configsrN   boolr,   rO   r+   rP   r   rX   r   rM   rL   r\   r1   __classcell__)r^   s   @r3   rI   rI   a   s     J!3-K It NC  %%48M4**T187;d--4;26K((4/6!( !(r2   rI   )rI   r5   r   N)r(   huggingface_hub.dataclassesr   configuration_utilsr   utilsr   r   autor	   r
   
get_loggerr$   rU   r   r5   rI   __all__r#   r2   r3   <module>ri      s    # . 3 , - 
		H	% 67$+ $  8$D 67.   8D 67?(% ?(  8?(D Pr2   