ó
    qyüi>  ã                   óÊ   • S r SSKJr  SSKJr  SSKJ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Idefics model configurationé    )Ústricté   )ÚPreTrainedConfig)Úauto_docstringzHuggingFaceM4/idefics-9b)Ú
checkpointc                   ó  • \ rS rSr% SrSS0rSr\\S'   Sr	\\
\   -  \\\4   -  \S'   Sr\\S	'   S
r\\
\   -  \\\4   -  \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g)ÚIdeficsVisionConfigé   Úidefics_visionÚhidden_sizeÚ	embed_dimi   éà   Ú
image_sizei   Úintermediate_sizeé   Ú
patch_sizeé    Únum_hidden_layersé   Únum_attention_headsr   Únum_channelsÚgeluÚ
hidden_actgñhãˆµøä>Úlayer_norm_epsç        Úattention_dropoutç{®Gáz”?Úinitializer_rangeg      ð?Úinitializer_factor© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú
model_typeÚattribute_mapr   ÚintÚ__annotations__r   ÚlistÚtupler   r   r   r   r   r   Ústrr   Úfloatr   r   r   Ú__static_attributes__r    ó    Ún/home/mande/repo/quber/.venv/lib/python3.13/site-packages/transformers/models/idefics/configuration_idefics.pyr	   r	      s¿   ‡ ð "€JØ" KÐ0€Mà€IˆsÓØ47€J��d˜3‘i‘ %¨¨S¨¡/Ñ1Ó7Ø!Ð�sÓ!Ø46€J��d˜3‘i‘ %¨¨S¨¡/Ñ1Ó6ØÐ�sÓØ!Ð˜Ó!Ø€L�#ÓØ€J�ÓØ €N�EÓ Ø%(Ð�u˜s‘{Ó(Ø#Ð�uÓ#Ø #Ð˜Ö#r.   r	   c                   ór   • \ 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g)ÚIdeficsPerceiverConfigé/   a  
use_resampler (`bool`, *optional*, defaults to `False`):
    Whether or not to use the resampler
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 6):
    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.
qk_layer_norms_perceiver (`bool`, *optional*, defaults to `False`):
    Whether or not to use qk layer norms in perceiver
Úidefics_percieverFÚuse_resampleré@   Úresampler_n_latentsé   Úresampler_depthr   Úresampler_n_headsé`   Úresampler_head_dimÚqk_layer_norms_perceiverr    N)r!   r"   r#   r$   Ú__doc__r%   r4   Úboolr(   r6   r'   r8   r9   r;   r<   r-   r    r.   r/   r1   r1   /   sN   ‡ ñð %€Jà€M�4ÓØ!Ð˜Ó!Ø€O�SÓØÐ�sÓØ Ð˜Ó Ø%*Ð˜dÖ*r.   r1   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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-  \S '   S!r\
S-  \S"'   S#r\
\\
   -  S-  \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-  \S0'   Sr-\+\,-  S-  \S1'   U 4S2 jr.Sr/U =r0$ )3ÚIdeficsConfigéK   aÐ  
additional_vocab_size (`int`, *optional*, defaults to 0):
    Additional vocabulary size of the model, typically for the special "<img>" token. Additional vocab tokens
    are always trainable whereas regular vocab tokens can be frozen or not.
alpha_initializer (`str`, *optional*, defaults to `"zeros"`):
    Initialization type for the alphas.
alphas_initializer_range (`float`, *optional*, defaults to 0.0):
    The standard deviation of the truncated_normal_initializer for initializing the alphas in the Gated Cross
    Attention.
alpha_type (`str`, *optional*, defaults to `"float"`):
    Whether the gating alphas should be vectors or single floats.
cross_layer_interval (`int`, *optional*, default to 1):
    Interval for cross attention (from text to image) layers.
qk_layer_norms (`bool`, *optional*, defaults to `False`):
    Whether to add layer norm after q and k
freeze_text_layers (`bool`, *optional*, defaults to `True`):
    Whether to freeze text layers
freeze_text_module_exceptions (`bool`, *optional*, defaults to `[]`):
    Exceptions to freezing text layers when `freeze_text_layers` is `True`
freeze_lm_head (`bool`, *optional*, defaults to `False`):
    Whether to freeze lm head
freeze_vision_layers (`bool`, *optional*, defaults to `True`):
    Whether to freeze vision layers
freeze_vision_module_exceptions (`bool`, *optional*, defaults to `[]`):
    Exceptions to freezing vision layers when `freeze_vision_layers` is `True`
use_resampler (`bool`, *optional*, defaults to `False`):
    Whether to use the Resampler
perceiver_config (`IdeficsPerceiverConfig`,  *optional*):
    Custom perceiver config or dict

Example:

```python
>>> from transformers import IdeficsModel, IdeficsConfig

