o
    ¾e¦i_  ã                   @   s@   d Z ddlmZ ddlmZ e e¡ZG dd„ deƒZdgZ	dS )zOPT model configurationé   )ÚPreTrainedConfig)Úloggingc                       sV   e Zd ZdZdZdgZ								
																		d‡ fdd„	Z‡  ZS )Ú	OPTConfigaŸ  
    This is the configuration class to store the configuration of a [`OPTModel`]. It is used to instantiate a OPT 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 OPT
    [facebook/opt-350m](https://huggingface.co/facebook/opt-350m) 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 50272):
            Vocabulary size of the OPT model. Defines the number of different tokens that can be represented by the
            `inputs_ids` passed when calling [`OPTModel`]
        hidden_size (`int`, *optional*, defaults to 768):
            Dimensionality of the layers and the pooler layer.
        num_hidden_layers (`int`, *optional*, defaults to 12):
            Number of decoder layers.
        ffn_dim (`int`, *optional*, defaults to 3072):
            Dimensionality of the "intermediate" (often named feed-forward) layer in decoder.
        num_attention_heads (`int`, *optional*, defaults to 12):
            Number of attention heads for each attention layer in the Transformer decoder.
        activation_function (`str` or `function`, *optional*, defaults to `"relu"`):
            The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
            `"relu"`, `"silu"` and `"gelu_new"` are supported.
        max_position_embeddings (`int`, *optional*, defaults to 2048):
            The maximum sequence length that this model might ever be used with. Typically set this to something large
            just in case (e.g., 512 or 1024 or 2048).
        do_layer_norm_before (`bool`, *optional*, defaults to `True`):
            Whether to perform layer normalization before the attention block.
        word_embed_proj_dim (`int`, *optional*):
            `word_embed_proj_dim` can be set to down-project word embeddings, *e.g.* `opt-350m`. Defaults to
            `hidden_size`.
        dropout (`float`, *optional*, defaults to 0.1):
            The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
        attention_dropout (`float`, *optional*, defaults to 0.0):
            The dropout ratio for the attention probabilities.
        layerdrop (`float`, *optional*, defaults to 0.0):
            The LayerDrop probability. See the [LayerDrop paper](see https://huggingface.co/papers/1909.11556) for more
            details.
        init_std (`float`, *optional*, defaults to 0.02):
            The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
        use_cache (`bool`, *optional*, defaults to `True`):
            Whether or not the model should return the last key/values attentions (not used by all models).
        enable_bias (`bool`, *optional*, defaults to `True`):
            Whether or not if the linear layers in the attention blocks should use the bias term.
        layer_norm_elementwise_affine (`bool`, *optional*, defaults to `True`):
            Whether or not if the layer norms should have learnable parameters.

    Example:

    ```python
    >>> from transformers import OPTConfig, OPTModel

    >>> # Initializing a OPT facebook/opt-large style configuration
    >>> configuration = OPTConfig()

    >>> # Initializing a model (with random weights) from the facebook/opt-large style configuration
    >>> model = OPTModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```ÚoptÚpast_key_valuesé`Ä  é   é   é   é   TFNçš™™™™™¹?ç        Úreluç{®Gáz”?é   é   c                    s    t ƒ jdi |¤Ž || _|| _|| _|| _|| _|| _|| _|d ur$|n|| _	|| _
|| _|| _|	| _|
| _|| _|| _|| _|| _|| _|| _|| _|| _d S )N© )ÚsuperÚ__init__Úpad_token_idÚbos_token_idÚeos_token_idÚtie_word_embeddingsÚ
vocab_sizeÚmax_position_embeddingsÚnum_attention_headsÚword_embed_proj_dimÚffn_dimÚhidden_sizeÚnum_hidden_layersÚdropoutÚattention_dropoutÚactivation_functionÚinit_stdÚ	layerdropÚ	use_cacheÚdo_layer_norm_beforeÚenable_biasÚlayer_norm_elementwise_affineÚ_remove_final_layer_norm)Úselfr   r   r   r   r   r&   r)   r   r    r!   r   r"   r$   r#   r%   r   r   r   r'   r(   r   Úkwargs©Ú	__class__r   úg/home/ubuntu/transcripts/venv/lib/python3.10/site-packages/transformers/models/opt/configuration_opt.pyr   [   s,   
zOPTConfig.__init__)r   r   r	   r
   r   TFNr   r   r	   r   r   r   Tr   r   r   TTT)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
model_typeÚkeys_to_ignore_at_inferencer   Ú__classcell__r   r   r,   r.   r      s4    @êr   N)
r2   Úconfiguration_utilsr   Úutilsr   Ú
get_loggerr/   Úloggerr   Ú__all__r   r   r   r.   Ú<module>   s   

z