Ë
    ÜÓ^j  ã                   ó  — d Z ddlmZ ddlmZ ddlmZmZ  ej                  e	«      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Mllama model configurationé    )Ústricté   )ÚPreTrainedConfig)Úauto_docstringÚloggingzmeta-llama/Llama-3.2-11B-Vision)Ú
checkpointc                   óx  ‡ — e Zd ZU dZdZdZddi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	d<   dZee	d<   dZeee   z  eeef   z  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z  e	d<   dZeee      dz  e	d<   d Zee	d!<   ˆ fd"„Zd#„ Zed$efd%„«       Zˆ xZ S )&ÚMllamaVisionConfiga²  
    num_global_layers (`int`, *optional*, defaults to 8):
        Number of global layers in the Transformer encoder. Vision model has a second transformer encoder, called global.
    vision_output_dim (`int`, *optional*, defaults to 7680):
        Dimensionality of the vision model output. Includes output of transformer
        encoder with intermediate layers and global transformer encoder.
    max_num_tiles (`int`, *optional*, defaults to 4):
        Maximum number of tiles for image splitting.
    intermediate_layers_indices (`list[int]`, *optional*, defaults to [3, 7, 15, 23, 30]):
        Indices of intermediate layers of transformer encoder from which to extract and output features.
        These output features are concatenated with final hidden state of transformer encoder.
    supported_aspect_ratios (`list[list[int]]`, *optional*):
        List of supported aspect ratios for image splitting. If not specified, the default supported aspect ratios
        are [[1, 1], [1, 2], [1, 3], [1, 4], [2, 1], [2, 2], [3, 1], [4, 1]] for `max_num_tiles=4`.

    Example:

    ```python
    >>> from transformers import MllamaVisionConfig, MllamaVisionModel

    >>> # Initializing a Llama config
    >>> config = MllamaVisionConfig()

    >>> # Initializing a vision model from the mllama-11b style configuration
    >>> model = MllamaVisionModel(config)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```Úmllama_vision_modelÚvision_configÚnum_attention_headsÚattention_headsi   Úhidden_sizeÚgeluÚ
hidden_acté    Únum_hidden_layersé   Únum_global_layersé   r   Únum_channelsi   Úintermediate_sizei   Úvision_output_dimiÀ  Ú
image_sizeé   Ú
patch_sizeçñhãˆµøä>Únorm_epsé   Úmax_num_tilesNÚintermediate_layers_indicesÚsupported_aspect_ratiosç{®Gáz”?Úinitializer_rangec           	      ó¤   •— | j                   €ddgddgddgddgddgddgddgddgg| _         | j                  €	g d¢| _        t        ‰| �  di |¤Ž y )Né   é   r   r   )r   é   é   é   é   © )r"   r!   ÚsuperÚ__post_init__©ÚselfÚkwargsÚ	__class__s     €úz/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/transformers/models/mllama/configuration_mllama.pyr.   z MllamaVisionConfig.__post_init__M   sv   ø€ Ø×'Ñ'Ð/Ø-.°¨F°Q¸°F¸QÀ¸FÀQÈÀFÈQÐPQÈFÐUVÐXYÐTZÐ]^Ð`aÐ\bÐefÐhiÐdjÐ+kˆDÔ(à×+Ñ+Ð3Ú/AˆDÔ,Ü‰ÑÑ' Ó'ó    c           
      óˆ   — | j                   ddgddgddgddgddgddgddgddggk(  r| j                  dk7  rt        d«      ‚yy)zOPart of `@strict`-powered validation. Validates the architecture of the config.r&   r'   r   r   z;max_num_tiles must be 4 for default supported aspect ratiosN)r"   r    Ú
