


from typing import Callable, Optional, Union

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


_SCREAMING_SNAKE_CASE :					int			=	logging.get_logger(__name__)

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

class  UpperCamelCase__ ( __lowerCamelCase			):
      a__   :     Union[str, Any]								=						'prophetnet'
      a__   :     Dict								=						['past_key_values']
      a__   :     Optional[int]								=						{
          'num_attention_heads': 'num_encoder_attention_heads',
      }






      def __init__(     self					:   str,		__lowerCamelCase					:   Optional[float] = 0.1,		__lowerCamelCase					:   Optional[Union[str, Callable]] = "gelu",		__lowerCamelCase					:   Optional[int] = 3_05_22,		__lowerCamelCase					:   Optional[int] = 10_24,		__lowerCamelCase					:   Optional[int] = 40_96,		__lowerCamelCase					:   Optional[int] = 12,		__lowerCamelCase					:   Optional[int] = 16,		__lowerCamelCase					:   Optional[int] = 40_96,		__lowerCamelCase					:   Optional[int] = 12,		__lowerCamelCase					:   Optional[int] = 16,		__lowerCamelCase					:   Optional[float] = 0.1,		__lowerCamelCase					:   Optional[float] = 0.1,		__lowerCamelCase					:   Optional[int] = 5_12,		__lowerCamelCase					:   Optional[float] = 0.02,		__lowerCamelCase					:   Optional[bool] = True,		__lowerCamelCase					:   Optional[bool] = True,		__lowerCamelCase					:   Optional[int] = 0,		__lowerCamelCase					:   Optional[int] = 2,		__lowerCamelCase					:   Optional[int] = 32,		__lowerCamelCase					:   Optional[int] = 1_28,		__lowerCamelCase					:   Optional[bool] = False,		__lowerCamelCase					:   Optional[float] = 0.0,		__lowerCamelCase					:   Optional[bool] = True,		__lowerCamelCase					:   Optional[int] = 0,		__lowerCamelCase					:   Optional[int] = 1,		__lowerCamelCase					:   Optional[int] = 2,		**__lowerCamelCase					:   Optional[int],		)  -> List[Any]:
           UpperCamelCase__							:  int								=     vocab_size
           UpperCamelCase__							:  Any								=     hidden_size
           UpperCamelCase__							:  str								=     encoder_ffn_dim
           UpperCamelCase__							:  Tuple								=     num_encoder_layers
           UpperCamelCase__							:  Dict								=     num_encoder_attention_heads
           UpperCamelCase__							:  Dict								=     decoder_ffn_dim
           UpperCamelCase__							:  str								=     num_decoder_layers
           UpperCamelCase__							:  str								=     num_decoder_attention_heads
           UpperCamelCase__							:  str								=     max_position_embeddings
           UpperCamelCase__							:  Dict								=     init_std  # Normal(0, this parameter)
           UpperCamelCase__							:  Dict								=     activation_function

           # parameters for prophetnet
           UpperCamelCase__							:  List[str]								=     ngram
           UpperCamelCase__							:  Optional[int]								=     num_buckets
           UpperCamelCase__							:  int								=     relative_max_distance
           UpperCamelCase__							:  int								=     disable_ngram_loss
           UpperCamelCase__							:  str								=     eps

           # 3 Types of Dropout
           UpperCamelCase__							:  Optional[Any]								=     attention_dropout
           UpperCamelCase__							:  List[Any]								=     activation_dropout
           UpperCamelCase__							:  str								=     dropout

           UpperCamelCase__							:  int								=     use_cache

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






      @property
      def 	__lowercase(     self					:   List[Any]   )  -> int:
           return self.num_encoder_layers + self.num_decoder_layers






      @num_hidden_layers.setter
      def 	__lowercase(     self					:   Any,		__lowerCamelCase					:   List[Any]   )  -> List[str]:
           raise NotImplementedError(
               '''This model does not support the setting of `num_hidden_layers`. Please set `num_encoder_layers` and'''
               ''' `num_decoder_layers`.'''   )








from typing import TYPE_CHECKING

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


_SCREAMING_SNAKE_CASE :					Tuple			=	{
    """configuration_marian""": ["""MARIAN_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MarianConfig""", """MarianOnnxConfig"""],
}

try:
   if not is_sentencepiece_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _SCREAMING_SNAKE_CASE :					Any			=	["""MarianTokenizer"""]

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _SCREAMING_SNAKE_CASE :					List[Any]			=	[
       """MARIAN_PRETRAINED_MODEL_ARCHIVE_LIST""",
       """MarianForCausalLM""",
       """MarianModel""",
       """MarianMTModel""",
       """MarianPreTrainedModel""",
   ]

try:
   if not is_tf_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _SCREAMING_SNAKE_CASE :					Dict			=	["""TFMarianModel""", """TFMarianMTModel""", """TFMarianPreTrainedModel"""]

try:
   if not is_flax_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _SCREAMING_SNAKE_CASE :					Optional[Any]			=	["""FlaxMarianModel""", """FlaxMarianMTModel""", """FlaxMarianPreTrainedModel"""]

if TYPE_CHECKING:
   from .configuration_marian import MARIAN_PRETRAINED_CONFIG_ARCHIVE_MAP, MarianConfig, MarianOnnxConfig

   try:
      if not is_sentencepiece_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .tokenization_marian import MarianTokenizer

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_marian import (
          MARIAN_PRETRAINED_MODEL_ARCHIVE_LIST,
          MarianForCausalLM,
          MarianModel,
          MarianMTModel,
          MarianPreTrainedModel,
      )

   try:
      if not is_tf_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tf_marian import TFMarianModel, TFMarianMTModel, TFMarianPreTrainedModel

   try:
      if not is_flax_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_flax_marian import FlaxMarianModel, FlaxMarianMTModel, FlaxMarianPreTrainedModel

else:
   import sys

   _SCREAMING_SNAKE_CASE :					List[Any]			=	_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)




