



"""simple docstring"""







from typing import Callable, Optional, Union

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


lowercase__		:    Dict				   =     logging.get_logger(__name__)

lowercase__		:    Any				   =     {
    """microsoft/xprophetnet-large-wiki100-cased""": (
        """https://huggingface.co/microsoft/xprophetnet-large-wiki100-cased/resolve/main/config.json"""
    ),
}







class 				UpperCamelCase__       (     lowercase_  ):




      """simple docstring"""




      _SCREAMING_SNAKE_CASE      =					"""xlm-prophetnet"""
      _SCREAMING_SNAKE_CASE      =					["""past_key_values"""]
      _SCREAMING_SNAKE_CASE      =					{
          """num_attention_heads""": """num_encoder_attention_heads""",
      }



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

        # parameters for xlmprophetnet
        lowerCAmelCase_       :    str								=			ngram
        lowerCAmelCase_       :    Tuple								=			num_buckets
        lowerCAmelCase_       :    Optional[int]								=			relative_max_distance
        lowerCAmelCase_       :    Dict								=			disable_ngram_loss
        lowerCAmelCase_       :    str								=			eps

        # 3 Types of Dropout
        lowerCAmelCase_       :    int								=			attention_dropout
        lowerCAmelCase_       :    Any								=			activation_dropout
        lowerCAmelCase_       :    Optional[int]								=			dropout

        lowerCAmelCase_       :    Tuple								=			use_cache

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



      @property
      def 					SCREAMING_SNAKE_CASE__			(				self    :				Tuple	):
        return self.num_encoder_layers + self.num_decoder_layers





      @num_hidden_layers.setter
      def 					SCREAMING_SNAKE_CASE__			(				self    :				List[Any]   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]	):
        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_torch_available,
)


lowercase__		:    Dict				   =     {
    """configuration_falcon""": ["""FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FalconConfig"""],
}

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     lowercase__		:    str				   =     [
         """FALCON_PRETRAINED_MODEL_ARCHIVE_LIST""",
         """FalconForCausalLM""",
         """FalconModel""",
         """FalconPreTrainedModel""",
         """FalconForSequenceClassification""",
         """FalconForTokenClassification""",
         """FalconForQuestionAnswering""",
     ]


if TYPE_CHECKING:
     from .configuration_falcon import FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP, FalconConfig

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_falcon import (
              FALCON_PRETRAINED_MODEL_ARCHIVE_LIST,
              FalconForCausalLM,
              FalconForQuestionAnswering,
              FalconForSequenceClassification,
              FalconForTokenClassification,
              FalconModel,
              FalconPreTrainedModel,
          )


else:
     import sys

     lowercase__		:    Dict				   =     _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)





