
    .`iZ                     @    d dl mZ d dlmZ  G d de          ZdgZdS )    )Any)PretrainedConfigc            2            e Zd ZdZdZdgZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d.dedededededededededee	e
f         dz  ded ed!ed"ed#ed$ed%ed&ed'ed(ed)ed*ed+ed,ee	         dz  f0 fd-Z xZS )/Lfm2MoeConfiga  
    This is the configuration class to store the configuration of a [`Lfm2MoeModel`]. It is used to instantiate a LFM2 Moe
    model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
    defaults will yield a similar configuration to that of the LFM2-8B-A1B model.
    e.g. [LiquidAI/LFM2-8B-A1B](https://huggingface.co/LiquidAI/LFM2-8B-A1B)

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


    Args:
        vocab_size (`int`, *optional*, defaults to 65536):
            Vocabulary size of the LLaMA model. Defines the number of different tokens that can be represented by the
            `inputs_ids` passed when calling [`Lfm2Model`]
        hidden_size (`int`, *optional*, defaults to 2048):
            Dimension of the hidden representations.
        intermediate_size (`int`, *optional*, defaults to 7168):
            Dimension of the MLP representations.
        moe_intermediate_size (`int`, *optional*, defaults to 1792):
            Intermediate size of the routed expert.
        num_hidden_layers (`int`, *optional*, defaults to 32):
            Number of hidden layers in the Transformer decoder.
        pad_token_id (`int`, *optional*, defaults to 0):
            Padding token id.
        bos_token_id (`int`, *optional*, defaults to 1):
            Beginning of stream token id.
        eos_token_id (`int`, *optional*, defaults to 2):
            End of stream token id.
        tie_word_embeddings (`bool`, *optional*, defaults to `True`):
            Whether to tie weight embeddings
        rope_parameters (`dict`, *optional*):
            The parameters of the RoPE embeddings.
        max_position_embeddings (`int`, *optional*, defaults to 128000):
            The maximum sequence length that this model might ever be used with.
        use_cache (`bool`, *optional*, defaults to `True`):
            Whether or not the model should return the last key/values attentions (not used by all models). Only
            relevant if `config.is_decoder=True`.
        norm_eps (`float`, *optional*, defaults to 1e-05):
            The epsilon used by the rms normalization layers.
        num_attention_heads (`int`, *optional*, defaults to 32):
            Number of attention heads for each attention layer in the Transformer decoder.
        num_key_value_heads (`int`, *optional*, defaults to 8):
            This is the number of key_value heads that should be used to implement Grouped Query Attention. If
            `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
            `num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
            converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
            by meanpooling all the original heads within that group. For more details, check out [this
            paper](https://huggingface.co/papers/2305.13245). If it is not specified, will default to
            `num_attention_heads`.
        conv_bias (`bool`, *optional*, defaults to `False`):
            Whether to use bias in the conv layers.
        conv_L_cache (`int`, *optional*, defaults to 3):
            L_cache dim in the conv layers.
        num_dense_layers (`int`, *optional*, defaults to 2):
            Number of dense Lfm2MoeMLP layers in shallow layers(embed->dense->dense->...->dense->moe->moe...->lm_head).
        num_experts_per_tok (`int`, *optional*, defaults to 4):
            Number of selected experts.
        num_experts (`int`, *optional*, defaults to 32):
            Number of routed experts.
        use_expert_bias (`bool`, *optional*, defaults to `True`):
            Whether to use the expert bias on the routing weights.
        routed_scaling_factor (`float`, *optional*, defaults to 1.0):
            Scaling factor for routed experts in MoE models.
        norm_topk_prob (`bool`, *optional*, defaults to `True`):
            Whether to normalize the topk probabilities.
        layer_types (`Optional`, *optional*):
            Type of each layers.

    ```python
    >>> from transformers import Lfm2MoeModel, Lfm2MoeConfig

    >>> # Initializing a LFM2 Moe model
    >>> configuration = Lfm2MoeConfig()

    >>> # Initializing a model from the LFM2-8B-A1B style configuration
    >>> model = Lfm2MoeModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```lfm2_moepast_key_values                r         TN  h㈵>   F            ?
vocab_sizehidden_sizeintermediate_sizemoe_intermediate_sizenum_hidden_layerspad_token_idbos_token_ideos_token_idtie_word_embeddingsrope_parametersmax_position_embeddings	use_cachenorm_epsnum_attention_headsnum_key_value_heads	conv_biasconv_L_cachenum_dense_layersnum_experts_per_toknum_expertsuse_expert_biasrouted_scaling_factornorm_topk_problayer_typesc                    || _         || _        || _        || _        |                    dd          }|
d|d}
|
| _        || _        || _        || _        || _	        || _
        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        |                    d|	          }	 t-                      j        d||||	d| d S )N
rope_thetag    .Adefault)	rope_typer/   tie_embedding)r   r   r   r    )r   r   r   r   popr   r    r!   r"   r#   r$   r%   r&   r'   r   r(   r)   r*   r+   r,   r-   getsuper__init__)selfr   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   kwargsr/   	__class__s                              |/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/vllm/transformers_utils/configs/lfm2_moe.pyr7   zLfm2MoeConfig.__init__]   s.   8 %&!2!2ZZi88
",5ZPPO.'>$"  $7 #6  #( !1%:"#6 &.%:",&$jj0
 
 	 	
%%% 3		
 	

 	
 	
 	
 	
 	
    )r	   r
   r   r   r   r   r   r   TNr   Tr   r   r   Fr   r   r   r   Tr   TN)__name__
__module____qualname____doc__
model_typekeys_to_ignore_at_inferenceintbooldictstrr   floatlistr7   __classcell__)r:   s   @r;   r   r      s       O Ob J#4"5  !%%)!#$(15'.!#%#$ !#$ $'*#(,3C
 C
C
 C
 	C

  #C
 C
 C
 C
 C
 "C
 c3h$.C
 "%C
 C
 C
 !C
  !!C
" #C
$ %C
& 'C
( !)C
* +C
, -C
.  %/C
0 1C
2 #Y%3C
 C
 C
 C
 C
 C
 C
 C
 C
 C
r<   r   N)typingr    transformers.configuration_utilsr   r   __all__r3   r<   r;   <module>rM      sm          = = = = = =X
 X
 X
 X
 X
$ X
 X
 X
v 
r<   