
    i /                     D    d dl mZ  G d de      Z G d de      ZddgZy)   )PreTrainedConfigc                   f     e Zd ZdZdZdgZdddddd	d	d
ddddddddddddddgddgddf fd	Z xZS )LasrEncoderConfiga  
    This is the configuration class to store the configuration of a [`LasrEncoder`]. It is used to instantiate a
    `LasrEncoder` model according to the specified arguments, defining the model architecture.

    Configuration objects inherit from [`PreTrainedConfig`] and can be used to control the model outputs. Read the
    documentation from [`PreTrainedConfig`] for more information.

    Args:
            hidden_size (`int`, *optional*, defaults to 512):
                Dimension of the layers and the hidden states.
            num_hidden_layers (`int`, *optional*, defaults to 17):
                Number of hidden layers in the Transformer encoder.
            num_attention_heads (`int`, *optional*, defaults to 8):
                Number of attention heads for each attention layer in the Transformer encoder.
            intermediate_size (`int`, *optional*, defaults to 2048):
                Dimension of the "intermediate" (often named feed-forward) layer in the Transformer encoder.
            hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
                The non-linear activation function (function or string) in the encoder and pooler.
            attention_bias (`bool`, *optional*, defaults to `False`):
                Whether to use bias in the attention layers.
            convolution_bias (`bool`, *optional*, defaults to `False`):
                Whether to use bias in convolutions of the conformer's convolution module.
            conv_kernel_size (`int`, *optional*, defaults to 32):
                The kernel size of the convolution layers in the Conformer block.
            subsampling_conv_channels (`int`, *optional*, defaults to 256):
                The number of channels in the subsampling convolution layers.
            subsampling_conv_kernel_size (`int`, *optional*, defaults to 5):
                The kernel size of the subsampling convolution layers.
            subsampling_conv_stride (`int`, *optional*, defaults to 2):
                The stride of the subsampling convolution layers.
            num_mel_bins (`int`, *optional*, defaults to 128):
                Number of mel features.
            dropout (`float`, *optional*, defaults to 0.1):
                The dropout ratio for all fully connected layers in the embeddings, encoder, and pooler.
            dropout_positions (`float`, *optional*, defaults to 0.0):
                The dropout ratio for the positions in the input sequence.
            layerdrop (`float`, *optional*, defaults to 0.1):
                The dropout ratio for the layers in the encoder.
            activation_dropout (`float`, *optional*, defaults to 0.1):
                The dropout ratio for activations inside the fully connected layer.
            attention_dropout (`float`, *optional*, defaults to 0.1):
                The dropout ratio for the attention layers.
            max_position_embeddings (`int`, *optional*, defaults to 10000):
                The maximum sequence length that this model might ever be used with.
            initializer_range (`float`, *optional*, defaults to 0.02):
                The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
            layer_norm_eps (`float`, *optional*, defaults to 1e-06):
                The epsilon used by the layer normalization layers.
            feed_forward_residual_weights (`tuple[float, float]`, *optional*, defaults to `[1.5, 0.5]`):
                The residual weights for the feed forward layers.
            conv_residual_weights (`tuple[float, float]`, *optional*, defaults to `[2.0, 1.0]`):
                The residual weights for the convolution layers.
            batch_norm_momentum (`float`, *optional*, defaults to 0.01):
                The momentum for the batch normalization layers.
            rope_parameters (`RopeParameters`, *optional*):
                Dictionary containing the configuration parameters for the RoPE embeddings. The dictionary should contain
                a value for `rope_theta` and optionally parameters used for scaling in case you want to use RoPE
                with longer `max_position_embeddings`.

    Example:
        ```python
        >>> from transformers import LasrEncoderModel, LasrEncoderConfig

        >>> # Initializing a `LasrEncoder` configuration
        >>> configuration = LasrEncoderConfig()

        >>> # Initializing a model from the configuration
        >>> model = LasrEncoderModel(configuration)

        >>> # Accessing the model configuration
        >>> configuration = model.config
        ```

    This configuration class is based on the LasrEncoder architecture from Google Health AI. You can find more details
    and pre-trained models at [TODO/TODO](https://huggingface.co/TODO/TODO).
    lasr_encoderpast_key_values         i   siluF                g?g        i'  g{Gz?gư>g      ?g      ?g       @g      ?g{Gz?Nc                    || _         || _        || _        || _        || _        || _        || _        || _        || _        || _	        || _
        || _        || _        || _        |
| _        || _        |	| _        || _        || _        || _        || _        || _        || _        || _        || _        t3        | h  di | y N )rope_parameterslayer_norm_epsfeed_forward_residual_weightsconv_residual_weightsbatch_norm_momentumhidden_sizenum_hidden_layersnum_attention_headsnum_key_value_headsintermediate_size
hidden_actattention_biasconvolution_biasconv_kernel_sizesubsampling_conv_kernel_sizesubsampling_conv_stridesubsampling_conv_channelsnum_mel_binsdropoutdropout_positions	layerdropactivation_dropoutattention_dropoutmax_position_embeddingsinitializer_rangesuper__init__)selfr   r   r   r   r   r   r    r!   r$   r"   r#   r%   r&   r'   r(   r)   r*   r+   r,   r   r   r   r   r   kwargs	__class__s                             g/mnt/e/genesis-system/.venv/lib/python3.12/site-packages/transformers/models/lasr/configuration_lasr.pyr.   zLasrEncoderConfig.__init__j   s    8  /,-J*%:"#6 &!2#6 #6 !2$, 0 0,H)'>$)B&(!2""4!2'>$!2 	
	
    )__name__