>>> # Initializing a Idefics idefics-9b style configuration
>>> configuration = IdeficsConfig()

>>> # Initializing a model from the idefics-9b style configuration
>>> model = IdeficsModel(configuration)

>>> # Accessing the model configuration
>>> configuration = model.config
```Úidefics)Úperceiver_configÚvision_configi }  Ú
vocab_sizer   Úadditional_vocab_sizei   r   i +  r   r   r   r   r   ÚdropoutÚsilur   r   r   ÚzerosÚalpha_initializerÚalphas_initializer_ranger,   Ú
alpha_typeg�íµ ÷Æ°>Úrms_norm_epsTÚ	use_cacheNÚpad_token_idé   Úbos_token_idé   Úeos_token_idFÚtie_word_embeddingsÚcross_layer_intervalÚqk_layer_normsÚfreeze_text_layersr    Úfreeze_text_module_exceptionsÚfreeze_lm_headÚfreeze_vision_layersÚfreeze_vision_module_exceptionsr4   rD   rC   c                 ó~  >• U R                   c  [        5       U l         O9[        U R                   [        5      (       a  [        S0 U R                   D6U l         U R                  c  [        5       U l        O9[        U R                  [        5      (       a  [        S0 U R                  D6U l        [        TU ]  " S0 UD6  g )Nr    )rC   r1   Ú
isinstanceÚdictrD   r	   ÚsuperÚ__post_init__)ÚselfÚkwargsÚ	__class__s     €r/   r`   ÚIdeficsConfig.__post_init__›   s“   ø€ Ø× Ñ Ñ(Ü$:Ó$<ˆDÕ!Ü˜×-Ñ-¬t×4Ñ4Ü$:Ñ$S¸T×=RÑ=RÑ$SˆDÔ!à×ÑÑ%Ü!4Ó!6ˆDÕÜ˜×*Ñ*¬D×1Ñ1Ü!4Ñ!J°t×7IÑ7IÑ!JˆDÔä‰ÒÑ' Ó'r.   )1r!   r"   r#   r$   r=   r%   r1   r	   Úsub_configsrE   r'   r(   rF   r   r   r   r   rG   r,   r   r+   r   rJ   rK   rL   rM   rN   r>   rO   rQ   rS   r)   rT   rU   rV   rW   rX   r*   rY   rZ   r[   r4   rD   r^   r   rC   r`   r-   Ú__classcell__)rc   s   @r/   r@   r@   K   s‚  ø‡ ñ+ðZ €JØ'=ÐPcÑd€Kà€J�ÓØ!"Ð˜3Ó"Ø€K�ÓØ"Ð�sÓ"ØÐ�sÓØ!Ð˜Ó!Ø€GˆU�S‰[ÓØ€J�ÓØ#Ð�uÓ#Ø$Ð�sÓ$Ø&)Ð˜eÓ)Ø€J�ÓØ€L�%ÓØ€IˆtÓØ €L�#˜‘*Ó Ø €L�#˜‘*Ó Ø+,€L�#˜˜S™	‘/ DÑ(Ó,Ø %Ð˜Ó%Ø !Ð˜#Ó!Ø €N�DÓ Ø#Ð˜Ó#Ø24Ð! 4¨%¡<Ó4Ø €N�DÓ Ø!%Ð˜$Ó%Ø46Ð# T¨E¡\Ó6Ø€M�4ÓØ48€M�4Ð*Ñ*¨TÑ1Ó8Ø7;Ð�dÐ-Ñ-°Ñ4Ó;÷(ó (r.   r@   )r@   r1   r	   N)r=   Úhuggingface_hub.dataclassesr   Úconfiguration_utilsr   Úutilsr   r	   r1   r@   Ú__all__r    r.   r/   Ú<module>rk      s�   ðñ& "å .å 3Ý #ñ Ð5Ñ6Øô$Ð*ó $ó ó 7ð$ñ$ Ð5Ñ6Øô+Ð-ó +ó ó 7ð+ñ4 Ð5Ñ6ØôY(Ð$ó Y(ó ó 7ðY(òx M�r.   