




'''simple docstring'''


from typing import Callable, Optional, Union

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


lowerCAmelCase_			:     Union[str, Any]							    =     logging.get_logger(__name__)

lowerCAmelCase_			:     Optional[Any]							    =     {
    'microsoft/prophetnet-large-uncased': (
        'https://huggingface.co/microsoft/prophetnet-large-uncased/resolve/main/config.json'
    ),
}







class     SCREAMING_SNAKE_CASE						(	snake_case_							):
      __magic_name__     :					int             =				'''prophetnet'''
      __magic_name__     :					Dict             =				['''past_key_values''']
      __magic_name__     :					Optional[int]             =				{
          '''num_attention_heads''': '''num_encoder_attention_heads''',
      }






      def __init__(   self      :     str	,	lowercase__      :     Optional[float] = 0.1	,	lowercase__      :     Optional[Union[str, Callable]] = "gelu"	,	lowercase__      :     Optional[int] = 3_0522	,	lowercase__      :     Optional[int] = 1024	,	lowercase__      :     Optional[int] = 4096	,	lowercase__      :     Optional[int] = 12	,	lowercase__      :     Optional[int] = 16	,	lowercase__      :     Optional[int] = 4096	,	lowercase__      :     Optional[int] = 12	,	lowercase__      :     Optional[int] = 16	,	lowercase__      :     Optional[float] = 0.1	,	lowercase__      :     Optional[float] = 0.1	,	lowercase__      :     Optional[int] = 512	,	lowercase__      :     Optional[float] = 0.02	,	lowercase__      :     Optional[bool] = True	,	lowercase__      :     Optional[bool] = True	,	lowercase__      :     Optional[int] = 0	,	lowercase__      :     Optional[int] = 2	,	lowercase__      :     Optional[int] = 32	,	lowercase__      :     Optional[int] = 128	,	lowercase__      :     Optional[bool] = False	,	lowercase__      :     Optional[float] = 0.0	,	lowercase__      :     Optional[bool] = True	,	lowercase__      :     Optional[int] = 0	,	lowercase__      :     Optional[int] = 1	,	lowercase__      :     Optional[int] = 2	,	**lowercase__      :     str	,	):


           '''simple docstring'''

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

           # parameters for prophetnet
           a_    :       Dict    	=     ngram
           a_    :       List[str]    	=     num_buckets
           a_    :       Any    	=     relative_max_distance
           a_    :       Tuple    	=     disable_ngram_loss
           a_    :       Union[str, Any]    	=     eps

           # 3 Types of Dropout
           a_    :       Dict    	=     attention_dropout
           a_    :       Union[str, Any]    	=     activation_dropout
           a_    :       int    	=     dropout

           a_    :       Optional[int]    	=     use_cache

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






      @property
      def        lowercase_	(   self      :     Union[str, Any]					):


           '''simple docstring'''

           return self.num_encoder_layers + self.num_decoder_layers






      @num_hidden_layers.setter
      def        lowercase_	(   self      :     Optional[Any]	,	lowercase__      :     Optional[int]					):


           '''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'''


from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available


lowerCAmelCase_			:     str							    =     {}

try:
 if not is_sentencepiece_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCAmelCase_			:     Optional[int]							    =     ['CpmTokenizer']

try:
 if not is_tokenizers_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCAmelCase_			:     Union[str, Any]							    =     ['CpmTokenizerFast']


if TYPE_CHECKING:
 try:
  if not is_sentencepiece_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_cpm import CpmTokenizer

 try:
  if not is_tokenizers_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_cpm_fast import CpmTokenizerFast

else:
 import sys

 lowerCAmelCase_			:     Any							    =     _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)
