§
    ‚ŠtjP"  ã                   óN  — d Z ddlmZ ddlmZ ddlmZmZ  e¦   «         rddlm	Z	m
Z
mZmZmZmZmZmZ dZnBddlmZ ed	         Z	ed
         Z
ed         Zed         Zed         Zed         Zdededefd„ZdZ ed¬¦  «        e G d„ de¦  «        ¦   «         ¦   «         ZdgZdS )zxLSTM configuration.é    )Ústricté   )ÚPreTrainedConfig)Úauto_docstringÚis_xlstm_available)ÚBackendModeTypeÚChunkwiseKernelTypeÚ	DtypeTypeÚSequenceKernelTypeÚStepKernelTypeÚWeightModeTypeÚround_up_to_next_multiple_ofÚxLSTMLargeConfigT)ÚLiteral)ÚtrainÚtrain_with_paddingÚ	inference)úchunkwise--native_autogradzparallel--native_autograd)Úfloat32Úbfloat16Úfloat16Únative_sequence__nativeÚnative)ÚsingleÚfusedÚxÚmultiple_ofÚreturnc                 ó8   — t          | |z   dz
  |z  |z  ¦  «        S )z0Rounds up x to the next multiple of multiple_of.é   )Úint)r   r   s     úk/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/transformers/models/xlstm/configuration_xlstm.pyr   r   1   s#   € å�Q˜‘_ qÑ(¨[Ñ8¸KÑGÑHÔHÐHó    FzNX-AI/xLSTM-7b)Ú
