U
    9%eL                     @   sL   d Z ddlmZ ddlmZ eeZdddddd	d
ZG dd deZ	dS )z OPT model configuration   )PretrainedConfig)loggingz>https://huggingface.co/facebook/opt-125m/blob/main/config.jsonz>https://huggingface.co/facebook/opt-350m/blob/main/config.jsonz>https://huggingface.co/facebook/opt-1.3b/blob/main/config.jsonz>https://huggingface.co/facebook/opt-2.7b/blob/main/config.jsonz>https://huggingface.co/facebook/opt-6.7b/blob/main/config.jsonz=https://huggingface.co/facebook/opt-13b/blob/main/config.json)zfacebook/opt-125mzfacebook/opt-350mzfacebook/opt-1.3bzfacebook/opt-2.7bzfacebook/opt-6.7bzfacebook/opt-13bc                       s,   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://arxiv.org/abs/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
    ```optZpast_key_values`              TFN皙?        relu{Gz?      c                    s   t  jf |||d| || _|| _|| _|d k	r8|n|| _|| _|| _|| _|	| _	|
| _
|| _|| _|| _|| _|| _|| _|| _|| _d S )N)pad_token_idbos_token_ideos_token_id)super__init__
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%   kwargs	__class__ h/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/transformers/models/opt/configuration_opt.pyr   c   s0    zOPTConfig.__init__)r   r   r   r	   r
   TFNr   r   r   r   r   r   Tr   r   r   TT)__name__
__module____qualname____doc__Z
model_typeZkeys_to_ignore_at_inferencer   __classcell__r+   r+   r)   r,   r       s0   ?                    r   N)
r0   Zconfiguration_utilsr   utilsr   Z
get_loggerr-   loggerZ!OPT_PRETRAINED_CONFIG_ARCHIVE_MAPr   r+   r+   r+   r,   <module>   s   

