




'''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_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


lowerCAmelCase_			:     int							    =     {
    'configuration_dpr': ['DPR_PRETRAINED_CONFIG_ARCHIVE_MAP', 'DPRConfig'],
    'tokenization_dpr': [
        'DPRContextEncoderTokenizer',
        'DPRQuestionEncoderTokenizer',
        'DPRReaderOutput',
        'DPRReaderTokenizer',
    ],
}


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

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCAmelCase_			:     List[str]							    =     [
     'DPR_CONTEXT_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST',
     'DPR_QUESTION_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST',
     'DPR_READER_PRETRAINED_MODEL_ARCHIVE_LIST',
     'DPRContextEncoder',
     'DPRPretrainedContextEncoder',
     'DPRPreTrainedModel',
     'DPRPretrainedQuestionEncoder',
     'DPRPretrainedReader',
     'DPRQuestionEncoder',
     'DPRReader',
 ]

try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCAmelCase_			:     Dict							    =     [
     'TF_DPR_CONTEXT_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST',
     'TF_DPR_QUESTION_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST',
     'TF_DPR_READER_PRETRAINED_MODEL_ARCHIVE_LIST',
     'TFDPRContextEncoder',
     'TFDPRPretrainedContextEncoder',
     'TFDPRPretrainedQuestionEncoder',
     'TFDPRPretrainedReader',
     'TFDPRQuestionEncoder',
     'TFDPRReader',
 ]


if TYPE_CHECKING:
 from .configuration_dpr import DPR_PRETRAINED_CONFIG_ARCHIVE_MAP, DPRConfig
 from .tokenization_dpr import (
     DPRContextEncoderTokenizer,
     DPRQuestionEncoderTokenizer,
     DPRReaderOutput,
     DPRReaderTokenizer,
 )

 try:
  if not is_tokenizers_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_dpr_fast import (
      DPRContextEncoderTokenizerFast,
      DPRQuestionEncoderTokenizerFast,
      DPRReaderTokenizerFast,
  )

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_dpr import (
      DPR_CONTEXT_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST,
      DPR_QUESTION_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST,
      DPR_READER_PRETRAINED_MODEL_ARCHIVE_LIST,
      DPRContextEncoder,
      DPRPretrainedContextEncoder,
      DPRPreTrainedModel,
      DPRPretrainedQuestionEncoder,
      DPRPretrainedReader,
      DPRQuestionEncoder,
      DPRReader,
  )

 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_dpr import (
      TF_DPR_CONTEXT_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST,
      TF_DPR_QUESTION_ENCODER_PRETRAINED_MODEL_ARCHIVE_LIST,
      TF_DPR_READER_PRETRAINED_MODEL_ARCHIVE_LIST,
      TFDPRContextEncoder,
      TFDPRPretrainedContextEncoder,
      TFDPRPretrainedQuestionEncoder,
      TFDPRPretrainedReader,
      TFDPRQuestionEncoder,
      TFDPRReader,
  )

else:
 import sys

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