checkpointc                   óv  ‡ — e Zd ZU dZdZ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<   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<   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$<   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d0<   d1Z(e)ed2<   dZ*eed3<   d4Z+edz  ed5<   d6Z,edz  ed7<   d8Z-ee.e         z  dz  ed9<   d:Z/eed;<   ˆ fd<„Z0e1d=„ ¦   «         Z2e1d>„ ¦   «         Z3e1d?„ ¦   «         Z4e1d@„ ¦   «         Z5dA„ Z6ˆ xZ7S )BÚxLSTMConfigaN  
    num_blocks (int, optional, *optional*, defaults to 32):
        Number of blocks of the xLSTM model, use num_hidden_layers if None.
    num_heads (int, optional, *optional*, defaults to 8):
        Number of heads for the xLSTM Layer/Cell.
    use_bias (bool, optional, *optional*, defaults to `False`):
        Whether to use biases in the xLSTM model.
    norm_reduction_force_float32 (bool, optional, *optional*, defaults to `True`):
        Whether to force the float32 norm reduction op to be done in fp32 precision.
    add_out_norm (bool, optional, *optional*, defaults to `True`):
        Whether to add an output norm after the blocks before the LMHead.
    qk_dim_factor (float, optional, *optional*, defaults to 0.5):
        Scale factor for the query and key dimension.
    v_dim_factor (float, optional, *optional*, defaults to 1.0):
        Scale factor for the value dimension.
    chunkwise_kernel (ChunkwiseKernelType, optional, *optional*, defaults to `"chunkwise--native_autograd"`):
        Kernel type for chunkwise processing mode.
    sequence_kernel (SequenceKernelType, optional, *optional*, defaults to `"native_sequence__native"`):
        Kernel type for sequence processing mode.
    step_kernel (StepKernelType, optional, *optional*, defaults to `"native"`):
        Kernel type for step processing mode.
    mode (BackendModeType, optional, *optional*, defaults to `"inference"`):
        Operation mode (inference is needed for generation).
    chunk_size (int, optional, *optional*, defaults to 64):
        Internal chunk size.
    return_last_states (bool, optional, *optional*, defaults to `True`):
        If to return the last states / cache internally. Needed as True for generation.
    autocast_kernel_dtype (DtypeType, optional, *optional*, defaults to `"bfloat16"`):
        Kernel dtype for the states.
    inference_state_dtype (DtypeType, optional, *optional*, defaults to `"float32"`):
        Kernel dtype for states in inference.
    ffn_proj_factor (float, optional, *optional*, defaults to 2.667):
        Size factor of the post-up projection gated Feed Forward network.
    ffn_round_up_to_multiple_of (int, optional, *optional*, defaults to 64):
        Size factor round value of the post-up projection gated Feed Forward network.
    gate_soft_cap (float, optional, *optional*, defaults to 15.0):
        Gate soft cap scale.
    output_logit_soft_cap (float, optional, *optional*, defaults to 30.0):
        Output logit soft cap scale.
    weight_mode (`Literal`, *optional*, defaults to `"single"`):
        Whether parallel linear layers are separated or fused (single).
    max_inference_chunksize (int, optional, *optional*, defaults to 16384):
        Limit the chunk size for inference to save memory.

    Example:

    ```python
    >>> from transformers import xLSTMConfig, xLSTMModel

    >>> # Initializing a xLSTM configuration
    >>> configuration = xLSTMConfig()

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

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```Úxlstmi€Ä  Ú
vocab_sizei   Úhidden_sizeNÚembedding_dimé    Únum_hidden_layersÚ
num_blocksé   Ú	num_headsFÚuse_biasTÚnorm_reduction_force_float32Útie_word_embeddingsÚadd_out_normg�íµ ÷Æ°>Únorm_epsg      à?Úqk_dim_factorg      ð?Úv_dim_factorr   Úchunkwise_kernelr   Úsequence_kernelr   Ústep_kernelr   Úmodeé@   Ú
chunk_sizeÚreturn_last_statesr   Úautocast_kernel_dtypeÚepsr   Úinference_state_dtypeg¼t“V@Úffn_proj_factorÚffn_round_up_to_multiple_ofg      .@Úgate_soft_capg      >@Úoutput_logit_soft_capr   Úweight_modeÚ	use_cacher    Úpad_token_idr   Úbos_token_idé   Úeos_token_idi @  Úmax_inference_chunksizec                 ó
  •— | j         �| j         n| j        | _         | j        �| j        n| j         | _        | j        �| j        n| j        | _        | j        �| j        n| j        | _         t	          ¦   «         j        di |¤Ž d S )N© )r)   r*   r,   r-   ÚsuperÚ__post_init__)ÚselfÚkwargsÚ	__class__s     €r"   rO   zxLSTMConfig.__post_init__™   s‘   ø€ Ø/3Ô/?Ð/K˜4Ô+Ð+ÐQUÔQcˆÔØ37Ô3EÐ3Q˜TÔ/Ð/ÐW[ÔWgˆÔØ;?Ô;QÐ;] Ô!7Ð!7ÐcgÔcrˆÔØ-1¬_Ð-H˜$œ/˜/ÈdÔNdˆŒØ�‰ŒÔÐ'Ð' Ð'Ð'Ð'Ð'Ð'r#   c                 ó>   — t          | j        | j        z  d¬¦  «        S ©Nr;   )r   )r   r)   r5   ©rP   s    r"   Úqk_dimzxLSTMConfig.qk_dim    s*   € å+ØÔ˜tÔ1Ñ1Øð
ñ 
ô 
ð 	
r#   c                 ó>   — t          | j        | j        z  d¬¦  «        S rT   )r   r)   r6   rU   s    r"   Úv_dimzxLSTMConfig.v_dim§   s*   € å+ØÔ˜tÔ0Ñ0Øð
ñ 
ô 
ð 	
r#   c                 ó    — | j         | j        z  S ©N)rV   r/   rU   s    r"   Úqk_head_dimzxLSTMConfig.qk_head_dim®   s   € àŒ{˜dœnÑ,Ð,r#   c                 ó    — | j         | j        z  S rZ   )rX   r/   rU   s    r"   Ú
v_head_dimzxLSTMConfig.v_head_dim²   s   € àŒz˜Tœ^Ñ+Ð+r#   c                 ó¨  — t           rÊt          di d| j        “d| j        “d| j        “d| j        “d| j        “d| j        “d| j        “d| j	        “d	| j
        “d
