






"""simple docstring"""



from typing import Callable, Optional, Union

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


A_     =				logging.get_logger(__name__)

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






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


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





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

													# parameters for prophetnet
													A__    :	str			=	ngram
													A__    :	Tuple			=	num_buckets
													A__    :	str			=	relative_max_distance
													A__    :	List[str]			=	disable_ngram_loss
													A__    :	Tuple			=	eps

													# 3 Types of Dropout
													A__    :	Tuple			=	attention_dropout
													A__    :	Tuple			=	activation_dropout
													A__    :	Optional[int]			=	dropout

													A__    :	Dict			=	use_cache

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


							@property
							def     _UpperCamelCase							(      self   :    int				):
													'''simple docstring'''





													return self.num_encoder_layers + self.num_decoder_layers


							@num_hidden_layers.setter
							def     _UpperCamelCase							(      self   :    Optional[Any]      ,     snake_case   :    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`."""				)













from typing import TYPE_CHECKING

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


__lowercase				    =      {
    """configuration_bart""": ["""BART_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BartConfig""", """BartOnnxConfig"""],
    """tokenization_bart""": ["""BartTokenizer"""],
}

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

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      __lowercase				    =      [
          """BART_PRETRAINED_MODEL_ARCHIVE_LIST""",
          """BartForCausalLM""",
          """BartForConditionalGeneration""",
          """BartForQuestionAnswering""",
          """BartForSequenceClassification""",
          """BartModel""",
          """BartPretrainedModel""",
          """PretrainedBartModel""",
      ]

try:
      if not is_tf_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      __lowercase				    =      [
          """TFBartForConditionalGeneration""",
          """TFBartForSequenceClassification""",
          """TFBartModel""",
          """TFBartPretrainedModel""",
      ]

try:
      if not is_flax_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      __lowercase				    =      [
          """FlaxBartDecoderPreTrainedModel""",
          """FlaxBartForCausalLM""",
          """FlaxBartForConditionalGeneration""",
          """FlaxBartForQuestionAnswering""",
          """FlaxBartForSequenceClassification""",
          """FlaxBartModel""",
          """FlaxBartPreTrainedModel""",
      ]

if TYPE_CHECKING:
      from .configuration_bart import BART_PRETRAINED_CONFIG_ARCHIVE_MAP, BartConfig, BartOnnxConfig
      from .tokenization_bart import BartTokenizer

      try:
            if not is_tokenizers_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .tokenization_bart_fast import BartTokenizerFast

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_bart import (
                BART_PRETRAINED_MODEL_ARCHIVE_LIST,
                BartForCausalLM,
                BartForConditionalGeneration,
                BartForQuestionAnswering,
                BartForSequenceClassification,
                BartModel,
                BartPretrainedModel,
                PretrainedBartModel,
            )

      try:
            if not is_tf_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_tf_bart import (
                TFBartForConditionalGeneration,
                TFBartForSequenceClassification,
                TFBartModel,
                TFBartPretrainedModel,
            )

      try:
            if not is_flax_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_flax_bart import (
                FlaxBartDecoderPreTrainedModel,
                FlaxBartForCausalLM,
                FlaxBartForConditionalGeneration,
                FlaxBartForQuestionAnswering,
                FlaxBartForSequenceClassification,
                FlaxBartModel,
                FlaxBartPreTrainedModel,
            )

else:
      import sys

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