
    i\                         d dl m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)    )strict   )PreTrainedConfig)RopeParameters)auto_docstringzzai-org/GLM-4.1V-9B-Thinking)
checkpointc                   F   e Zd ZU 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z  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e   z  eeef   z  ed<   dZeed<   dZeed<   dZeed <   y!)"Glm4vVisionConfiga,  
    out_hidden_size (`int`, *optional*, defaults to 4096):
        The output hidden size of the vision model.

    Example:

    ```python
    >>> from transformers import Glm4vVisionConfig, Glm4vVisionModel

    >>> # Initializing a Glm4vVisionConfig GLM-4.1V-9B style configuration
    >>> configuration = Glm4vVisionConfig()

    >>> # Initializing a model (with random weights) from the GLM-4.1V-9B configuration
    >>> model = Glm4vVisionModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```glm4v_visionvision_config   depthi   hidden_sizesilu
hidden_actFattention_bias        attention_dropout   	num_headsr   in_channelsiP  
image_size   
patch_sizeh㈵>rms_norm_eps   spatial_merge_sizetemporal_patch_size   out_hidden_size5  intermediate_size{Gz?initializer_rangeN)__name__
__module____qualname____doc__
model_typebase_config_keyr   int__annotations__r   r   strr   boolr   floatr   r   r   listtupler   r   r   r   r!   r#   r%        ~/var/www/vps2.regionflexible.com/Desarrollo/venv/lib/python3.12/site-packages/transformers/models/glm4v/configuration_glm4v.pyr
   r
      s    &  J%OE3OKJ ND %(us{(IsK47Jd3i%S/1746Jd3i%S/16L%=>tCy5c?:>OS"s"#u#r4   r
   c                   R    e Zd ZU dZdZdZdgZddddddd	Zd
gdgfddgdgfdgdgfdZdh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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z  ed(<   dZeez  dz  ed)<   dZedz  ed*<    fd+Z xZ S ),Glm4vTextConfiga  
    Example:

    ```python
    >>> from transformers import Glm4vTextModel, Glm4vConfig

    >>> # Initializing a GLM-4.1V style configuration
    >>> configuration = Glm4vConfig()

    >>> # Initializing a model from the GLM-4.1V style configuration
    >>> model = Glm4vTextModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```
glm4v_texttext_configpast_key_valuescolwiserowwisecolwise_gather_outputrowwise_split_input)zlayers.*.self_attn.q_projzlayers.*.self_attn.k_projzlayers.*.self_attn.v_projzlayers.*.self_attn.o_projzlayers.*.mlp.gate_up_projzlayers.*.mlp.down_proj	input_idsinputs_embedshidden_statesattention_mask)embed_tokenslayersnormmrope_sectioni P 
vocab_sizer    r   r"   r#   (   num_hidden_layers    num_attention_headsr   Nnum_key_value_headsr   r   i   max_position_embeddingsr$   r%   r   r   T	use_cacher   r   rope_parameterspad_token_idc                 ^    | j                   | j                  | _         t        |   di | y )Nr3   )rL   rK   super__post_init__selfkwargs	__class__s     r5   rS   zGlm4vTextConfig.__post_init__z   s-    ##+'+'?'?D$''r4   )!r&   r'   r(   r)   r*   r+   keys_to_ignore_at_inferencebase_model_tp_planbase_model_pp_planignore_keys_at_rope_validationrG   r,   r-   r   r#   rI   rK   rL   r   r.   rM   r%   r0   r   rN   r/   r   rO   r   dictrP   rS   __classcell__rW   s   @r5   r7   r7   E   s-     J#O#4"5 &/%.%.%.%<"7 &(9:#%568IJ!"_$56
 '6%6"JK"s"s!!&'t'J#(S(#u#L%It%(us{(48O^d*T18#L#*#( (r4   r7   c                        e Zd ZU dZdZeedZdgZdZ	e
ez  dz  ed<   dZ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d<   dZeed<   dZeed<    fdZ xZS )Glm4vConfiga  
    image_start_token_id (`int`, *optional*, defaults to 151339):
        The image start token index to encode the start of image.
    image_end_token_id (`int`, *optional*, defaults to 151340):
        The image end token index to encode the end of image.
    video_start_token_id (`int`, *optional*, defaults to 151341):
        The video start token index to encode the start of video.
    video_end_token_id (`int`, *optional*, defaults to 151342):
        The video end token index to encode the end of video.

    ```python
    >>> from transformers import Glm4vForConditionalGeneration, Glm4vConfig

    >>> # Initializing a GLM-4.1V style configuration
    >>> configuration = Glm4vConfig()

    >>> # Initializing a model from the GLM-4.1V style configuration
    >>> model = Glm4vForConditionalGeneration(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```glm4v)r   r9   r:   Nr9   r   i/O image_token_idi0O video_token_idi+O image_start_token_idi,O image_end_token_idi-O video_start_token_idi.O video_end_token_idFtie_word_embeddingsc                    t        | j                  t              r% | j                  d   di | j                  | _        n&| j                   | j                  d   di || _        t        | j                  t              r% | j                  d   di | j                  | _        n&| j                   | j                  d   di || _        t        |   di | y )Nr   r9   r3   )
isinstancer   r\   sub_configsr9   rR   rS   rT   s     r5   rS   zGlm4vConfig.__post_init__   s    d(($/!B!1!1/!B!XTEWEW!XD'!B!1!1/!B!LV!LDd&&->t//>RAQAQRD%>t//>HHD''r4   )r&   r'   r(   r)   r*   r
   r7   rk   rX   r9   r\   r   r-   r   rb   r,   rc   rd   re   rf   rg   rh   r/   rS   r]   r^   s   @r5   r`   r`      s    . J$5oVK#4"526K((4/648M4**T18 NC  NC  &#&$$ &#&$$ %%( (r4   r`   )r`   r7   r
   N)huggingface_hub.dataclassesr   configuration_utilsr   modeling_rope_utilsr   utilsr   r
   r7   r`   __all__r3   r4   r5   <module>rq      s   ( / 3 1 # 9:%$( %$  ;%$P 9:7(& 7(  ;7(t 9:1(" 1(  ;1(h Br4   