





"""simple docstring"""




from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


UpperCamelCase_	 ={
    """configuration_deberta_v2""": ["""DEBERTA_V2_PRETRAINED_CONFIG_ARCHIVE_MAP""", """DebertaV2Config""", """DebertaV2OnnxConfig"""],
    """tokenization_deberta_v2""": ["""DebertaV2Tokenizer"""],
}

try:
						if not is_tokenizers_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						UpperCamelCase_	 =["""DebertaV2TokenizerFast"""]

try:
						if not is_tf_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						UpperCamelCase_	 =[
						    """TF_DEBERTA_V2_PRETRAINED_MODEL_ARCHIVE_LIST""",
						    """TFDebertaV2ForMaskedLM""",
						    """TFDebertaV2ForQuestionAnswering""",
						    """TFDebertaV2ForSequenceClassification""",
						    """TFDebertaV2ForTokenClassification""",
						    """TFDebertaV2Model""",
						    """TFDebertaV2PreTrainedModel""",
						]

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						UpperCamelCase_	 =[
						    """DEBERTA_V2_PRETRAINED_MODEL_ARCHIVE_LIST""",
						    """DebertaV2ForMaskedLM""",
						    """DebertaV2ForMultipleChoice""",
						    """DebertaV2ForQuestionAnswering""",
						    """DebertaV2ForSequenceClassification""",
						    """DebertaV2ForTokenClassification""",
						    """DebertaV2Model""",
						    """DebertaV2PreTrainedModel""",
						]


if TYPE_CHECKING:
						from .configuration_deberta_va import (
						    DEBERTA_V2_PRETRAINED_CONFIG_ARCHIVE_MAP,
						    DebertaVaConfig,
						    DebertaVaOnnxConfig,
						)
						from .tokenization_deberta_va import DebertaVaTokenizer

						try:
												if not is_tokenizers_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .tokenization_deberta_va_fast import DebertaVaTokenizerFast

						try:
												if not is_tf_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_tf_deberta_va import (
												    TF_DEBERTA_V2_PRETRAINED_MODEL_ARCHIVE_LIST,
												    TFDebertaVaForMaskedLM,
												    TFDebertaVaForQuestionAnswering,
												    TFDebertaVaForSequenceClassification,
												    TFDebertaVaForTokenClassification,
												    TFDebertaVaModel,
												    TFDebertaVaPreTrainedModel,
												)

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_deberta_va import (
												    DEBERTA_V2_PRETRAINED_MODEL_ARCHIVE_LIST,
												    DebertaVaForMaskedLM,
												    DebertaVaForMultipleChoice,
												    DebertaVaForQuestionAnswering,
												    DebertaVaForSequenceClassification,
												    DebertaVaForTokenClassification,
												    DebertaVaModel,
												    DebertaVaPreTrainedModel,
												)

else:
						import sys

						UpperCamelCase_	 =_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)







"""simple docstring"""





from typing import Callable, Optional, Union

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


snake_case__		:  Optional[Any]     					=					logging.get_logger(__name__)

snake_case__		:  str     					=					{
    '''microsoft/prophetnet-large-uncased''': (
        '''https://huggingface.co/microsoft/prophetnet-large-uncased/resolve/main/config.json'''
    ),
}



class 		snake_case_(							a__      ):
     __UpperCamelCase	=       '''prophetnet'''
     __UpperCamelCase	=       ['''past_key_values''']
     __UpperCamelCase	=       {
         '''num_attention_heads''': '''num_encoder_attention_heads''',
     }






     def __init__(						self	:       Union[str, Any]       ,					UpperCamelCase_	:       Optional[float] = 0.1       ,					UpperCamelCase_	:       Optional[Union[str, Callable]] = "gelu"       ,					UpperCamelCase_	:       Optional[int] = 3_0_5_2_2       ,					UpperCamelCase_	:       Optional[int] = 1_0_2_4       ,					UpperCamelCase_	:       Optional[int] = 4_0_9_6       ,					UpperCamelCase_	:       Optional[int] = 1_2       ,					UpperCamelCase_	:       Optional[int] = 1_6       ,					UpperCamelCase_	:       Optional[int] = 4_0_9_6       ,					UpperCamelCase_	:       Optional[int] = 1_2       ,					UpperCamelCase_	:       Optional[int] = 1_6       ,					UpperCamelCase_	:       Optional[float] = 0.1       ,					UpperCamelCase_	:       Optional[float] = 0.1       ,					UpperCamelCase_	:       Optional[int] = 5_1_2       ,					UpperCamelCase_	:       Optional[float] = 0.02       ,					UpperCamelCase_	:       Optional[bool] = True       ,					UpperCamelCase_	:       Optional[bool] = True       ,					UpperCamelCase_	:       Optional[int] = 0       ,					UpperCamelCase_	:       Optional[int] = 2       ,					UpperCamelCase_	:       Optional[int] = 3_2       ,					UpperCamelCase_	:       Optional[int] = 1_2_8       ,					UpperCamelCase_	:       Optional[bool] = False       ,					UpperCamelCase_	:       Optional[float] = 0.0       ,					UpperCamelCase_	:       Optional[bool] = True       ,					UpperCamelCase_	:       Optional[int] = 0       ,					UpperCamelCase_	:       Optional[int] = 1       ,					UpperCamelCase_	:       Optional[int] = 2       ,					**UpperCamelCase_	:       List[Any]       ,					):
           lowerCAmelCase       :						Union[str, Any]							= vocab_size
           lowerCAmelCase       :						Any							= hidden_size
           lowerCAmelCase       :						Tuple							= encoder_ffn_dim
           lowerCAmelCase       :						str							= num_encoder_layers
           lowerCAmelCase       :						int							= num_encoder_attention_heads
           lowerCAmelCase       :						Optional[Any]							= decoder_ffn_dim
           lowerCAmelCase       :						Union[str, Any]							= num_decoder_layers
           lowerCAmelCase       :						Union[str, Any]							= num_decoder_attention_heads
           lowerCAmelCase       :						List[Any]							= max_position_embeddings
           lowerCAmelCase       :						Dict							= init_std  # Normal(0, this parameter)
           lowerCAmelCase       :						Optional[int]							= activation_function

           # parameters for prophetnet
           lowerCAmelCase       :						Tuple							= ngram
           lowerCAmelCase       :						List[Any]							= num_buckets
           lowerCAmelCase       :						Optional[Any]							= relative_max_distance
           lowerCAmelCase       :						Dict							= disable_ngram_loss
           lowerCAmelCase       :						Optional[int]							= eps

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

           lowerCAmelCase       :						Optional[int]							= 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	:       str					):
           return self.num_encoder_layers + self.num_decoder_layers






     @num_hidden_layers.setter
     def   lowerCamelCase__  (						self	:       Optional[Any]       ,					UpperCamelCase_	:       int					):
           raise NotImplementedError(
               '''This model does not support the setting of `num_hidden_layers`. Please set `num_encoder_layers` and'''
               ''' `num_decoder_layers`.'''					)


