

from typing import Callable, Optional, Union

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


_a:      Optional[int]								=     logging.get_logger(__name__)

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

class   __UpperCamelCase      (   UpperCAmelCase_  ):
	SCREAMING_SNAKE_CASE__      			=       'prophetnet'
	SCREAMING_SNAKE_CASE__      			=       ['past_key_values']
	SCREAMING_SNAKE_CASE__      			=       {
	    'num_attention_heads': 'num_encoder_attention_heads',
	}




	def __init__(						self		:  List[Any]						,		lowerCAmelCase		:  Optional[int] = 0.1						,		lowerCAmelCase		:  Optional[int] = "gelu"						,		lowerCAmelCase		:  List[str] = 30_522						,		lowerCAmelCase		:  Tuple = 1_024						,		lowerCAmelCase		:  Tuple = 4_096						,		lowerCAmelCase		:  List[str] = 12						,		lowerCAmelCase		:  Union[str, Any] = 16						,		lowerCAmelCase		:  Dict = 4_096						,		lowerCAmelCase		:  Any = 12						,		lowerCAmelCase		:  Union[str, Any] = 16						,		lowerCAmelCase		:  List[str] = 0.1						,		lowerCAmelCase		:  int = 0.1						,		lowerCAmelCase		:  Optional[Any] = 512						,		lowerCAmelCase		:  int = 0.02						,		lowerCAmelCase		:  int = True						,		lowerCAmelCase		:  List[Any] = True						,		lowerCAmelCase		:  Optional[int] = 0						,		lowerCAmelCase		:  Any = 2						,		lowerCAmelCase		:  int = 32						,		lowerCAmelCase		:  Any = 128						,		lowerCAmelCase		:  Any = False						,		lowerCAmelCase		:  Optional[int] = 0.0						,		lowerCAmelCase		:  List[str] = True						,		lowerCAmelCase		:  Any = 0						,		lowerCAmelCase		:  str = 1						,		lowerCAmelCase		:  List[str] = 2						,		**lowerCAmelCase		:  str						,		):


		'''simple docstring'''







		UpperCAmelCase_    			=     vocab_size
		UpperCAmelCase_    			=     hidden_size
		UpperCAmelCase_    			=     encoder_ffn_dim
		UpperCAmelCase_    			=     num_encoder_layers
		UpperCAmelCase_    			=     num_encoder_attention_heads
		UpperCAmelCase_    			=     decoder_ffn_dim
		UpperCAmelCase_    			=     num_decoder_layers
		UpperCAmelCase_    			=     num_decoder_attention_heads
		UpperCAmelCase_    			=     max_position_embeddings
		UpperCAmelCase_    			=     init_std  # Normal(0, this parameter)
		UpperCAmelCase_    			=     activation_function

		# parameters for prophetnet
		UpperCAmelCase_    			=     ngram
		UpperCAmelCase_    			=     num_buckets
		UpperCAmelCase_    			=     relative_max_distance
		UpperCAmelCase_    			=     disable_ngram_loss
		UpperCAmelCase_    			=     eps

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

		UpperCAmelCase_    			=     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		:  int							):


		'''simple docstring'''







		return self.num_encoder_layers + self.num_decoder_layers




	@num_hidden_layers.setter
	def  __A   (						self		:  Dict						,		lowerCAmelCase		:  Dict							):


		'''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_tf_available,
    is_torch_available,
    is_vision_available,
)


_a:      Tuple								=     {
    """configuration_segformer""": ["""SEGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """SegformerConfig""", """SegformerOnnxConfig"""]
}

try:
				if not is_vision_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				_a:      List[str]								=     ["""SegformerFeatureExtractor"""]
				_a:      Union[str, Any]								=     ["""SegformerImageProcessor"""]

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				_a:      Any								=     [
				    """SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST""",
				    """SegformerDecodeHead""",
				    """SegformerForImageClassification""",
				    """SegformerForSemanticSegmentation""",
				    """SegformerLayer""",
				    """SegformerModel""",
				    """SegformerPreTrainedModel""",
				]

try:
				if not is_tf_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				_a:      Optional[Any]								=     [
				    """TF_SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST""",
				    """TFSegformerDecodeHead""",
				    """TFSegformerForImageClassification""",
				    """TFSegformerForSemanticSegmentation""",
				    """TFSegformerModel""",
				    """TFSegformerPreTrainedModel""",
				]


if TYPE_CHECKING:
				from .configuration_segformer import SEGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, SegformerConfig, SegformerOnnxConfig

				try:
								if not is_vision_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .feature_extraction_segformer import SegformerFeatureExtractor
								from .image_processing_segformer import SegformerImageProcessor

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_segformer import (
								    SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
								    SegformerDecodeHead,
								    SegformerForImageClassification,
								    SegformerForSemanticSegmentation,
								    SegformerLayer,
								    SegformerModel,
								    SegformerPreTrainedModel,
								)
				try:
								if not is_tf_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_tf_segformer import (
								    TF_SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
								    TFSegformerDecodeHead,
								    TFSegformerForImageClassification,
								    TFSegformerForSemanticSegmentation,
								    TFSegformerModel,
								    TFSegformerPreTrainedModel,
								)

else:
				import sys

				_a:      Optional[int]								=     _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)