




from typing import Callable, Optional, Union

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


UpperCAmelCase_									=	logging.get_logger(__name__)

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





class     lowerCamelCase__(					__lowerCamelCase):
      UpperCAmelCase__      :	List[str]    		=   'xlm-prophetnet'
      UpperCAmelCase__      :	List[Any]    		=   ['past_key_values']
      UpperCAmelCase__      :	Optional[Any]    		=   {
          'num_attention_heads': 'num_encoder_attention_heads',
      }
      def __init__(				self: Any    ,       UpperCamelCase_: Optional[float] = 0.1    ,       UpperCamelCase_: Optional[Union[str, Callable]] = "gelu"    ,       UpperCamelCase_: Optional[int] = 3_05_22    ,       UpperCamelCase_: Optional[int] = 10_24    ,       UpperCamelCase_: Optional[int] = 40_96    ,       UpperCamelCase_: Optional[int] = 12    ,       UpperCamelCase_: Optional[int] = 16    ,       UpperCamelCase_: Optional[int] = 40_96    ,       UpperCamelCase_: Optional[int] = 12    ,       UpperCamelCase_: Optional[int] = 16    ,       UpperCamelCase_: Optional[float] = 0.1    ,       UpperCamelCase_: Optional[float] = 0.1    ,       UpperCamelCase_: Optional[int] = 5_12    ,       UpperCamelCase_: Optional[float] = 0.02    ,       UpperCamelCase_: Optional[bool] = True    ,       UpperCamelCase_: Optional[bool] = True    ,       UpperCamelCase_: Optional[int] = 0    ,       UpperCamelCase_: Optional[int] = 2    ,       UpperCamelCase_: Optional[int] = 32    ,       UpperCamelCase_: Optional[int] = 1_28    ,       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_: Tuple    ,       ):
             __lowerCamelCase   =						vocab_size
             __lowerCamelCase   =						hidden_size
             __lowerCamelCase   =						encoder_ffn_dim
             __lowerCamelCase   =						num_encoder_layers
             __lowerCamelCase   =						num_encoder_attention_heads
             __lowerCamelCase   =						decoder_ffn_dim
             __lowerCamelCase   =						num_decoder_layers
             __lowerCamelCase   =						num_decoder_attention_heads
             __lowerCamelCase   =						max_position_embeddings
             __lowerCamelCase   =						init_std  # Normal(0, this parameter)
             __lowerCamelCase   =						activation_function

             # parameters for xlmprophetnet
             __lowerCamelCase   =						ngram
             __lowerCamelCase   =						num_buckets
             __lowerCamelCase   =						relative_max_distance
             __lowerCamelCase   =						disable_ngram_loss
             __lowerCamelCase   =						eps

             # 3 Types of Dropout
             __lowerCamelCase   =						attention_dropout
             __lowerCamelCase   =						activation_dropout
             __lowerCamelCase   =						dropout

             __lowerCamelCase   =						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: Tuple   ):
             return self.num_encoder_layers + self.num_decoder_layers




      @num_hidden_layers.setter
      def 			lowerCAmelCase__						(				self: List[str]    ,       UpperCamelCase_: 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_tf_available,
    is_torch_available,
)


UpperCAmelCase_									=	{
    'configuration_vision_encoder_decoder': ['VisionEncoderDecoderConfig', 'VisionEncoderDecoderOnnxConfig']
}

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       UpperCAmelCase_									=	['VisionEncoderDecoderModel']

try:
       if not is_tf_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       UpperCAmelCase_									=	['TFVisionEncoderDecoderModel']

try:
       if not is_flax_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       UpperCAmelCase_									=	['FlaxVisionEncoderDecoderModel']

if TYPE_CHECKING:
       from .configuration_vision_encoder_decoder import VisionEncoderDecoderConfig, VisionEncoderDecoderOnnxConfig

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_vision_encoder_decoder import VisionEncoderDecoderModel

       try:
              if not is_tf_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_tf_vision_encoder_decoder import TFVisionEncoderDecoderModel

       try:
              if not is_flax_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_flax_vision_encoder_decoder import FlaxVisionEncoderDecoderModel

else:
       import sys

       UpperCAmelCase_									=	_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)

