
    cCi'                         S r SSKJr  SSKJr  SSKJr  \R                  " \5      r	 " S S\5      r
 " S S	\5      rS	S/rg
)zParakeet model configuration.    )Union   )PretrainedConfig)loggingc                   b   ^  \ rS rSrSrSrS/r                    SU 4S jjrSrU =r	$ )ParakeetEncoderConfig   a   
This is the configuration class to store the configuration of a [`ParakeetEncoder`]. It is used to instantiate a
`ParakeetEncoder` 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 1024):
        Dimension of the layers and the hidden states.
    num_hidden_layers (`int`, *optional*, defaults to 24):
        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 4096):
        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 `True`):
        Whether to use bias in the attention layers.
    conv_kernel_size (`int`, *optional*, defaults to 9):
        The kernel size of the convolution layers in the Conformer block.
    subsampling_factor (`int`, *optional*, defaults to 8):
        The factor by which the input sequence is subsampled.
    subsampling_conv_channels (`int`, *optional*, defaults to 256):
        The number of channels in the subsampling convolution layers.
    num_mel_bins (`int`, *optional*, defaults to 80):
        Number of mel features.
    subsampling_conv_kernel_size (`int`, *optional*, defaults to 3):
        The kernel size of the subsampling convolution layers.
    subsampling_conv_stride (`int`, *optional*, defaults to 2):
        The stride of the subsampling convolution layers.
    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 5000):
        The maximum sequence length that this model might ever be used with.
    scale_input (`bool`, *optional*, defaults to `True`):
        Whether to scale the input embeddings.
    initializer_range (`float`, *optional*, defaults to 0.02):
        The standard deviation of the truncated_normal_initializer for initializing all weight matrices.

Example:
    ```python
    >>> from transformers import ParakeetEncoderModel, ParakeetEncoderConfig

    >>> # Initializing a `ParakeetEncoder` configuration
    >>> configuration = ParakeetEncoderConfig()

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

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

This configuration class is based on the ParakeetEncoder architecture from NVIDIA NeMo. You can find more details
and pre-trained models at [nvidia/parakeet-ctc-1.1b](https://huggingface.co/nvidia/parakeet-ctc-1.1b).
parakeet_encoderpast_key_valuesc                 `  > [         TU ]  " S0 UD6  Xl        X l        X0l        X0l        X@l        XPl        X`l        US-
  S-  S:w  a  [        SU 35      eXpl
        Xl        Xl        Xl        Xl        Xl        Xl        Xl        Xl        UU l        UU l        UU l        UU l        UU l        g )N      r   z"conv_kernel_size must be odd, got  )super__init__hidden_sizenum_hidden_layersnum_attention_headsnum_key_value_headsintermediate_size
hidden_actattention_bias
ValueErrorconv_kernel_sizesubsampling_conv_kernel_sizesubsampling_conv_stridesubsampling_factorsubsampling_conv_channelsnum_mel_binsdropoutdropout_positions	layerdropactivation_dropoutattention_dropoutmax_position_embeddingsscale_inputinitializer_range)selfr   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   kwargs	__class__s                         m/home/james-whalen/.local/lib/python3.13/site-packages/transformers/models/parakeet/configuration_parakeet.pyr   ParakeetEncoderConfig.__init__a   s    0 	 	
	
 '!2#6 #6 !2$,q A%*ABRASTUU 0,H)'>$"4)B&(!2""4!2'>$&!2    )r#   r   r$   r   r    r!   r   r   r'   r   r"   r%   r   r   r   r   r&   r   r   r   r   )         i   siluT	   r0      P   r   r   皙?g        r5   r5   r5   i  Tg{Gz?)
__name__
__module____qualname____firstlineno____doc__
model_typekeys_to_ignore_at_inferencer   __static_attributes____classcell__r*   s   @r+   r   r      sb    AF $J#4"5 "%%& ! $+53 53r-   r   c                   p   ^  \ rS rSrSrSrS\0r     SS\\	\4   4U 4S jjjr
\S\4S j5       rSrU =r$ )	ParakeetCTCConfig   ag  
This is the configuration class to store the configuration of a [`ParakeetForCTC`]. It is used to instantiate a
Parakeet 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 1025):
            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 [`ParakeetForCTC`].
        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 [`ParakeetForCTC`].
        encoder_config (`Union[dict, ParakeetEncoderConfig]`, *optional*):
            The config object or dictionary of the encoder.
        pad_token_id (`int`, *optional*, defaults to 1024):
            Padding token id. Also used as blank token id.

Example:
    ```python
    >>> from transformers import ParakeetForCTC, ParakeetCTCConfig

    >>> # Initializing a Parakeet configuration
    >>> configuration = ParakeetCTCConfig()

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

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

This configuration class is based on the Parakeet CTC architecture from NVIDIA NeMo. You can find more details
and pre-trained models at [nvidia/parakeet-ctc-1.1b](https://huggingface.co/nvidia/parakeet-ctc-1.1b).
parakeet_ctcencoder_configc                   > Xl         X l        X0l        [        U[        5      (       a  [        S0 UD6U l        OUc  [        5       U l        U R                  U l        U R                  R                  U l        [        TU ]$  " SSU0UD6  g )Npad_token_idr   )

vocab_sizectc_loss_reductionctc_zero_infinity
isinstancedictr   rD   r'   r   r   )r(   rG   rH   rI   rD   rF   r)   r*   s          r+   r   ParakeetCTCConfig.__init__   s     %"4!2nd++"7"I."ID#"7"9D"11!%!4!4!F!F 	
%	
	
r-   c                 2    U " SSUR                  5       0UD6$ )z
Instantiate a [`ParakeetCTCConfig`] (or a derived class) from parakeet encoder model configuration.

Returns:
    [`ParakeetCTCConfig`]: An instance of a configuration object
rD   r   )to_dict)clsrD   r)   s      r+   from_encoder_config%ParakeetCTCConfig.from_encoder_config   s      E."8"8":EfEEr-   )rH   rI   rD   r'   rG   )i  meanTNr.   )r6   r7   r8   r9   r:   r;   r   sub_configsr   rK   r   classmethodrP   r=   r>   r?   s   @r+   rA   rA      sj    &P  J#%:;K !=A

 d$99:
 
4 F1F F Fr-   rA   N)r:   typingr   configuration_utilsr   utilsr   
get_loggerr6   loggerr   rA   __all__r   r-   r+   <module>r[      sT    $  3  
		H	%|3, |3~OF( OFd  7
8r-   