Ë
    ÛÓ^jà  ã                   óê   — d Z ddlmZ ddlmZ ddlmZ ddlmZ e edd¬	«       G d
„ de«      «       «       Z	e edd¬	«       G d„ de«      «       «       Z
 ed¬«      e G d„ de«      «       «       ZdgZy)zDBRX model configurationé    )Ústricté   )ÚPreTrainedConfig)ÚRopeParameters)Úauto_docstringz4This config is used to instantiate attention layers.z$transformers-community/dbrx-instruct)Úcustom_introÚ
checkpointc                   óR   — e Zd ZU dZdZdZeez  ed<   dZ	eez  dz  ed<   dZ
eed<   y)	ÚDbrxAttentionConfigaz  
    attn_pdrop (`float`, *optional*, defaults to 0.0):
        The dropout probability for the attention layers.
    clip_qkv (`float`, *optional*):
        If set, clip the queries, keys, and values in the attention layer to this value.
    kv_n_heads (`int`, *optional*, defaults to 1):
        For grouped_query_attention only, allow user to specify number of kv heads.
    Úattn_configç        Ú
attn_pdropNÚclip_qkvé   Ú
kv_n_heads)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úbase_config_keyr   ÚfloatÚintÚ__annotations__r   r   © ó    úv/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/transformers/models/dbrx/configuration_dbrx.pyr   r      s9   … ñð $€Oà!€J�˜‘Ó!Ø#'€Hˆc�E‰k˜DÑ Ó'Ø€J�Ôr   r   z6This config is used to instantiate feedforward layers.c                   óª   ‡ — e Zd ZU dZdZ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dz  ed<   dZeed<   dZedz  ed<   ˆ fd„Zˆ xZS )ÚDbrxFFNConfiga  
    ffn_act_fn (`dict`, *optional*, defaults to `None`):
        A dict specifying activation function for the FFN.
        The dict should have a key 'name' with the value being the name of the activation function along with
        any additional keyword arguments. If `None`, then set to `{"name": "silu"}`.
    ffn_hidden_size (`int`, *optional*, defaults to 3584):
        The hidden size of the feedforward network.
    moe_num_experts (`int`, *optional*, defaults to 4):
        The number of experts in the mixture of experts layer.
    moe_top_k (`int`, *optional*, defaults to 1):
        The number of experts to use in the mixture of experts layer.
    moe_jitter_eps (`float`, *optional*, defaults to `None`):
        If not `None`, the jitter epsilon for the mixture of experts layer.
    moe_loss_weight (`float`, *optional*, defaults to 0.01):
        The loss weight for the mixture of experts layer.
    moe_normalize_expert_weights (`float`, *optional*, defaults to 1.0):
        The normalization factor for the expert weights.
    Ú
ffn_configi   Úhidden_sizeNÚ
ffn_act_fni   Úffn_hidden_sizeé   Úmoe_num_expertsr   Ú	moe_top_kÚmoe_jitter_epsg{®Gáz„?Úmoe_loss_weightg      ð?Úmoe_normalize_expert_weightsc                 óÀ   •— | j                   €	ddi| _         dD ]  }||v sŒ|j                  |«       Œ t        |«      dk7  rt        d|›�«      ‚t	        ‰| �  di |¤Ž y )NÚnameÚsilu)Ú
model_typeÚattn_implementationÚexperts_implementationÚtransformers_versionÚ_commit_hashÚtorch_dtypeÚdtyper   zFound unknown kwargs=r   )r!   ÚpopÚlenÚ
ValueErrorÚsuperÚ__post_init__)ÚselfÚkwargsÚkÚ	__class__s      €r   r7   zDbrxFFNConfig.__post_init__Q   so   ø€ Ø�?‰?Ð"Ø% vÐ.ˆDŒOð
ò 
	ˆAð �FŠ{Ø—
‘
˜1•ð
	ô ˆv‹;˜!ÒÜÐ5¨f¨YÐ7Ó8Ð8ä‰ÑÑ' Ó'r   )r   r   r   r   r   r    r   r   r!   Údictr"   r$   r%   r&   r   r'   r(   r7   Ú__classcell__©r;   s   @r   r   r   -   sv   ø… ñð& #€Oà€K�ÓØ"€J��t‘Ó"Ø€O�SÓØ€O�SÓØ€IˆsÓØ#'€N�E˜D‘LÓ'Ø!€O�UÓ!Ø14Ð  %¨$¡,Ó4÷(ð (r   r   )r	   c                   ó   ‡ — e Zd ZU dZdZeedœZdddddœZd	Z	e