| j        “d| j        “d| j        “d| j        “d| j        “d| j        “d| j        “d| j        “d| j        “d| j        “d| j        “d| j        “d| j        “d| j        “d| j        “ŽS | S )Nr(   r*   r-   r/   r0   r3   r4   r1   r5   r6   r7   r8   r9   r:   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rM   )Úexternal_xlstmr   r(   r)   r,   r/   r0   r3   r4   r1   r5   r6   r7   r8   r9   r:   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rU   s    r"   Úto_xlstm_block_configz!xLSTMConfig.to_xlstm_block_config¶   s–  € Ýð  	Ý#ð ð ð Øœ?˜?ðà"Ô.Ð.ðð  Ô1Ð1ðð œ.˜.ð	ð
 œ˜ðð "Ô.Ð.ðð œ˜ðð .2Ô-NÐ-Nðð #Ô0Ð0ðð "Ô.Ð.ðð "&Ô!6Ð!6ðð !%Ô 4Ð 4ðð !Ô,Ð,ðð  ”Y�Yð!ð"  œ?˜?ð#ð$ $(Ô#:Ð#:ð%ð& '+Ô&@Ð&@ð'ð( ”H�Hð)ð* '+Ô&@Ð&@ð+ð. !%Ô 4Ð 4ð/ð0 -1Ô,LÐ,Lð1ð4 #Ô0Ð0ð5ð6 '+Ô&@Ð&@ð7ð8 !Ô,Ð,ð9ð ð> ˆKr#   )8Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
model_typer(   r!   Ú__annotations__r)   r*   r,   r-   r/   r0   Úboolr1   r2   r3   r4   Úfloatr5   r6   r7   r	   r8   r   r9   r   r:   r   r<   r=   r>   r
   r?   r@   rA   rB   rC   rD   rE   r   rF   rG   rH   rJ   ÚlistrK   rO   ÚpropertyrV   rX   r[   r]   r`   Ú__classcell__)rR   s   @r"   r&   r&   8   sð  ø€ € € € € € ð9ð 9ðv €Jà€J�ÐÐÑØ€K�ÐÐÑØ $€M�3˜‘:Ð$Ð$Ñ$ØÐ�sÐÐÑØ!€J��d‘
Ð!Ð!Ñ!Ø€IˆsÐÐÑØ€HˆdÐÐÑØ)-Ð  $Ð-Ð-Ñ-Ø %Ð˜Ð%Ð%Ñ%Ø€L�$ÐÐÑØ€HˆeÐÐÑØ€M�5ÐÐÑØ€L�%ÐÐÑØ,HÐÐ)ÐHÐHÑHØ*C€OÐ'ÐCÐCÑCØ"*€K�Ð*Ð*Ñ*Ø'€Dˆ/Ð'Ð'Ñ'Ø€J�ÐÐÑØ#Ð˜Ð#Ð#Ñ#Ø'1Ð˜9Ð1Ð1Ñ1Ø€CˆÐÐÑØ'0Ð˜9Ð0Ð0Ñ0Ø"€O�UÐ"Ð"Ñ"Ø')Ð Ð)Ð)Ñ)Ø€M�5ÐÐÑØ#'Ð˜5Ð'Ð'Ñ'Ø"*€K�Ð*Ð*Ñ*Ø€IˆtÐÐÑØ €L�#˜‘*Ð Ð Ñ Ø €L�#˜‘*Ð Ð Ñ Ø+,€L�#˜˜Sœ	‘/ DÑ(Ð,Ð,Ñ,Ø#(Ð˜SÐ(Ð(Ñ(ð(ð (ð (ð (ð (ð ð
ð 
ñ „Xð
ð ð
ð 
ñ „Xð
ð ð-ð -ñ „Xð-ð ð,ð ,ñ „Xð,ð!ð !ð !ð !ð !ð !ð !r#   r&   N)rd   Úhuggingface_hub.dataclassesr   Úconfiguration_utilsr   Úutilsr   r   Úxlstm.xlstm_large.modelr   r	   r
   r   r   r   r   r   r_   Útypingr   r!   r&   Ú__all__rM   r#   r"   ú<module>rr      sÁ  ðð Ð à .Ð .Ð .Ð .Ð .Ð .à 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7ð ÐÑÔð ð	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð €N€NàÐÐÐÐÐàÐHÔI€OØ!ð	%ôÐð Ð8Ô9€IØ Ð!:Ô;ÐØ˜XÔ&€NØÐ.Ô/€NðI¨ð I¸#ð IÀ#ð Ið Ið Ið Ið €Nð €Ð+Ð,Ñ,Ô,Øð]ð ]ð ]ð ]ð ]Ð"ñ ]ô ]ñ „ñ -Ô,ð]ð@ ˆ/€€€r#   