


"""simple docstring"""



from typing import Callable, Optional, Union

from ...configuration_utils import PretrainedConfig
from ...utils import logging


__snake_case   			=    logging.get_logger(__name__)

__snake_case   			=    {
    """microsoft/xprophetnet-large-wiki100-cased""": (
        """https://huggingface.co/microsoft/xprophetnet-large-wiki100-cased/resolve/main/config.json"""
    ),
}







class _lowerCAmelCase				(      snake_case_	):
   __UpperCAmelCase :       List[Any]							  =  '''xlm-prophetnet'''
   __UpperCAmelCase :       int							  =  ['''past_key_values''']
   __UpperCAmelCase :       str							  =  {
       '''num_attention_heads''': '''num_encoder_attention_heads''',
   }







   def __init__(	self						,	UpperCamelCase__ = 0.1						,	UpperCamelCase__ = "gelu"						,	UpperCamelCase__ = 3_0522						,	UpperCamelCase__ = 1024						,	UpperCamelCase__ = 4096						,	UpperCamelCase__ = 12						,	UpperCamelCase__ = 16						,	UpperCamelCase__ = 4096						,	UpperCamelCase__ = 12						,	UpperCamelCase__ = 16						,	UpperCamelCase__ = 0.1						,	UpperCamelCase__ = 0.1						,	UpperCamelCase__ = 512						,	UpperCamelCase__ = 0.02						,	UpperCamelCase__ = True						,	UpperCamelCase__ = True						,	UpperCamelCase__ = 0						,	UpperCamelCase__ = 2						,	UpperCamelCase__ = 32						,	UpperCamelCase__ = 128						,	UpperCamelCase__ = False						,	UpperCamelCase__ = 0.0						,	UpperCamelCase__ = True						,	UpperCamelCase__ = 0						,	UpperCamelCase__ = 1						,	UpperCamelCase__ = 2						,	**UpperCamelCase__						,	)	->		Tuple:

       '''simple docstring'''




       snake_case    :      str      					=    vocab_size
       snake_case    :      Optional[int]      					=    hidden_size
       snake_case    :      Optional[int]      					=    encoder_ffn_dim
       snake_case    :      Dict      					=    num_encoder_layers
       snake_case    :      Optional[Any]      					=    num_encoder_attention_heads
       snake_case    :      Any      					=    decoder_ffn_dim
       snake_case    :      Tuple      					=    num_decoder_layers
       snake_case    :      Tuple      					=    num_decoder_attention_heads
       snake_case    :      Union[str, Any]      					=    max_position_embeddings
       snake_case    :      Optional[int]      					=    init_std  # Normal(0, this parameter)
       snake_case    :      int      					=    activation_function

       # parameters for xlmprophetnet
       snake_case    :      Union[str, Any]      					=    ngram
       snake_case    :      Optional[Any]      					=    num_buckets
       snake_case    :      int      					=    relative_max_distance
       snake_case    :      Union[str, Any]      					=    disable_ngram_loss
       snake_case    :      List[str]      					=    eps

       # 3 Types of Dropout
       snake_case    :      Any      					=    attention_dropout
       snake_case    :      List[Any]      					=    activation_dropout
       snake_case    :      Tuple      					=    dropout

       snake_case    :      Any      					=    use_cache

       super().__init__(
           pad_token_id=UpperCamelCase__						,	bos_token_id=UpperCamelCase__						,	eos_token_id=UpperCamelCase__						,	is_encoder_decoder=UpperCamelCase__						,	add_cross_attention=UpperCamelCase__						,	decoder_start_token_id=UpperCamelCase__						,	**UpperCamelCase__						,	)







   @property
   def  lowerCamelCase		(	self						)	->		int:

       '''simple docstring'''




       return self.num_encoder_layers + self.num_decoder_layers







   @num_hidden_layers.setter
   def  lowerCamelCase		(	self						,	UpperCamelCase__						)	->		List[Any]:

       '''simple docstring'''




       raise NotImplementedError(
           "This model does not support the setting of `num_hidden_layers`. Please set `num_encoder_layers` and"
           " `num_decoder_layers`."						)









"""simple docstring"""



def   __lowerCAmelCase						(						lowercase  :  list[int] )	->						float:


    """simple docstring"""





    if not nums:  # Makes sure that the list is not empty
        raise ValueError("List is empty" )

    snake_case    :      List[str]      					=    sum(lowercase ) / len(lowercase )  # Calculate the average
    return sum(abs(x - average ) for x in nums ) / len(lowercase )


if __name__ == "__main__":
  import doctest

  doctest.testmod()





