§
    ‚Štj>  ã                   ó&  — 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
dS )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<   dS )Ú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   © ó    úo/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/transformers/models/idefics/configuration_idefics.pyr	   r	      s  € € € € € € ð "€JØ" KÐ0€Mà€IˆsÐÐÑØ47€J��d˜3”i‘ %¨¨S¨¤/Ñ1Ð7Ð7Ñ7Ø!Ð�sÐ!Ð!Ñ!Ø46€J��d˜3”i‘ %¨¨S¨¤/Ñ1Ð6Ð6Ñ6ØÐ�sÐÐÑØ!Ð˜Ð!Ð!Ñ!Ø€L�#ÐÐÑØ€J�ÐÐÑØ €N�EÐ Ð Ñ Ø%(Ð�u˜s‘{Ð(Ð(Ñ(Ø#Ð�uÐ#Ð#Ñ#Ø #Ð˜Ð#Ð#Ñ#Ð#Ð#r+   r	   c                   ól   — 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<   dS )Ú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.   /   s‡   € € € € € € ðð ð %€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                 óf  •— | j         €t          ¦   «         | _         n0t          | j         t          ¦  «        rt          di | j         ¤Ž| _         | j        €t          ¦   «         | _        n0t          | j        t          ¦  «        rt          di | j        ¤Ž| _         t          ¦   «         j        di |¤Ž d S )Nr*   )r>   r.   Ú
isinstanceÚdictr?   r	   ÚsuperÚ__post_init__)ÚselfÚkwargsÚ	__class__s     €r,   r[   zIdeficsConfig.__post_init__›   s¸   ø€ ØÔ Ð(Ý$:Ñ$<Ô$<ˆDÔ!Ð!Ý˜Ô-­tÑ4Ô4ð 	TÝ$:Ð$SÐ$S¸TÔ=RÐ$SÐ$SˆDÔ!àÔÐ%Ý!4Ñ!6Ô!6ˆDÔÐÝ˜Ô*­DÑ1Ô1ð 	KÝ!4Ð!JÐ!J°tÔ7IÐ!JÐ!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Ð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Ð4Ñ4Ø €N�DÐ Ð Ñ Ø!%Ð˜$Ð%Ð%Ñ%Ø46Ð# T¨E¡\Ð6Ð6Ñ6Ø€M�4ÐÐÑØ48€M�4Ð*Ñ*¨TÑ1Ð8Ð8Ñ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      sN  ðð& "Ð !à .Ð .Ð .Ð .Ð .Ð .à 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø #Ð #Ð #Ð #Ð #Ð #ð €Ð5Ð6Ñ6Ô6Øð$ð $ð $ð $ð $Ð*ñ $ô $ñ „ñ 7Ô6ð$ð$ €Ð5Ð6Ñ6Ô6Øð+ð +ð +ð +ð +Ð-ñ +ô +ñ „ñ 7Ô6ð+ð4 €Ð5Ð6Ñ6Ô6ØðY(ð Y(ð Y(ð Y(ð Y(Ð$ñ Y(ô Y(ñ „ñ 7Ô6ðY(ðx MÐ
LÐ
L€€€r+   