o
    ¾e¦i—+  ã                   @   s2   d dl mZ d dlmZ G dd„ deƒZdgZdS )é   )ÚPreTrainedConfig)ÚRopeParametersc                2       s8  e Zd ZdZdZdgZdddddœZ			
																						d.dedB dedB dedB dedB dedB dedB dedB dedB dedB dedB dedB dedB d edB d!e	dB d"edB d#e
dB d$eeeef B dB d%e
dB d&e
dB d'e	dB d(edB d)edB d*edB d+e
dB f0‡ fd,d-„Z‡  ZS )/ÚMoonshineConfiga7  
    This is the configuration class to store the configuration of a [`MoonshineModel`]. It is used to instantiate a Moonshine
    model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
    defaults will yield a similar configuration to that of the Moonshine
    [UsefulSensors/moonshine-tiny](https://huggingface.co/UsefulSensors/moonshine-tiny).

    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 32768):
            Vocabulary size of the Moonshine model. Defines the number of different tokens that can be represented by the
            `inputs_ids` passed when calling [`MoonshineModel`].
        hidden_size (`int`, *optional*, defaults to 288):
            Dimension of the hidden representations.
        intermediate_size (`int`, *optional*, defaults to 1152):
            Dimension of the MLP representations.
        encoder_num_hidden_layers (`int`, *optional*, defaults to 6):
            Number of hidden layers in the Transformer encoder.
        decoder_num_hidden_layers (`int`, *optional*, defaults to 6):
            Number of hidden layers in the Transformer decoder.
        encoder_num_attention_heads (`int`, *optional*, defaults to 8):
            Number of attention heads for each attention layer in the Transformer encoder.
        decoder_num_attention_heads (`int`, *optional*, defaults to 8):
            Number of attention heads for each attention layer in the Transformer decoder.
        encoder_num_key_value_heads (`int`, *optional*):
            This is the number of key_value heads that should be used to implement Grouped Query Attention. If
            `encoder_num_key_value_heads=encoder_num_attention_heads`, the model will use Multi Head Attention (MHA), if
            `encoder_num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
            converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
            by meanpooling all the original heads within that group. For more details, check out [this
            paper](https://huggingface.co/papers/2305.13245). If it is not specified, will default to
            `num_attention_heads`.
        decoder_num_key_value_heads (`int`, *optional*):
            This is the number of key_value heads that should be used to implement Grouped Query Attention. If
            `decoder_num_key_value_heads=decoder_num_attention_heads`, the model will use Multi Head Attention (MHA), if
            `decoder_num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
            converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
            by meanpooling all the original heads within that group. For more details, check out [this
            paper](https://huggingface.co/papers/2305.13245). If it is not specified, will default to
            `decoder_num_attention_heads`.
        pad_head_dim_to_multiple_of (`int`, *optional*):
            Pad head dimension in encoder and decoder to the next multiple of this value. Necessary for using certain
            optimized attention implementations.
        encoder_hidden_act (`str` or `function`, *optional*, defaults to `"gelu"`):
            The non-linear activation function (function or string) in the encoder.
        decoder_hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
            The non-linear activation function (function or string) in the decoder.
        max_position_embeddings (`int`, *optional*, defaults to 512):
            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.
        decoder_start_token_id (`int`, *optional*, defaults to 1):
            Corresponds to the "<|startoftranscript|>" token, which is automatically used when no `decoder_input_ids`
            are provided to the `generate` function. It is used to guide the model`s generation process depending on
            the task.
        use_cache (`bool`, *optional*, defaults to `True`):
            Whether or not the model should return the last key/values attentions (not used by all models).
        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`.
        is_encoder_decoder (`bool`, *optional*, defaults to `True`):
            Whether the model is used as an encoder/decoder or not.
        attention_bias (`bool`, *optional*, defaults to `False`):
            Whether to use a bias in the query, key, value and output projection layers during self-attention.
        attention_dropout (`float`, *optional*, defaults to 0.0):
            The dropout ratio for the attention probabilities.
        bos_token_id (`int`, *optional*, defaults to 1):
            Denotes beginning of sequences token id.
        eos_token_id (`int`, *optional*, defaults to 2):
            Denotes end of sequences token id.
        pad_token_id (`int`, *optional*):
            Padding token id.
        tie_word_embeddings (`bool`, *optional*, defaults to `True`):
            Whether to tie weight embeddings

    Example:

    ```python
    >>> from transformers import MoonshineModel, MoonshineConfig

    >>> # Initializing a Moonshine style configuration
    >>> configuration = MoonshineConfig().from_pretrained("UsefulSensors/moonshine-tiny")

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

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```Ú	moonshineÚpast_key_valuesÚdecoder_num_key_value_headsÚdecoder_num_attention_headsÚdecoder_num_hidden_layersÚdecoder_hidden_act)Únum_key_value_headsÚnum_attention_headsÚnum_hidden_layersÚ
hidden_acté €  é   é€  é   é   NÚgeluÚsilué   ç{®Gáz”?é   TFç        é   Ú
vocab_sizeÚhidden_sizeÚintermediate_sizeÚencoder_num_hidden_layersÚencoder_num_attention_headsÚencoder_num_key_value_headsÚpad_head_dim_to_multiple_ofÚencoder_hidden_actÚmax_position_embeddingsÚinitializer_rangeÚdecoder_start_token_idÚ	use_cacheÚrope_parametersÚis_encoder_decoderÚattention_biasÚattention_dropoutÚbos_token_idÚeos_token_idÚpad_token_idÚtie_word_embeddingsc                    sÔ   || _ || _|| _|| _|| _|| _|| _|d u r|}|| _|	d u r$|}	|	| _|
| _	|| _
|| _|| _|| _|| _|| _|| _|| _|| _|| _|| _|| _|| _|| _|| _| dd¡ tƒ jdd|i|¤Ž d S )NÚpartial_rotary_factorgÍÌÌÌÌÌì?r(   © )r   r   r   r   r	   r   r   r    r   r!   r"   r
   r#   r$   r%   r&   r(   r)   r*   r+   r,   r-   r.   r'   Ú
setdefaultÚ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__r0   ús/home/ubuntu/transcripts/venv/lib/python3.10/site-packages/transformers/models/moonshine/configuration_moonshine.pyr3      s>   zMoonshineConfig.__init__)r   r   r   r   r   r   r   NNNr   r   r   r   r   TNTFr   r   r   NT)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
model_typeÚkeys_to_ignore_at_inferenceÚattribute_mapÚintÚstrÚfloatÚboolr   Údictr3   Ú__classcell__r0   r0   r6   r8   r      s¤    \ü	çþýüûúùø	÷
öõôóòñðïîíìëêéèçr   N)Úconfiguration_utilsr   Úmodeling_rope_utilsr   r   Ú__all__r0   r0   r0   r8   Ú<module>   s
    
)