



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


__snake_case				:		Any										=logging.get_logger(__name__)

__snake_case				:		Union[str, Any]										={
    """microsoft/deberta-v2-xlarge""": """https://huggingface.co/microsoft/deberta-v2-xlarge/resolve/main/config.json""",
    """microsoft/deberta-v2-xxlarge""": """https://huggingface.co/microsoft/deberta-v2-xxlarge/resolve/main/config.json""",
    """microsoft/deberta-v2-xlarge-mnli""": (
        """https://huggingface.co/microsoft/deberta-v2-xlarge-mnli/resolve/main/config.json"""
    ),
    """microsoft/deberta-v2-xxlarge-mnli""": (
        """https://huggingface.co/microsoft/deberta-v2-xxlarge-mnli/resolve/main/config.json"""
    ),
}



class        lowerCamelCase__			(							_UpperCAmelCase):




		'''simple docstring'''



		snake_case_	='''deberta-v2'''



		def __init__(self		,__lowerCamelCase=12_81_00		,__lowerCamelCase=15_36		,__lowerCamelCase=24		,__lowerCamelCase=24		,__lowerCamelCase=61_44		,__lowerCamelCase="gelu"		,__lowerCamelCase=0.1		,__lowerCamelCase=0.1		,__lowerCamelCase=5_12		,__lowerCamelCase=0		,__lowerCamelCase=0.02		,__lowerCamelCase=1e-7		,__lowerCamelCase=False		,__lowerCamelCase=-1		,__lowerCamelCase=0		,__lowerCamelCase=True		,__lowerCamelCase=None		,__lowerCamelCase=0		,__lowerCamelCase="gelu"		,**__lowerCamelCase		,)     ->			Optional[Any]:

						"""simple docstring"""






						super().__init__(**lowerCAmelCase__ )

						lowerCAmelCase__     :				int												=     hidden_size
						lowerCAmelCase__     :				Union[str, Any]												=     num_hidden_layers
						lowerCAmelCase__     :				List[str]												=     num_attention_heads
						lowerCAmelCase__     :				Optional[int]												=     intermediate_size
						lowerCAmelCase__     :				Optional[Any]												=     hidden_act
						lowerCAmelCase__     :				List[str]												=     hidden_dropout_prob
						lowerCAmelCase__     :				int												=     attention_probs_dropout_prob
						lowerCAmelCase__     :				Union[str, Any]												=     max_position_embeddings
						lowerCAmelCase__     :				List[str]												=     type_vocab_size
						lowerCAmelCase__     :				Dict												=     initializer_range
						lowerCAmelCase__     :				Any												=     relative_attention
						lowerCAmelCase__     :				Tuple												=     max_relative_positions
						lowerCAmelCase__     :				Any												=     pad_token_id
						lowerCAmelCase__     :				int												=     position_biased_input

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

						lowerCAmelCase__     :				Union[str, Any]												=     pos_att_type
						lowerCAmelCase__     :				Union[str, Any]												=     vocab_size
						lowerCAmelCase__     :				Dict												=     layer_norm_eps

						lowerCAmelCase__     :				Dict												=     kwargs.get('''pooler_hidden_size'''		,lowerCAmelCase__ )
						lowerCAmelCase__     :				int												=     pooler_dropout
						lowerCAmelCase__     :				Any												=     pooler_hidden_act



