Ë
    ÛÓ^j>  ã                   óÜ   — d Z ddlmZ ddlmZ ddlmZ  ed¬«      e G d„ d	e«      «       «       Z ed¬«      e G d
„ de«      «       «       Z ed¬«      e G d„ de«      «       «       Z	g d¢Z
y)zIdefics model configurationé    )Ústricté   )ÚPreTrainedConfig)Úauto_docstringzHuggingFaceM4/idefics-9b)Ú
checkpointc                   ó   — e Zd ZU dZddiZdZeed<   dZee	e   z  e
eef   z  ed<   dZeed<   d	Zee	e   z  e
eef   z  ed
<   dZeed<   dZeed<   dZeed<   dZeed<   dZeed<   dZeez  ed<   dZeed<   dZeed<   y)Ú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_factorN)Ú__name__Ú
__module__Ú__qualname__Ú
model_typeÚattribute_mapr   ÚintÚ__annotations__r   ÚlistÚtupler   r   r   r   r   r   Ústrr   Úfloatr   r   r   © ó    ú|/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/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                   ój   — e Zd ZU dZdZdZeed<   dZe	ed<   dZ
e	ed<   d	Ze	ed
<   dZe	ed<   dZeed<   y)ÚIdeficsPerceiverConfigaB  
    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_perceiverN)r   r    r!   Ú__doc__r"   r0   Úboolr%   r2   r$   r4   r5   r7   r8   r*   r+   r,   r.   r.   /   sN   … ñð %€Jà€M�4ÓØ!Ð˜Ó!Ø€O�SÓØÐ�sÓØ Ð˜Ó Ø%*Ð˜dÔ*r+   r.   c                   ó  ‡ — e Zd ZU dZdZeedœZdZe	e
d<   dZe	e
d<   dZe	e
d	<   d
Ze	e
d<   dZe	e
d<   dZe	e
d<   dZee	z  e
d<   dZee
d<   dZee
d<   dZee
d<   dZee
d<   dZee
d<   dZee
d<   dZee
d<   dZe	dz  e
d<   d Ze	dz  e
d!<   d"Ze	ee	   z  dz  e
d#<   d$Zee
d%<   d Z e	e
d&<   d$Z!ee
d'<   dZ"ee
d(<   d)Z#ee$z  e
d*<   d$Z%ee
d+<   dZ&ee
d,<   d)Z'ee$z  e
d-<   d$Z(ee
d.<   dZ)e*e+z  dz  e
d/<   dZ,e*e+z  dz  e
d0<   ˆ fd1„Z-ˆ xZ.S )2ÚIdeficsConfigah  
    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_exceptionsr0   r?   r>   c                 ód  •— | j                   €t        «       | _         n4t        | j                   t        «      rt        di | j                   ¤Ž| _         | j                  €t        «       | _        n4t        | j                  t        «      rt        di | j                  ¤Ž| _        t        ‰| �  di |¤Ž y )Nr*   )r>   r.   Ú
isinstanceÚdictr?   r	   ÚsuperÚ__post_init__)ÚselfÚkwargsÚ	__class__s     €r,   r[   zIdeficsConfig.__post_init__›   s�   ø€ Ø× Ñ Ð(Ü$:Ó$<ˆDÕ!Ü˜×-Ñ-¬tÔ4Ü$:Ñ$S¸T×=RÑ=RÑ$SˆDÔ!à×ÑÐ%Ü!4Ó!6ˆDÕÜ˜×*Ñ*¬DÔ1Ü!4Ñ!J°t×7IÑ7IÑ!JˆDÔä‰ÑÑ' Ó'r+   )/r   r    r!   r9   r"   r.   r	   Úsub_configsr@   r$   r%   rA   r   r   r   r   rB   r)   r   r(   r   rE   rF   rG   rH   rI   r:   rJ   rL   rN   r&   rO   rP   rQ   rR   rS   r'   rT   rU   rV   r0   r?   rY   r   r>   r[   Ú__classcell__)r^   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<   r.   r	   N)r9   Úhuggingface_hub.dataclassesr   Úconfiguration_utilsr   Úutilsr   r	   r.   r<   Ú__all__r*   r+   r,   ú<module>re      s�   ðñ& "å .å 3Ý #ñ Ð5Ô6Øô$Ð*ó $ó ó 7ð$ñ$ Ð5Ô6Øô+Ð-ó +ó ó 7ð+ñ4 Ð5Ô6ØôY(Ð$ó Y(ó ó 7ðY(òx M�r+   