Ë
    ÜÓ^j^  ã                   ó–   — d dl Zd dlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ dd	lmZmZ  e	d
¬«      e G d„ de«      «       «       ZdgZy)é    N)Ústricté   )ÚPreTrainedConfig)ÚRopeParameters)Úauto_docstring)Úintervalé   )ÚCONFIG_MAPPINGÚ
AutoConfigzHKUSTAudio/xcodec2-hf)Ú
checkpointc                   ó  ‡ — e Zd ZU dZdZdg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ed<   dZeed<     ed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z  dz  ed<   dZeed<   dZeez  dz  ed<   dZeed <   d!eiZd"Zeed#<   d$Z e!e   e"ed%f   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   e"ed%f   z  ed.<   ˆ fd/„Z)d0„ Z*e+d1efd2„«       Z,e+d1efd3„«       Z-ˆ xZ.S )4ÚXcodec2Configa©  
    downsampling_ratios (`list[int]`, *optional*, defaults to `[2, 2, 4, 4, 5]`):
        Ratios for downsampling in the encoder.
    semantic_model_config (`Union[Dict, Wav2Vec2BertConfig]`, *optional*):
        An instance of the configuration object for the semantic (Wav2Vec2BertConfig) model.
    quantization_dim (`int`, *optional*, defaults to 2048):
        Dimension for the vector quantization codebook.
    quantization_levels (`list[int]`, *optional*, defaults to `[4, 4, 4, 4, 4, 4, 4, 4]`):
        Levels for the vector quantization codebook.

    Example:

    ```python
    >>> from transformers import Xcodec2Config, Xcodec2Model

    >>> # Initializing configuration
    >>> configuration = Xcodec2Config()

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

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```Úxcodec2Úpast_key_valuesi   Úhidden_sizei   Úintermediate_sizeé   Únum_hidden_layersé   Únum_attention_headsÚnum_key_value_headsÚsiluÚ
hidden_actÚmax_position_embeddingsg        g      ð?)ÚminÚmaxg{®Gáz”?)ÚdefaultÚinitializer_rangeg�íµ ÷Æ°>Úrms_norm_epsNÚpad_token_idFÚtie_word_embeddingsÚrope_parametersÚattention_biasÚattention_dropouté@   Úhead_dimÚsemantic_model_configé0   Úencoder_hidden_size)r	   r	   é   r*   é   .Údownsampling_ratiosi€>  Úsampling_rategš™™™™™¹?Úactivation_dropouti   Úquantization_dim)r*   r*   r*   r*   r*   r*   r*   r*   Úquantization_levelsc                 óÎ  •— t        | j                  t        «      rT| j                  j                  dd«      | j                  d<   t	        | j                  d      di | j                  ¤Ž| _        n | j                  €t	        d   d¬«      | _        | j
                  €| j                  | j                  z  | _        | j                  €| j                  | _        t        ‰| �(  di |¤Ž y )NÚ
model_typezwav2vec2-bertr   )r   © )Ú
isinstancer'   ÚdictÚgetr
   r&   r   r   r   ÚsuperÚ__post_init__)ÚselfÚkwargsÚ	__class__s     €ú|/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/transformers/models/xcodec2/configuration_xcodec2.pyr8   zXcodec2Config.__post_init__V   sÑ   ø€ Ü�d×0Ñ0´$Ô7Ø7;×7QÑ7Q×7UÑ7UÐVbÐdsÓ7tˆD×&Ñ& |Ñ4Ü)7¸×8RÑ8RÐS_Ñ8`Ñ)añ *Ø×,Ñ,ñ*ˆDÕ&ð ×'Ñ'Ð/Ü)7¸Ñ)HÐ[]Ô)^ˆDÔ&Ø�=‰=Ð Ø ×,Ñ,°×0HÑ0HÑHˆDŒMØ×#Ñ#Ð+Ø'+×'?Ñ'?ˆDÔ$ä‰ÑÑ' Ó'ó    c                 óˆ   — | j                   | j                  z  dk7  r&t        d| j                   › d| j                  › d�«      ‚y)zOPart of `@strict`-powered validation. Validates the architecture of the config.r   zThe hidden size (z6) is not a multiple of the number of attention heads (z).N)r   r   Ú
ValueError©r9   s    r<   Úvalidate_architecturez#Xcodec2Config.validate_architecturee   sS   € à×Ñ˜d×6Ñ6Ñ6¸!Ò;ÜØ# D×$4Ñ$4Ð#5ð 6Ø×2Ñ2Ð3°2ð7óð ð <r=   Úreturnc                 óR   — t        t        j                  | j                  «      «      S )N)ÚintÚnpÚprodr,   r@   s    r<   Ú
hop_lengthzXcodec2Config.hop_lengthm   s   € ä”2—7‘7˜4×3Ñ3Ó4Ó5Ð5r=   c                 ó    — | j                   dz  S )Nr*   )rG   r@   s    r<   Ún_fftzXcodec2Config.n_fftq   s   € à�‰ Ñ"Ð"r=   )/Ú__name__Ú
__module__Ú__qualname__Ú__doc__r2   Úkeys_to_ignore_at_inferencer   rD   Ú__annotations__r   r   r   r   r   Ústrr   r   r   Úfloatr   r    r!   Úboolr"   r   r5   r#   r$   r&   r   Úsub_configsr)   r,   ÚlistÚtupler'   r   r-   r.   r/   r0   r8   rA   ÚpropertyrG   rI   Ú__classcell__)r;   s   @r<   r   r      sž  ø… ñð2 €JØ#4Ð"5ÐØ€K�ÓØ!Ð�sÓ!ØÐ�sÓØ!Ð˜Ó!Ø!Ð˜Ó!Ø€J�ÓØ#'Ð˜SÓ'Ø9™x¨C°SÔ9À$ÔGÐ�uÓGØ€L�%ÓØ#€L�#˜‘*Ó#Ø %Ð˜Ó%Ø48€O�^ dÑ*¨TÑ1Ó8Ø €N�DÓ Ø,/Ð�s˜U‘{ TÑ)Ó/Ø€HˆcÓØ*¨JÐ7€Kà!Ð˜Ó!Ø7FÐ˜˜c™ U¨3°¨8¡_Ñ4ÓFØ<@Ð˜4Ð"2Ñ2°TÑ9Ó@Ø€M�3ÓØ #Ð˜Ó#Ø Ð�cÓ Ø7OÐ˜˜c™ U¨3°¨8¡_Ñ4ÓOô(òð ð6˜Cò 6ó ð6ð ð#�sò #ó ô#r=   r   )ÚnumpyrE   Úhuggingface_hub.dataclassesr   Úconfiguration_utilsr   Úmodeling_rope_utilsr   Úutilsr   Úutils.type_validatorsr   Úautor
   r   r   Ú__all__r3   r=   r<   ú<module>r`      sT   ðó* Ý .å 3Ý 1Ý #Ý -ß -ñ Ð2Ô3ØôR#Ð$ó R#ó ó 4ðR#ðj Ð
�r=   