
    fTh1                     ,    S SK Jr   " S S\5      rS/rg)   )PretrainedConfigc                      ^  \ rS rSrSrSrS/r                                    SU 4S jjrSrU =r	$ )Zamba2Config   a  
This is the configuration class to store the configuration of a [`Zamba2Model`]. It is used to instantiate a
Zamba2 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 Zamba2 model.

[Zyphra/Zamba2-2.7B](https://huggingface.co/Zyphra/Zamba2-2.7B)

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 32000):
        Vocabulary size of the Zamba2 model. Defines the number of different tokens that can be represented by the
        `inputs_ids` passed when calling [`Zamba2Model`]
    max_position_embeddings (`int`, *optional*, defaults to 4096):
        The maximum sequence length that this model might ever be used with.
    hidden_size (`int`, *optional*, defaults to 2560):
        Dimension of the hidden representations.
    num_hidden_layers (`int`, *optional*, defaults to 54):
        Number of hidden layers in the model.
    layers_block_type (`list`, *optional*):
        List of layer types, which can be either "mamba" or "hybrid".
    mamba_d_state (`int`, *optional*, defaults to 64): shape of the state space latents.
    mamba_d_conv (`int`, *optional*, defaults to 4): Size of the convolution kernel.
    mamba_expand (`int`, *optional*, defaults to 2): Expanding factor used to determine the intermediate size.
    mamba_ngroups (`int`, *optional*, defaults to 1):
        Number of groups for the evolution matrices of mamba 2.
    time_step_min (`float`, *optional*, defaults to 0.001):
        Minimum `time_step` used to bound `dt_proj.bias`.
    time_step_max (`float`, *optional*, defaults to 0.1):
        Maximum `time_step` used to bound `dt_proj.bias`.
    time_step_floor (`float`, *optional*, defaults to 0.0001):
        Minimum clamping value of the `dt_proj.bias` layer initialization.
    time_step_limit (`tuple`, *optional*):
        Accepted range of time step values.
    n_mamba_heads (`int`, *optional*, defaults to 8):
        Number of heads for the evolution matrices of mamba 2.
    use_conv_bias (`bool`, *optional*, defaults to `True`):
        Whether or not to use bias in the convolution layer of the mixer block.
    chunk_size (`int`, *optional*, defaults to 256):
        Size of the chunks that will comprise the sequence.
    use_mem_eff_path (`bool`, *optional*, defaults to `False`):
        Whether or not to use the fused conv1d and scan in mamba2 layers.
    add_bias_linear (`bool`, *optional*, defaults to `False`):
        Flag indicating whether or not to use bias in various layers
    intermediate_size (`int`, *optional*, defaults to 4 * hidden_size):
        Dimension of the MLP representations.
    hidden_act (`str`, *optional*, defaults to `"gelu"`):
        The non-linear activation function (function or string) in the MLP.
    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*):
        This is the number of key_value heads that should be used to implement Grouped Query Attention. If
        `num_key_value_heads=None`, 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 checkout [this
        paper](https://arxiv.org/pdf/2305.13245.pdf).
    attention_dropout (`float`, *optional*, defaults to 0.0):
        The dropout ratio for the attention probabilities.
    num_mem_blocks (`int`, *optional*, defaults to 1):
        Number of unshared transformer blocks.
    use_shared_attention_adapter (`bool`, *optional*, defaults to `False`):
        If True, unshared adapters (formally the same as LoRA but used in the base model) will be added to the q, k, v projectors in the shared attention layers.
    adapter_rank (`int`, *optional*, defaults to 128):
        Rank of the adapter in the shared MLP and shared attention layers.
    use_mem_rope (`bool`, *optional*, defaults to `False`):
        If True, includes RoPE in the shared attention layers.
    rope_theta (`float`, *optional*, defaults to `10000.0`):
        The base period of the RoPE embeddings.
    initializer_range (`float`, *optional*, defaults to 0.02):
        The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
    rms_norm_eps (`float`, *optional*, defaults to 1e-05):
        The epsilon used by the rms normalization layers.
    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`.
    num_logits_to_keep (`int` or `None`, *optional*, defaults to 1):
        Number of prompt logits to calculate during generation. If `None`, all logits will be calculated. If an
        integer value, only last `num_logits_to_keep` logits will be calculated. Default is 1 because only the
        logits of the last prompt token are needed for generation. For long sequences, the logits for the entire
        sequence may use a lot of memory so, setting `num_logits_to_keep=1` will reduce memory footprint
        significantly.
    pad_token_id (`int`, *optional*, defaults to 0):
        The id of the padding token.
    bos_token_id (`int`, *optional*, defaults to 1):
        The id of the "beginning-of-sequence" token.
    eos_token_id (`int`, *optional*, defaults to 2):
        The id of the "end-of-sequence" token.
    use_long_context (`bool`, *optional*, defaults to `False`):
        Activates the context-extended version of Zamba by modifying RoPE.
```python
>>> from transformers import Zamba2Model, Zamba2Config
>>> # Initializing a Zamba2-2.7B style configuration
>>> configuration = Zamba2Config()
>>> # Initializing a model from the Zamba2-2.7B style configuration
>>> model = Zamba2Model(configuration)
>>> # Accessing the model configuration
>>> configuration = model.config
```zamba2past_key_valuesc%                 Z  > [         T)U ]  " SU!U"U#S.U%D6  Xl        X l        X0l        Uc  SU-  U l        OUU l        UU l        X@l        UU l        UU l	        SU-  U l
        SU R                  -  U R                  -  U l        UU l        UU l        U$U l        U(       a+  U$(       a$  Sn&UU&U R                  U R                  S-
  -  -  -  nUU l        X`l        Xpl        Xl        UU l        Xl        Xl        [-        X-  5      U-  U l        Xl        UU l        Xl        UU l        UU l        Xl        Xl        Xl        U$(       a  SU l        Uc  UnUU l         UU l        U R                  U R                  -  U l!        U R                  U l"        Uc4  S/S/S-  S/-   S	-  -   S/S-  -   S/-   S/S
-  -   S/-   S/S-  -   U l#        OXPl#        UU l$        UU l%        UU l&        U U l'        [Q        U RF                  5       V'V(s/ s H  u  n'n(U(S:X  d  M  U'PM     sn(n'U l)        UU l*        g s  sn(n'f )N)pad_token_idbos_token_ideos_token_id         i @  mamba   hybrid   r    )+super__init__
vocab_sizemax_position_embeddingshidden_sizeintermediate_size
hidden_actnum_hidden_layersnum_attention_headsnum_mem_blocksattention_hidden_sizeattention_head_dimattention_dropoutuse_mem_ropeuse_long_context
rope_thetamamba_d_statemamba_d_convmamba_expandadd_bias_linearmamba_ngroupsn_mamba_headsintmamba_headdimuse_conv_bias
chunk_sizetime_step_limituse_shared_attention_adapteradapter_ranktime_step_mintime_step_maxtime_step_floornum_key_value_headskv_channelsnum_query_groupslayers_block_typeinitializer_rangerms_norm_eps	use_cachenum_logits_to_keep	enumeratehybrid_layer_idsuse_mem_eff_path)*selfr   r   r   r   r8   r%   r&   r'   r)   r2   r3   r4   r/   r*   r-   r.   r?   r(   r   r   r   r5   r!   r   r0   r1   r"   r$   r9   r:   r;   r<   r
   r   r   r#   kwargsaindextype	__class__s*                                            g/var/www/auris/envauris/lib/python3.13/site-packages/transformers/models/zamba2/configuration_zamba2.pyr   Zamba2Config.__init__   s   P 	 	
%%%	
 		
 %'>$&$%&_D"%6D"$!2#6 ,%&_""#d&6&6"6$:R:R"R!2( 0,A#aD,C,CtG^G^abGb,c&ddJ$*((.** !;<M*$.,H)(**.+0D(&"5#6 #6 ++t/G/GG $ 8 8$	9q=H:-23)a-  * )a-	 
 * )a-  " &7"!2(""4:CDDZDZ:[ p:[;5$_cgo_o:[ p 0 !qs   ?H'H')'r1   r(   r!   r    r   r.   r   r   r>   r9   r   r6   r8   r&   r%   r'   r,   r)   r   r*   r   r   r5   r<   r   r7   r:   r$   r4   r/   r3   r2   r;   r-   r#   r?   r"   r0   r   )$i }  i   i 
  6   N@   r   r      gMbP?g?g-C6?Nr   T   FFNgelu    Ng        rJ   F   Fi'  g{Gz?gh㈵>TrJ       rJ   r   F)
__name__
__module____qualname____firstlineno____doc__
model_typekeys_to_ignore_at_inferencer   __static_attributes____classcell__)rE   s   @rF   r   r      s    bH J#4"5  $ %*Kk1 k1    r   N)configuration_utilsr   r   __all__r   rY   rF   <module>r\      s$   . 4S1# S1l 
rY   