
    i                        d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	  e	j                  e      Z ed      e G d	 d
e                    Z ed      e G d de                    Z ed      e G d de                    Zg dZy)zDia model configuration    )strict   )PreTrainedConfig)RopeParameters)auto_docstringloggingznari-labs/Dia-1.6B)
checkpointc                       e Zd ZU d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<   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<   y)DiaEncoderConfigdia_encoder   max_position_embeddings   num_hidden_layershidden_size   num_attention_headsnum_key_value_heads   head_dimi   intermediate_sizeh㈵>norm_eps   
vocab_sizesilu
hidden_actNrope_parameters{Gz?initializer_range)__name__
__module____qualname__
model_typer   int__annotations__r   r   r   r   r   r   r   floatr   r   strr   dictr         z/var/www/vps2.regionflexible.com/Desarrollo/venv/lib/python3.12/site-packages/transformers/models/dia/configuration_dia.pyr   r      s     J#'S'sK!!!!Hc!s!HeJJ#'OTD['#u#r+   r   c                   t   e Zd ZU dZd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<   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z  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!e   z  dz  ed'<   d(Z"edz  ed)<   y)*DiaDecoderConfiga)  
    cross_num_attention_heads (`int`, *optional*, defaults to 16):
        Number of attention heads for each cross-attention layer in the Transformer decoder.
    cross_head_dim (`int`, *optional*, defaults to 128):
        Dimensionality of the cross-attention head.
    cross_num_key_value_heads (`int`, *optional*, defaults to 16):
        Number of key and value heads for each cross-attention layer in the Transformer decoder.
    cross_hidden_size (`int`, *optional*, defaults to 1024):
        Dimensionality of the cross-attention layers.
    dia_decoderi   r      r   i   r   i    r   r   r      r   r   r   cross_num_attention_headscross_head_dimcross_num_key_value_headsr   cross_hidden_sizer   r   i  r   r   r   	   num_channelsNr   r   r    T	use_cacheis_encoder_decoderi  pad_token_ideos_token_idi  bos_token_id)#r!   r"   r#   __doc__r$   r   r%   r&   r   r   r   r   r   r   r2   r3   r4   r5   r   r'   r   r   r(   r7   r   r   r)   r    r8   boolr9   r:   r;   listr<   r*   r+   r,   r.   r.   -   s   	 J#'S'sK!s!!!  Hc%'s'NC%'s'!s!HeJJL#48O^d*T18#u#It###L#*#+/L#S	/D(/#L#*#r+   r.   c                       e Zd ZU dZdZdgZeedZ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e   z  dz  ed<   dZedz  ed<   dZee   dz  ed<   dZeed<   d
Zeed<    fdZd Zd Z xZS )	DiaConfigaP  
    delay_pattern (`list[int]`, *optional*, defaults to `[0, 8, 9, 10, 11, 12, 13, 14, 15]`):
        The delay pattern for the decoder. The length of this list must match `decoder_config.num_channels`.

    Example:

    ```python
    >>> from transformers import DiaConfig, DiaModel

    >>> # Initializing a DiaConfig with default values
    >>> configuration = DiaConfig()

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

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```
    diapast_key_values)encoder_configdecoder_configNrD   rE   r   r   Tr9   r:   r;   r<   delay_patternr   r    r8   c                 :   t        | j                  t              rt        di | j                  | _        t        | j                  t              rt        di | j                  | _        | j                  | j                  n	t               | _        | j                  | j                  n	t               | _        | j                  | j                  ng d| _        | j                  0t        j                  d       | j                  | j                  _        | j                  0t        j                  d       | j                  | j                  _
        | j                  0t        j                  d       | j                  | j                  _        t        | 4  di | y )N)	r      r6   
      r            zjPassing `pad_token_id` to `DiaConfig` is deprecated. Please set it directly on `DiaDecoderConfig` instead.zjPassing `eos_token_id` to `DiaConfig` is deprecated. Please set it directly on `DiaDecoderConfig` instead.zjPassing `bos_token_id` to `DiaConfig` is deprecated. Please set it directly on `DiaDecoderConfig` instead.r*   )
isinstancerD   r)   r   rE   r.   rF   r:   loggerwarning_oncer;   r<   super__post_init__)selfkwargs	__class__s     r,   rR   zDiaConfig.__post_init__{   s`   d))40"2"IT5H5H"IDd))40"2"IT5H5H"ID595H5H5Td11ZjZl595H5H5Td11ZjZl"&"4"4"@DFg 	
 (H 04/@/@D,(H 04/@/@D,(H 04/@/@D,''r+   c                 r    | j                   j                  t        | j                        k7  rt	        d      y)zOPart of `@strict`-powered validation. Validates the architecture of the config.z3Number of channels must match delay pattern length.N)rE   r7   lenrF   
ValueError)rS   s    r,   validate_architecturezDiaConfig.validate_architecture   s3    ++s43E3E/FFRSS Gr+   c                     | j                   S )z^Defaulting to audio config as it's the decoder in this case which is usually the text backbone)rE   )rS   argsrT   s      r,   get_text_configzDiaConfig.get_text_config   s    """r+   )r!   r"   r#   r=   r$   keys_to_ignore_at_inferencer   r.   sub_configsrD   r)   r&   rE   r   r'   r9   r>   r:   r%   r;   r?   r<   rF   r    r8   rR   rY   r\   __classcell__)rU   s   @r,   rA   rA   U   s    ( J#4"5%5IYZK59N$t+d2959N$t+d29He###L#*#+/L#S	/D(/#L#*#&*M49t#*#u#It"(HT
#r+   rA   )rA   r   r.   N)r=   huggingface_hub.dataclassesr   configuration_utilsr   modeling_rope_utilsr   utilsr   r   
get_loggerr!   rO   r   r.   rA   __all__r*   r+   r,   <module>rf      s     . 3 1 , 
		H	% /0$' $  1$" /0#$' #$  1#$L /0O#  O#  1O#d @r+   