class        lowerCamelCase__			(							_UpperCAmelCase):




		'''simple docstring'''



		@property
		def 		lowerCAmelCase__      (self )     ->			Mapping[str, Mapping[int, str]]:

						"""simple docstring"""






						if self.task == "multiple-choice":
										lowerCAmelCase__     :				List[str]												=     {0: '''batch''', 1: '''choice''', 2: '''sequence'''}
						else:
										lowerCAmelCase__     :				Optional[Any]												=     {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 		lowerCAmelCase__      (self )     ->			int:

						"""simple docstring"""






						return 12



		def 		lowerCAmelCase__      (self		,__lowerCamelCase		,__lowerCamelCase = -1		,__lowerCamelCase = -1		,__lowerCamelCase = -1		,__lowerCamelCase = False		,__lowerCamelCase = None		,__lowerCamelCase = 3		,__lowerCamelCase = 40		,__lowerCamelCase = 40		,__lowerCamelCase = None		,)     ->			Mapping[str, Any]:

						"""simple docstring"""






						lowerCAmelCase__     :				Any												=     super().generate_dummy_inputs(preprocessor=lowerCAmelCase__		,framework=lowerCAmelCase__ )
						if self._config.type_vocab_size == 0 and "token_type_ids" in dummy_inputs:
										del dummy_inputs["token_type_ids"]
						return dummy_inputs


from typing import List, Optional, TypeVar

from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets
from .dataset_dict import DatasetDict, IterableDatasetDict
from .info import DatasetInfo
from .iterable_dataset import IterableDataset, _concatenate_iterable_datasets, _interleave_iterable_datasets
from .splits import NamedSplit
from .utils import logging
from .utils.py_utils import Literal


__a  :     Optional[Any]       =  logging.get_logger(__name__)


__a  :     List[str]       =  TypeVar("""DatasetType""", Dataset, IterableDataset)





def 				UpperCAmelCase						(    lowercase							,			lowercase = None							,			lowercase = None							,			lowercase = None							,			lowercase = None							,			lowercase = "first_exhausted"							,			):







				"""simple docstring"""



				from .arrow_dataset import Dataset
				from .iterable_dataset import IterableDataset

				if not datasets:
								raise ValueError('''Unable to interleave an empty list of datasets.'''							)
				for i, dataset in enumerate(lowercase							):
								if not isinstance(lowercase							,			(Dataset, IterableDataset)							):
												if isinstance(lowercase							,			(DatasetDict, IterableDatasetDict)							):
																if not dataset:
																				raise ValueError(
																				    F"Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} "
																				    '''is an empty dataset dictionary.'''							)
																raise ValueError(
																    F"Dataset at position {i} has at least one split: {list(lowercase							)}\n"
																    F"Please pick one to interleave with the other datasets, for example: dataset['{next(iter(lowercase							)							)}']"							)
												raise ValueError(
												    F"Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} is a {type(lowercase							).__name__}."							)
								if i == 0:
												__lowercase			,     __lowercase 			=							(
												    (Dataset, IterableDataset) if isinstance(lowercase							,			lowercase							) else (IterableDataset, Dataset)
												)
								elif not isinstance(lowercase							,			lowercase							):
												raise ValueError(
												    F"Unable to interleave a {dataset_type.__name__} (at position 0) with a {other_type.__name__} (at position {i}). Expected a list of Dataset objects or a list of IterableDataset objects."							)
				if stopping_strategy not in ["first_exhausted", "all_exhausted"]:
								raise ValueError(F"{stopping_strategy} is not supported. Please enter a valid stopping_strategy."							)
				if dataset_type is Dataset:
								return _interleave_map_style_datasets(
								    lowercase							,			lowercase							,			lowercase							,			info=lowercase							,			split=lowercase							,			stopping_strategy=lowercase							)
				else:
								return _interleave_iterable_datasets(
								    lowercase							,			lowercase							,			lowercase							,			info=lowercase							,			split=lowercase							,			stopping_strategy=lowercase							)





def 				UpperCAmelCase						(    lowercase							,			lowercase = None							,			lowercase = None							,			lowercase = 0							,			):







				"""simple docstring"""



				if not dsets:
								raise ValueError('''Unable to concatenate an empty list of datasets.'''							)
				for i, dataset in enumerate(lowercase							):
								if not isinstance(lowercase							,			(Dataset, IterableDataset)							):
												if isinstance(lowercase							,			(DatasetDict, IterableDatasetDict)							):
																if not dataset:
																				raise ValueError(
																				    F"Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} "
																				    '''is an empty dataset dictionary.'''							)
																raise ValueError(
																    F"Dataset at position {i} has at least one split: {list(lowercase							)}\n"
																    F"Please pick one to interleave with the other datasets, for example: dataset['{next(iter(lowercase							)							)}']"							)
												raise ValueError(
												    F"Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} is a {type(lowercase							).__name__}."							)
								if i == 0:
												__lowercase			,     __lowercase 			=							(
												    (Dataset, IterableDataset) if isinstance(lowercase							,			lowercase							) else (IterableDataset, Dataset)
												)
								elif not isinstance(lowercase							,			lowercase							):
												raise ValueError(
												    F"Unable to interleave a {dataset_type.__name__} (at position 0) with a {other_type.__name__} (at position {i}). Expected a list of Dataset objects or a list of IterableDataset objects."							)
				if dataset_type is Dataset:
								return _concatenate_map_style_datasets(lowercase							,			info=lowercase							,			split=lowercase							,			axis=lowercase							)
				else:
								return _concatenate_iterable_datasets(lowercase							,			info=lowercase							,			split=lowercase							,			axis=lowercase							)