a
    ½Àh½"  ã                   @   sT   d Z ddlmZmZm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ProphetNet model configurationé    )ÚCallableÚOptionalÚUnioné   )ÚPretrainedConfig)Úloggingc                       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://huggingface.co/papers/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://huggingface.co/papers/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  é   é   é   é   é   ç{®Gáz”?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__© ús/var/www/html/assistant/venv/lib/python3.9/site-packages/transformers/models/prophetnet/configuration_prophetnet.pyr2   f   s<    úùzProphetNetConfig.__init__)Úreturnc                 C   s   | j S )N)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~   Eÿ                          ååBr   N)r@   Útypingr   r   r   Zconfiguration_utilsr   Úutilsr   Z
get_loggerr=   Úloggerr   Ú__all__r7   r7   r7   r8   Ú<module>   s   
 