
    g"                     r    d Z ddlmZmZmZ ddlmZ ddlmZ  ej	        e
          Z G d de          ZdS )	zProphetNet model configuration    )CallableOptionalUnion   )PretrainedConfig)loggingc            6       X    e Zd ZdZdZdgZddiZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d4dee         dee	e
ef                  dee         dee         dee         dee         dee         dee         dee         dee         d ee         d!ee         d"ee         d#ee         d$ee         d%ee         d&ee         d'ee         d(ee         d)ee         d*ee         d+ee         d,ee         d-ee         d.ee         d/ee         f4 fd0Zed1efd2            Zej        d3             Z xZS )5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).
    
prophetnetpast_key_values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_layers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           
      `   || _         || _        || _        || _        || _        || _        |	| _        |
| _        || _        || _	        || _
        || _        || _        || _        || _        || _        || _        || _        || _        || _         t)                      j        d||||||d| d S )N)r3   r4   r5   r*   r+   r,    )r   r    r!   r"   r   r#   r$   r%   r(   r)   r   r-   r.   r/   r0   r1   r&   r   r'   r2   super__init__)selfr   r   r   r    r!   r"   r   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   kwargs	__class__s                               s/var/www/html/ai-engine/env/lib/python3.11/site-packages/transformers/models/prophetnet/configuration_prophetnet.pyr9   zProphetNetConfig.__init__f   s    < %&."4+F(."4+F('>$ #6  
&%:""4 "3"4" 	
%%%1 3#9	
 	
 	
 	
 	
 	
 	
    returnc                      | j         | j        z   S )N)r"   r$   )r:   s    r=   num_hidden_layersz"ProphetNetConfig.num_hidden_layers   s    &)@@@r>   c                      t          d          )NzyThis model does not support the setting of `num_hidden_layers`. Please set `num_encoder_layers` and `num_decoder_layers`.)NotImplementedError)r:   values     r=   rA   z"ProphetNetConfig.num_hidden_layers   s    !%
 
 	
r>   )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__
model_typekeys_to_ignore_at_inferenceattribute_mapr   floatr   strr   intboolr9   propertyrA   setter__classcell__)r<   s   @r=   r
   r
      s       C CJ J#4"5<M /2>D$)%))-,.57)-,.57-0#&14$(-1.201 %'/2-2"$(&'&'&'7@
 @
$UO@
 &eCM&:;@
 SM	@

 c]@
 "#@
 %SM@
 &.c]@
 "#@
 %SM@
 &.c]@
 $E?@
 %@
 "*#@
 5/@
  %TN!@
" &d^#@
$ !)%@
& }'@
( c])@
*  (}+@
, %TN-@
. e_/@
0 D>1@
2 sm3@
4 sm5@
6 sm7@
 @
 @
 @
 @
 @
D A3 A A A XA 
 
 
 
 
 
 
r>   r
   N)rH   typingr   r   r   configuration_utilsr   utilsr   
get_loggerrE   loggerr
   r7   r>   r=   <module>rX      s    % $ , , , , , , , , , , 3 3 3 3 3 3       
	H	%	%W
 W
 W
 W
 W
' W
 W
 W
 W
 W
r>   