
    %	&hB                     <    d dl mZ ddlmZmZ  G d de      ZdgZy)   )PretrainedConfig   )CONFIG_MAPPING
AutoConfigc                   D     e Zd ZdZdZeedZdZ	 	 	 	 	 	 	 d fd	Z xZ	S )Mistral3Configa	  
    This is the configuration class to store the configuration of a [`Mistral3ForConditionalGeneration`]. It is used to instantiate an
    Mistral3 model according to the specified arguments, defining the model architecture. Instantiating a configuration
    with the defaults will yield a similar configuration to that of
    [mistralai/Mistral-Small-3.1-24B-Instruct-2503](https://huggingface.co/mistralai/Mistral-Small-3.1-24B-Instruct-2503)

    Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
    documentation from [`PretrainedConfig`] for more information.

    Args:
        vision_config (`Union[AutoConfig, dict]`,  *optional*, defaults to `PixtralVisionConfig`):
            The config object or dictionary of the vision backbone.
        text_config (`Union[AutoConfig, dict]`, *optional*, defaults to `MistralConfig`):
            The config object or dictionary of the text backbone.
        image_token_index (`int`, *optional*, defaults to 10):
            The image token index to encode the image prompt.
        projector_hidden_act (`str`, *optional*, defaults to `"gelu"`):
            The activation function used by the multimodal projector.
        vision_feature_layer (`Union[int, List[int]]`, *optional*, defaults to -1):
            The index of the layer to select the vision feature. If multiple indices are provided,
            the vision feature of the corresponding indices will be concatenated to form the
            vision features.
        multimodal_projector_bias (`bool`, *optional*, defaults to `False`):
            Whether to use bias in the multimodal projector.
        spatial_merge_size (`int`, *optional*, defaults to 2):
            The downsampling factor for the spatial merge operation.

    Example:

    ```python
    >>> from transformers import Mistral3ForConditionalGeneration, Mistral3Config, PixtralVisionConfig, MistralConfig

    >>> # Initializing a Pixtral-vision config
    >>> vision_config = PixtralVisionConfig()

    >>> # Initializing a Mistral config
    >>> text_config = MistralConfig()

    >>> # Initializing a Mistral3 configuration
    >>> configuration = Mistral3Config(vision_config, text_config)

    >>> # Initializing a model from the mistral3.1 configuration
    >>> model = Mistral3ForConditionalGeneration(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```mistral3)text_configvision_configTc                    t        	|   d*i | || _        || _        || _        t        |t              r d|v r|d   nd|d<   t        |d      d*i |}n|t        d   ddddddd	d
d	      }|| _        t        |t              r d|v r|d   nd|d<   t        |d      d*i |}n>|<t        d   d*i ddddddddddddddddddddd d!d"d#d$d%d&d d'd(d)d}|| _	        || _
        || _        y )+N
model_typepixtrali   i      i        i }  @   gelu)	intermediate_sizehidden_size
patch_size
image_sizenum_hidden_layersnum_attention_heads
vocab_sizehead_dim
hidden_actmistralattention_dropoutg        r      r   silur   i   initializer_rangeg{Gz?r   i   max_position_embeddingsi   r       r   (   num_key_value_heads   rms_norm_epsgh㈵>
rope_thetag    eAsliding_window	use_cacheTr    )super__init__image_token_indexprojector_hidden_actvision_feature_layer
isinstancedictr   r   r
   multimodal_projector_biasspatial_merge_size)
selfr   r
   r.   r/   r0   r3   r4   kwargs	__class__s
            /var/www/pru.catia.catastroantioquia-mas.com/valormas/lib/python3.12/site-packages/transformers/models/mistral3/configuration_mistral3.pyr-   zMistral3Config.__init__J   s    	"6"!2$8!$8!mT*IUYfIf-*EluM,'*=+FGX-XM"*95"& "$$& !
M +k4(EQU`E`L(AfoK%(\)BCRkRK (3 "% " !	
 #' #( )/ % %' #% %& # (  $   "!K& ')B&"4    )NN
   r   Fr   )
__name__
__module____qualname____doc__r   r   sub_configsis_compositionr-   __classcell__)r7   s   @r8   r   r      s@    .` J",zJKN #"'<5 <5r9   r   N)configuration_utilsr   autor   r   r   __all__r+   r9   r8   <module>rF      s'   " 4 -q5% q5h 
r9   