





from typing import Callable, Optional, Union

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


_UpperCAmelCase       : int			     =       logging.get_logger(__name__)

_UpperCAmelCase       : List[str]			     =       {
    """microsoft/xprophetnet-large-wiki100-cased""": (
        """https://huggingface.co/microsoft/xprophetnet-large-wiki100-cased/resolve/main/config.json"""
    ),
}

class      lowerCAmelCase							(      __UpperCamelCase    ):
 UpperCAmelCase__									=	"""xlm-prophetnet"""
 UpperCAmelCase__									=	["""past_key_values"""]
 UpperCAmelCase__									=	{
     """num_attention_heads""": """num_encoder_attention_heads""",
 }
 def __init__(   self						:   Tuple    ,  UpperCAmelCase						:   Optional[float] = 0.1    ,  UpperCAmelCase						:   Optional[Union[str, Callable]] = "gelu"    ,  UpperCAmelCase						:   Optional[int] = 30522    ,  UpperCAmelCase						:   Optional[int] = 1024    ,  UpperCAmelCase						:   Optional[int] = 4096    ,  UpperCAmelCase						:   Optional[int] = 12    ,  UpperCAmelCase						:   Optional[int] = 16    ,  UpperCAmelCase						:   Optional[int] = 4096    ,  UpperCAmelCase						:   Optional[int] = 12    ,  UpperCAmelCase						:   Optional[int] = 16    ,  UpperCAmelCase						:   Optional[float] = 0.1    ,  UpperCAmelCase						:   Optional[float] = 0.1    ,  UpperCAmelCase						:   Optional[int] = 512    ,  UpperCAmelCase						:   Optional[float] = 0.0_2    ,  UpperCAmelCase						:   Optional[bool] = True    ,  UpperCAmelCase						:   Optional[bool] = True    ,  UpperCAmelCase						:   Optional[int] = 0    ,  UpperCAmelCase						:   Optional[int] = 2    ,  UpperCAmelCase						:   Optional[int] = 32    ,  UpperCAmelCase						:   Optional[int] = 128    ,  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						:   str    ,  )    ->			Optional[int]:
     lowerCamelCase__					:   str      				=	vocab_size
     lowerCamelCase__					:   Optional[Any]      				=	hidden_size
     lowerCamelCase__					:   str      				=	encoder_ffn_dim
     lowerCamelCase__					:   str      				=	num_encoder_layers
     lowerCamelCase__					:   str      				=	num_encoder_attention_heads
     lowerCamelCase__					:   List[str]      				=	decoder_ffn_dim
     lowerCamelCase__					:   int      				=	num_decoder_layers
     lowerCamelCase__					:   Tuple      				=	num_decoder_attention_heads
     lowerCamelCase__					:   Dict      				=	max_position_embeddings
     lowerCamelCase__					:   Optional[int]      				=	init_std  # Normal(0, this parameter)
     lowerCamelCase__					:   Any      				=	activation_function

     # parameters for xlmprophetnet
     lowerCamelCase__					:   int      				=	ngram
     lowerCamelCase__					:   List[Any]      				=	num_buckets
     lowerCamelCase__					:   List[str]      				=	relative_max_distance
     lowerCamelCase__					:   List[Any]      				=	disable_ngram_loss
     lowerCamelCase__					:   Dict      				=	eps

     # 3 Types of Dropout
     lowerCamelCase__					:   str      				=	attention_dropout
     lowerCamelCase__					:   Union[str, Any]      				=	activation_dropout
     lowerCamelCase__					:   List[Any]      				=	dropout

     lowerCamelCase__					:   Tuple      				=	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   A_			(   self						:   List[str]			)    ->			int:
     return self.num_encoder_layers + self.num_decoder_layers







 @num_hidden_layers.setter
 def   A_			(   self						:   Dict    ,  UpperCAmelCase						:   str			)    ->			Dict:
     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

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_UpperCAmelCase       : List[str]			     =       {
    """configuration_autoformer""": [
        """AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """AutoformerConfig""",
    ],
}

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _UpperCAmelCase       : List[Any]			     =       [
        """AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST""",
        """AutoformerForPrediction""",
        """AutoformerModel""",
        """AutoformerPreTrainedModel""",
    ]


if TYPE_CHECKING:
    from .configuration_autoformer import (
        AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
        AutoformerConfig,
    )

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_autoformer import (
            AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
            AutoformerForPrediction,
            AutoformerModel,
            AutoformerPreTrainedModel,
        )

else:
    import sys

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





