U
    ,-ef#                     @   sV   d Z ddlmZmZmZ ddlmZ ddlmZ e	e
ZddiZG dd	 d	eZd
S )z ProphetNet model configuration    )CallableOptionalUnion   )PretrainedConfig)loggingz"microsoft/prophetnet-large-uncasedzRhttps://huggingface.co/microsoft/prophetnet-large-uncased/resolve/main/config.jsonc                       s   e Zd ZdZdZdgZddiZdee ee	e
ef  ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee d fddZeedddZejdd Z  ZS )ProphetNetConfiga  
    This is the configuration class to store the configuration of a [`ProphetNetModel`]. It is used to instantiate a
    ProphetNet 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 ProphetNet
    [microsoft/prophetnet-large-uncased](https://huggingface.co/microsoft/prophetnet-large-uncased) architecture.

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

    Args:
        activation_dropout (`float`, *optional*, defaults to 0.1):
            The dropout ratio for activations inside the fully connected layer.
        activation_function (`str` or `function`, *optional*, defaults to `"gelu"`):
            The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
            `"relu"`, `"silu"` and `"gelu_new"` are supported.
        vocab_size (`int`, *optional*, defaults to 30522):
            Vocabulary size of the ProphetNET model. Defines the number of different tokens that can be represented by
            the `inputs_ids` passed when calling [`ProphetNetModel`].
        hidden_size (`int`, *optional*, defaults to 1024):
            Dimensionality of the layers and the pooler layer.
        encoder_ffn_dim (`int`, *optional*, defaults to 4096):
            Dimensionality of the "intermediate" (often named feed-forward) layer in decoder.
        num_encoder_layers (`int`, *optional*, defaults to 12):
            Number of encoder layers.
        num_encoder_attention_heads (`int`, *optional*, defaults to 16):
            Number of attention heads for each attention layer in the Transformer encoder.
        decoder_ffn_dim (`int`, *optional*, defaults to 4096):
            Dimensionality of the `intermediate` (often named feed-forward) layer in decoder.
        num_decoder_layers (`int`, *optional*, defaults to 12):
            Number of decoder layers.
        num_decoder_attention_heads (`int`, *optional*, defaults to 16):
            Number of attention heads for each attention layer in the Transformer decoder.
        attention_dropout (`float`, *optional*, defaults to 0.1):
            The dropout ratio for the attention probabilities.
        dropout (`float`, *optional*, defaults to 0.1):
            The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
        max_position_embeddings (`int`, *optional*, defaults to 512):
            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).
        init_std (`float`, *optional*, defaults to 0.02):
            The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
        add_cross_attention (`bool`, *optional*, defaults to `True`):
            Whether cross-attention layers should be added to the model.
        is_encoder_decoder (`bool`, *optional*, defaults to `True`):
            Whether this is an encoder/decoder model.
        pad_token_id (`int`, *optional*, defaults to 1)
            Padding token id.
        bos_token_id (`int`, *optional*, defaults to 0)
            Beginning of stream token id.
        eos_token_id (`int`, *optional*, defaults to 2)
            End of stream token id.
        ngram (`int`, *optional*, defaults to 2)
            Number of future tokens to predict. Set to 1 to be same as traditional Language model to predict next first
            token.
        num_buckets (`int`, *optional*, defaults to 32)
            The number of buckets to use for each attention layer. This is for relative position calculation. See the
            [T5 paper](see https://arxiv.org/abs/1910.10683) for more details.
        relative_max_distance (`int`, *optional*, defaults to 128)
            Relative distances greater than this number will be put into the last same bucket. This is for relative
            position calculation. See the [T5 paper](see https://arxiv.org/abs/1910.10683) for more details.
        disable_ngram_loss (`bool`, *optional*, defaults to `False`):
            Whether be trained predicting only the next first token.
        eps (`float`, *optional*, defaults to 0.0):
            Controls the `epsilon` parameter value for label smoothing in the loss calculation. If set to 0, no label
            smoothing is performed.
        use_cache (`bool`, *optional*, defaults to `True`):
            Whether or not the model should return the last key/values attentions (not used by all models).
    Z
prophetnetZpast_key_valuesZnum_attention_headsnum_encoder_attention_heads皙?gelu:w                 {Gz?Tr             F           )activation_dropoutactivation_function
vocab_sizehidden_sizeencoder_ffn_dimnum_encoder_layersr	   decoder_ffn_dimnum_decoder_layersnum_decoder_attention_headsattention_dropoutdropoutmax_position_embeddingsinit_stdis_encoder_decoderadd_cross_attentiondecoder_start_token_idngramnum_bucketsrelative_max_distancedisable_ngram_losseps	use_cachepad_token_idbos_token_ideos_token_idc              	      s   || _ || _|| _|| _|| _|| _|	| _|
| _|| _|| _	|| _
|| _|| _|| _|| _|| _|| _|| _|| _|| _t jf ||||||d| d S )N)r.   r/   r0   r%   r&   r'   )r   r   r   r   r	   r   r   r    r#   r$   r   r(   r)   r*   r+   r,   r!   r   r"   r-   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.   r/   r0   kwargs	__class__ x/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/transformers/models/prophetnet/configuration_prophetnet.pyr2   k   s<    zProphetNetConfig.__init__)returnc                 C   s   | j | j S )N)r   r   )r3   r7   r7   r8   num_hidden_layers   s    z"ProphetNetConfig.num_hidden_layersc                 C   s   t dd S )NzyThis model does not support the setting of `num_hidden_layers`. Please set `num_encoder_layers` and `num_decoder_layers`.)NotImplementedError)r3   valuer7   r7   r8   r:      s    )r
   r   r   r   r   r   r   r   r   r   r
   r
   r   r   TTr   r   r   r   Fr   Tr   r   r   )__name__
__module____qualname____doc__Z
model_typeZkeys_to_ignore_at_inferenceZattribute_mapr   floatr   strr   intboolr2   propertyr:   setter__classcell__r7   r7   r5   r8   r       s   D                           Br   N)r@   typingr   r   r   Zconfiguration_utilsr   utilsr   Z
get_loggerr=   loggerZ(PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAPr   r7   r7   r7   r8   <module>   s   