ValueError©r0   s    r3   Úvalidate_architecturez(MllamaVisionConfig.validate_architectureU   sr   € ð ×(Ñ(¨a°¨V°a¸°V¸aÀ¸VÀaÈÀVÈaÐQRÈVÐVWÐYZÐU[Ð^_ÐabÐ]cÐfgÐijÐekÐ,lÒlØ×"Ñ" aÒ'äÐZÓ[Ð[ð (ð mr4   Úreturnc                 ó,   — t        | j                  «      S )N)Úlenr"   r7   s    r3   Úmax_aspect_ratio_idz&MllamaVisionConfig.max_aspect_ratio_id]   s   € ä�4×/Ñ/Ó0Ð0r4   )!Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
model_typeÚbase_config_keyÚattribute_mapr   ÚintÚ__annotations__r   Ústrr   r   r   r   r   r   r   ÚlistÚtupler   r   Úfloatr    r!   r"   r$   r.   r8   Úpropertyr<   Ú__classcell__©r2   s   @r3   r
   r
      s"  ø… ñð< '€JØ%€OØ*Ð,=Ð>€Mà€K�ÓØ€J�ÓØÐ�sÓØÐ�sÓØ€O�SÓØ€L�#ÓØ!Ð�sÓ!Ø!Ð�sÓ!Ø47€J��d˜3‘i‘ %¨¨S¨¡/Ñ1Ó7Ø46€J��d˜3‘i‘ %¨¨S¨¡/Ñ1Ó6Ø€HˆeÓØ€M�3ÓØ48Ð  c¡¨TÑ!1Ó8Ø6:Ð˜T $ s¡)™_¨tÑ3Ó:Ø#Ð�uÓ#ô(ò\ð ð1 Sò 1ó ô1r4   r
   c                   ó\  ‡ — e Zd ZU dZdZ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Zee	d<   dZe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	d<   dZee   dz  e	d<   d Zeez  e	d!<   d"Zee	d#<   d$Zeee   z  dz  e	d%<   d&Zedz  e	d'<   ˆ fd(„Z ˆ xZ!S ))ÚMllamaTextConfiga  
    cross_attention_layers (`list[int]`, *optional*):
        Indices of the cross attention layers. If not specified, will default to [3, 8, 13, 18, 23, 28, 33, 38].

    Example:

    ```python
    >>> from transformers import MllamaTextModel, MllamaTextConfig

    >>> # Initializing a Mllama text config
    >>> config = MllamaTextConfig()

    >>> # Initializing a model from the Mllama text configuration
    >>> model = MllamaTextModel(config)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```Úmllama_text_modelÚtext_configg    €„Aé õ Ú
vocab_sizei   r   Úsilur   é(   r   r   r   r   Únum_key_value_headsi 8  r   NÚrope_parametersr   Úrms_norm_epsi   Úmax_position_embeddingsr#   r$   TÚ	use_cacheFÚtie_word_embeddingsÚcross_attention_layersg        Údropouti ô Úbos_token_idiô Úeos_token_idiô Úpad_token_idc                 óN   •— | j                   €	g d¢| _         t        ‰| �  di |¤Ž y )N)r   r   é   é   r*   é   é!   é&   r,   )r[   r-   r.   r/   s     €r3   r.   zMllamaTextConfig.__post_init__�   s'   ø€ Ø×&Ñ&Ð.Ú*HˆDÔ'Ü‰ÑÑ' Ó'r4   )"r=   r>   r?   r@   rA   rB   Údefault_thetarR   rD   rE   r   r   rF   r   r   rU   r   rV   ÚdictrW   rI   rX   r$   rY   ÚboolrZ   r[   rG   r\   r]   r^   r_   r.   rK   rL   s   @r3   rN   rN   b   s  ø… ñð& %€JØ#€OØ€Mà€J�ÓØ€K�ÓØ€J�ÓØÐ�sÓØ!Ð˜Ó!Ø Ð˜Ó Ø#Ð�sÓ#Ø#'€O�T˜D‘[Ó'Ø€L�%ÓØ#*Ð˜SÓ*Ø#Ð�uÓ#Ø€IˆtÓØ %Ð˜Ó%Ø/3Ð˜D ™I¨Ñ,Ó3Ø€GˆU�S‰[ÓØ€L�#ÓØ+1€L�#˜˜S™	‘/ DÑ(Ó1Ø%€L�#˜‘*Ó%÷(ð (r4   rN   c                   ó|   ‡ — e Zd ZU dZdZddiZeedœZdZ	e
ez  dz  ed<   dZe
ez  dz  ed<   d	Zeed<   ˆ fd
„Zˆ xZS )ÚMllamaConfiga”  
    Example:

    ```python
    >>> from transformers import MllamaForConditionalGeneration, MllamaConfig, MllamaVisionConfig, MllamaTextConfig

    >>> # Initializing a CLIP-vision config
    >>> vision_config = MllamaVisionConfig()

    >>> # Initializing a Llama config
    >>> text_config = MllamaTextConfig()

    >>> # Initializing a mllama-11b style configuration
    >>> configuration = MllamaConfig(vision_config, text_config)

    >>> # Initializing a model from the mllama-11b style configuration
    >>> model = MllamaForConditionalGeneration(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```ÚmllamaÚimage_token_idÚimage_token_index)rP   r   Nr   rP   rQ   c                 ó¸  •— | j                   €%t        «       | _         t        j                  d«       n4t	        | j                   t
        «      rt        di | j                   ¤Ž| _         | j                  €%t        «       | _        t        j                  d«       n4t	        | j                  t
        «      rt        di | j                  ¤Ž| _        t        ‰| �$  di |¤Ž y )Nz9vision_config is None, using default mllama vision configz5text_config is None, using default mllama text configr,   )
r   r
   ÚloggerÚinfoÚ
isinstancerg   rP   rN   r-   r.   r/   s     €r3   r.   zMllamaConfig.__post_init__¸   s§   ø€ Ø×ÑÐ%Ü!3Ó!5ˆDÔÜ�K‰KÐSÕTÜ˜×*Ñ*¬DÔ1Ü!3Ñ!I°d×6HÑ6HÑ!IˆDÔà×ÑÐ#Ü/Ó1ˆDÔÜ�K‰KÐOÕPÜ˜×(Ñ(¬$Ô/Ü/ÑC°$×2BÑ2BÑCˆDÔä‰ÑÑ' Ó'r4   )r=   r>   r?   r@   rA   rC   rN   r
   Úsub_configsr   rg   r   rE   rP   rm   rD   r.   rK   rL   s   @r3   rj   rj   •   sh   ø… ñð, €JàÐ-ð€Mð #3ÐEWÑX€Kà48€M�4Ð*Ñ*¨TÑ1Ó8Ø26€K�Ð(Ñ(¨4Ñ/Ó6Ø#Ð�sÓ#÷(ð (r4   rj   )rj   rN   r
   N)r@   Úhuggingface_hub.dataclassesr   Úconfiguration_utilsr   Úutilsr   r   Ú
get_loggerr=   ro   r
   rN   rj   Ú__all__r,   r4   r3   ú<module>rx      s³   ðñ !å .å 3ß ,ð 
ˆ×	Ñ	˜HÓ	%€ñ Ð<Ô=ØôE1Ð)ó E1ó ó >ðE1ñP Ð<Ô=Øô.(Ð'ó .(ó ó >ð.(ñb Ð<Ô=Øô.(Ð#ó .(ó ó >ð.(òb E�r4   