d
z  ed<   dZe
d
z  ed<   dZe
d
z  ed<   d	Ze
d
z  ed<   dZe
ed<   dZed
z  ed<   dZed
z  ed<   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d
z  ed<   d
Zeez  d
z  ed<   d
Ze
d
z  ed<   d
Ze
d
z  ed<   d
Ze
ee
   z  d
z  ed<   dZ eed<   ˆ fd„Z!d „ Z"ˆ xZ#S )!Ú
DbrxConfigaä  
    max_seq_len (`int`, *optional*, defaults to 2048):
        The maximum sequence length of the model.
    attn_config (`dict`, *optional*):
        A dictionary used to configure the model's attention module.
    ffn_config (`dict`, *optional*):
        A dictionary used to configure the model's FFN module.

    Example:
    ```python
    >>> from transformers import DbrxConfig, DbrxModel

    >>> # Initializing a Dbrx configuration
    >>> configuration = DbrxConfig(n_layers=2, d_model=256, n_heads=8, vocab_size=128)

    >>> # Initializing a model (with random weights) from the configuration
    >>> model = DbrxModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```
    Údbrx)r   r   Ún_headsÚd_modelÚn_layersÚmax_seq_len)Únum_attention_headsr    Únum_hidden_layersÚmax_position_embeddingsi   Né   é   i }  Ú
vocab_sizer   Úresid_pdropÚ	emb_pdropr   r   TÚ	use_cacheg{®Gáz”?Úinitializer_rangeFÚoutput_router_logitsÚrope_parametersÚpad_token_idÚbos_token_idÚeos_token_idÚtie_word_embeddingsc                 óš  •— | j                   €t        «       | _         n4t        | j                   t        «      rt        di | j                   ¤Ž| _         | j                  €t        «       | _        n4t        | j                  t        «      rt        di | j                  ¤Ž| _        | j                   j                  | _        t        ‰| �$  di |¤Ž y )Nr   )
r   r   Ú
isinstancer<   r   r   r   Únum_key_value_headsr6   r7   )r8   r9   r;   s     €r   r7   zDbrxConfig.__post_init__›   s˜   ø€ Ø×ÑÐ#Ü2Ó4ˆDÕÜ˜×(Ñ(¬$Ô/Ü2ÑF°T×5EÑ5EÑFˆDÔà�?‰?Ð"Ü+›oˆD�OÜ˜Ÿ™¬Ô.Ü+Ñ>¨d¯o©oÑ>ˆDŒOà#'×#3Ñ#3×#>Ñ#>ˆÔ Ü‰ÑÑ' Ó'r   c                 ó2   — | j                   rt        d«      ‚y)zOPart of `@strict`-powered validation. Validates the architecture of the config.z5tie_word_embeddings is not supported for DBRX models.N)rU   r5   )r8   s    r   Úvalidate_architecturez DbrxConfig.validate_architecture©   s   € à×#Ò#ÜÐTÓUÐUð $r   )$r   r   r   r   r,   r   r   Úsub_configsÚattribute_maprC   r   r   rB   rD   rE   rK   rL   r   rM   r   r<   r   rN   ÚboolrO   rP   rQ   r   rR   rS   rT   ÚlistrU   r7   rZ   r=   r>   s   @r   r@   r@   f   s6  ø… ñð. €JØ"5À]ÑS€Kà(Ø Ø'Ø#0ñ	€Mð €GˆS�4‰ZÓØ€GˆS�4‰ZÓØ€Hˆc�D‰jÓØ"€K��t‘Ó"Ø€J�ÓØ #€K�˜‘Ó#Ø!€Iˆu�t‰|Ó!Ø59€KÐ$ tÑ+¨dÑ2Ó9Ø.2€J� Ñ$ tÑ+Ó2Ø€IˆtÓØ#Ð�uÓ#Ø(-Ð˜$ ™+Ó-Ø48€O�^ dÑ*¨TÑ1Ó8Ø#€L�#˜‘*Ó#Ø#€L�#˜‘*Ó#Ø+/€L�#˜˜S™	‘/ DÑ(Ó/Ø %Ð˜Ó%ô(öVr   r@   N)r   Úhuggingface_hub.dataclassesr   Úconfiguration_utilsr   Úmodeling_rope_utilsr   Úutilsr   r   r   r@   Ú__all__r   r   r   ú<module>rd      s°   ðñ å .å 3Ý 1Ý #ð ÙØGØ5ôôÐ*ó ó	ó ð
ð" ÙØIØ5ôô1(Ð$ó 1(ó	ó ð
1(ñh ÐAÔBØôDVÐ!ó DVó ó CðDVðN ˆ.�r   