

"""simple docstring"""

from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Mapping, Optional, Union

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


if TYPE_CHECKING:
							from ... import FeatureExtractionMixin, PreTrainedTokenizerBase, TensorType


a__			:						str							=			logging.get_logger(__name__)

a__			:						str							=			{
    """microsoft/deberta-base""": """https://huggingface.co/microsoft/deberta-base/resolve/main/config.json""",
    """microsoft/deberta-large""": """https://huggingface.co/microsoft/deberta-large/resolve/main/config.json""",
    """microsoft/deberta-xlarge""": """https://huggingface.co/microsoft/deberta-xlarge/resolve/main/config.json""",
    """microsoft/deberta-base-mnli""": """https://huggingface.co/microsoft/deberta-base-mnli/resolve/main/config.json""",
    """microsoft/deberta-large-mnli""": """https://huggingface.co/microsoft/deberta-large-mnli/resolve/main/config.json""",
    """microsoft/deberta-xlarge-mnli""": """https://huggingface.co/microsoft/deberta-xlarge-mnli/resolve/main/config.json""",
}


class       _snake_case  (    UpperCamelCase							):
						__snake_case			      =  'deberta'







						def __init__(self  ,				UpperCAmelCase_=5_0_2_6_5  ,				UpperCAmelCase_=7_6_8  ,				UpperCAmelCase_=1_2  ,				UpperCAmelCase_=1_2  ,				UpperCAmelCase_=3_0_7_2  ,				UpperCAmelCase_="gelu"  ,				UpperCAmelCase_=0.1  ,				UpperCAmelCase_=0.1  ,				UpperCAmelCase_=5_1_2  ,				UpperCAmelCase_=0  ,				UpperCAmelCase_=0.0_2  ,				UpperCAmelCase_=1e-7  ,				UpperCAmelCase_=False  ,				UpperCAmelCase_=-1  ,				UpperCAmelCase_=0  ,				UpperCAmelCase_=True  ,				UpperCAmelCase_=None  ,				UpperCAmelCase_=0  ,				UpperCAmelCase_="gelu"  ,				**UpperCAmelCase_  ,				)      ->    List[str]:
											super().__init__(**UpperCAmelCase_				)

											__lowercase        =      hidden_size
											__lowercase        =      num_hidden_layers
											__lowercase        =      num_attention_heads
											__lowercase        =      intermediate_size
											__lowercase        =      hidden_act
											__lowercase        =      hidden_dropout_prob
											__lowercase        =      attention_probs_dropout_prob
											__lowercase        =      max_position_embeddings
											__lowercase        =      type_vocab_size
											__lowercase        =      initializer_range
											__lowercase        =      relative_attention
											__lowercase        =      max_relative_positions
											__lowercase        =      pad_token_id
											__lowercase        =      position_biased_input

											# Backwards compatibility
											if type(UpperCAmelCase_				) == str:
																__lowercase        =      [x.strip() for x in pos_att_type.lower().split('''|'''				)]

											__lowercase        =      pos_att_type
											__lowercase        =      vocab_size
											__lowercase        =      layer_norm_eps

											__lowercase        =      kwargs.get('''pooler_hidden_size'''  ,				UpperCAmelCase_				)
											__lowercase        =      pooler_dropout
											__lowercase        =      pooler_hidden_act



class       _snake_case  (    UpperCamelCase							):







						@property
						def 							_UpperCamelCase     (self				)      ->    Mapping[str, Mapping[int, str]]:
											if self.task == "multiple-choice":
																__lowercase        =      {0: '''batch''', 1: '''choice''', 2: '''sequence'''}
											else:
																__lowercase        =      {0: '''batch''', 1: '''sequence'''}
											if self._config.type_vocab_size > 0:
																return OrderedDict(
																    [('''input_ids''', dynamic_axis), ('''attention_mask''', dynamic_axis), ('''token_type_ids''', dynamic_axis)]				)
											else:
																return OrderedDict([('''input_ids''', dynamic_axis), ('''attention_mask''', dynamic_axis)]				)







						@property
						def 							_UpperCamelCase     (self				)      ->    int:
											return 1_2







						def 							_UpperCamelCase     (self  ,				UpperCAmelCase_  ,				UpperCAmelCase_ = -1  ,				UpperCAmelCase_ = -1  ,				UpperCAmelCase_ = -1  ,				UpperCAmelCase_ = False  ,				UpperCAmelCase_ = None  ,				UpperCAmelCase_ = 3  ,				UpperCAmelCase_ = 4_0  ,				UpperCAmelCase_ = 4_0  ,				UpperCAmelCase_ = None  ,				)      ->    Mapping[str, Any]:
											__lowercase        =      super().generate_dummy_inputs(preprocessor=UpperCAmelCase_  ,				framework=UpperCAmelCase_				)
											if self._config.type_vocab_size == 0 and "token_type_ids" in dummy_inputs:
																del dummy_inputs["token_type_ids"]
											return dummy_inputs





"""simple docstring"""

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__			:						str							=			["""SegformerImageProcessor"""]

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							a__			:						Optional[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__			:						List[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__			:						Any							=			_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)