__module____qualname____doc__
model_typekeys_to_ignore_at_inferencer.   __classcell__r1   s   @r2   r   r      sv    KZ  J#4"5 "%%& ! %'*Cj"Cj 3:
 :
r3   r   c                   l     e Zd ZdZdZdeiZ	 	 	 	 	 ddeez  f fdZe	defd       Z
ed        Z xZS )LasrCTCConfiga  
    This is the configuration class to store the configuration of a [`LasrForCTC`]. It is used to instantiate a
    Lasr CTC model according to the specified arguments, defining the model architecture.
    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 512):
                Vocabulary size of the model.
            ctc_loss_reduction (`str`, *optional*, defaults to `"mean"`):
                Specifies the reduction to apply to the output of `torch.nn.CTCLoss`. Only relevant when training an
                instance of [`LasrForCTC`].
            ctc_zero_infinity (`bool`, *optional*, defaults to `True`):
                Whether to zero infinite losses and the associated gradients of `torch.nn.CTCLoss`. Infinite losses mainly
                occur when the inputs are too short to be aligned to the targets. Only relevant when training an instance
                of [`LasrForCTC`].
            encoder_config (`Union[dict, LasrEncoderConfig]`, *optional*):
                The config object or dictionary of the encoder.
            pad_token_id (`int`, *optional*, defaults to 0):
                Padding token id. Also used as blank token id.
    Example:
        ```python
        >>> from transformers import LasrForCTC, LasrCTCConfig
        >>> # Initializing a Lasr configuration
        >>> configuration = LasrCTCConfig()
        >>> # Initializing a model from the configuration
        >>> model = LasrForCTC(configuration)
        >>> # Accessing the model configuration
        >>> configuration = model.config
        ```
    This configuration class is based on the Lasr CTC architecture from Google Health AI. You can find more details
    and pre-trained models at [TODO/TODO](https://huggingface.co/TODO/TODO).
    lasr_ctcencoder_configc                    || _         || _        || _        t        |t              rt        di || _        n|t               | _        | j                  | _        | j                  j                  | _        || _        t        | (  di | y r   )
vocab_sizectc_loss_reductionctc_zero_infinity
isinstancedictr   r?   r,   pad_token_idr-   r.   )r/   rA   rB   rC   r?   rF   r0   r1   s          r2   r.   zLasrCTCConfig.__init__   s     %"4!2nd+"3"En"ED#"3"5D"11!%!4!4!F!F("6"r3   c                 2     | dd|j                         i|S )z
        Instantiate a [`LasrCTCConfig`] (or a derived class) from lasr encoder model configuration.

        Returns:
            [`LasrCTCConfig`]: An instance of a configuration object
        r?   r   )to_dict)clsr?   r0   s      r2   from_encoder_configz!LasrCTCConfig.from_encoder_config   s      E."8"8":EfEEr3   c                 4    | j                   j                  dz  S )Nr   )r?   r#   )r/   s    r2   inputs_to_logits_ratioz$LasrCTCConfig.inputs_to_logits_ratio   s    ""::A==r3   )r   meanTN    )r4   r5   r6   r7   r8   r   sub_configsrE   r.   classmethodrJ   propertyrL   r:   r;   s   @r2   r=   r=      st    B J#%67K !37#
 00#0 F1B F F > >r3   r=   N)configuration_utilsr   r   r=   __all__r   r3   r2   <module>rT      s6   , 4K
( K
\J>$ J>Z 
0r3   