
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


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

UpperCAmelCase_   :				Optional[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 				SCREAMING_SNAKE_CASE__						(       UpperCamelCase_    ):
      snake_case__       :  Optional[int]       =		'''deberta-v2'''
      def __init__( self       : Optional[Any]  ,							SCREAMING_SNAKE_CASE__       : Any=1_2_8_1_0_0  ,							SCREAMING_SNAKE_CASE__       : Optional[int]=1_5_3_6  ,							SCREAMING_SNAKE_CASE__       : Dict=2_4  ,							SCREAMING_SNAKE_CASE__       : List[str]=2_4  ,							SCREAMING_SNAKE_CASE__       : Tuple=6_1_4_4  ,							SCREAMING_SNAKE_CASE__       : List[Any]="gelu"  ,							SCREAMING_SNAKE_CASE__       : Optional[int]=0.1  ,							SCREAMING_SNAKE_CASE__       : List[str]=0.1  ,							SCREAMING_SNAKE_CASE__       : Optional[int]=5_1_2  ,							SCREAMING_SNAKE_CASE__       : Optional[Any]=0  ,							SCREAMING_SNAKE_CASE__       : Union[str, Any]=0.02  ,							SCREAMING_SNAKE_CASE__       : List[Any]=1E-7  ,							SCREAMING_SNAKE_CASE__       : List[str]=False  ,							SCREAMING_SNAKE_CASE__       : str=-1  ,							SCREAMING_SNAKE_CASE__       : List[Any]=0  ,							SCREAMING_SNAKE_CASE__       : List[Any]=True  ,							SCREAMING_SNAKE_CASE__       : Optional[Any]=None  ,							SCREAMING_SNAKE_CASE__       : Tuple=0  ,							SCREAMING_SNAKE_CASE__       : str="gelu"  ,							**SCREAMING_SNAKE_CASE__       : Optional[int]  ,							)	->    List[str]:
             super().__init__(**UpperCamelCase__  )

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

             # Backwards compatibility
             if type(UpperCamelCase__  ) == str:
                    a_      :	Optional[int]							=						[x.strip() for x in pos_att_type.lower().split('|'  )]

             a_      :	Any							=						pos_att_type
             a_      :	int							=						vocab_size
             a_      :	Dict							=						layer_norm_eps

             a_      :	Tuple							=						kwargs.get('pooler_hidden_size'  ,							UpperCamelCase__  )
             a_      :	Any							=						pooler_dropout
             a_      :	Union[str, Any]							=						pooler_hidden_act
class 				SCREAMING_SNAKE_CASE__						(       UpperCamelCase_    ):
      @property
      def  SCREAMING_SNAKE_CASE							( self       : Union[str, Any]  )	->    List[Any]:





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

      def  SCREAMING_SNAKE_CASE							( self       : Dict  ,							SCREAMING_SNAKE_CASE__       : Union["PreTrainedTokenizerBase", "FeatureExtractionMixin"]  ,							SCREAMING_SNAKE_CASE__       : int = -1  ,							SCREAMING_SNAKE_CASE__       : int = -1  ,							SCREAMING_SNAKE_CASE__       : int = -1  ,							SCREAMING_SNAKE_CASE__       : bool = False  ,							SCREAMING_SNAKE_CASE__       : Optional["TensorType"] = None  ,							SCREAMING_SNAKE_CASE__       : int = 3  ,							SCREAMING_SNAKE_CASE__       : int = 4_0  ,							SCREAMING_SNAKE_CASE__       : int = 4_0  ,							SCREAMING_SNAKE_CASE__       : "PreTrainedTokenizerBase" = None  ,							)	->    int:
             a_      :	Optional[Any]							=						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






from typing import List, Optional

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


UpperCAmelCase_   :				Dict						      = logging.get_logger(__name__)

UpperCAmelCase_   :				int						      = {
    'huggingface/autoformer-tourism-monthly': 'https://huggingface.co/huggingface/autoformer-tourism-monthly/resolve/main/config.json',
}
class 				SCREAMING_SNAKE_CASE__						(       lowercase__    ):
      snake_case__       :  Union[str, Any]       =		'''autoformer'''
      snake_case__       :  Any       =		{
          '''hidden_size''': '''d_model''',
          '''num_attention_heads''': '''encoder_attention_heads''',
          '''num_hidden_layers''': '''encoder_layers''',
      }
      def __init__( self       : Optional[int]  ,							SCREAMING_SNAKE_CASE__       : Optional[int] = None  ,							SCREAMING_SNAKE_CASE__       : Optional[int] = None  ,							SCREAMING_SNAKE_CASE__       : str = "student_t"  ,							SCREAMING_SNAKE_CASE__       : str = "nll"  ,							SCREAMING_SNAKE_CASE__       : int = 1  ,							SCREAMING_SNAKE_CASE__       : List[int] = [1, 2, 3, 4, 5, 6, 7]  ,							SCREAMING_SNAKE_CASE__       : bool = True  ,							SCREAMING_SNAKE_CASE__       : int = 0  ,							SCREAMING_SNAKE_CASE__       : int = 0  ,							SCREAMING_SNAKE_CASE__       : int = 0  ,							SCREAMING_SNAKE_CASE__       : int = 0  ,							SCREAMING_SNAKE_CASE__       : Optional[List[int]] = None  ,							SCREAMING_SNAKE_CASE__       : Optional[List[int]] = None  ,							SCREAMING_SNAKE_CASE__       : int = 6_4  ,							SCREAMING_SNAKE_CASE__       : int = 2  ,							SCREAMING_SNAKE_CASE__       : int = 2  ,							SCREAMING_SNAKE_CASE__       : int = 2  ,							SCREAMING_SNAKE_CASE__       : int = 2  ,							SCREAMING_SNAKE_CASE__       : int = 3_2  ,							SCREAMING_SNAKE_CASE__       : int = 3_2  ,							SCREAMING_SNAKE_CASE__       : str = "gelu"  ,							SCREAMING_SNAKE_CASE__       : float = 0.1  ,							SCREAMING_SNAKE_CASE__       : float = 0.1  ,							SCREAMING_SNAKE_CASE__       : float = 0.1  ,							SCREAMING_SNAKE_CASE__       : float = 0.1  ,							SCREAMING_SNAKE_CASE__       : float = 0.1  ,							SCREAMING_SNAKE_CASE__       : int = 1_0_0  ,							SCREAMING_SNAKE_CASE__       : float = 0.02  ,							SCREAMING_SNAKE_CASE__       : bool = True  ,							SCREAMING_SNAKE_CASE__       : List[str]=True  ,							SCREAMING_SNAKE_CASE__       : int = 1_0  ,							SCREAMING_SNAKE_CASE__       : int = 2_5  ,							SCREAMING_SNAKE_CASE__       : int = 3  ,							**SCREAMING_SNAKE_CASE__       : int  ,							)	->    Union[str, Any]:
             # time series specific configuration
             a_      :	Optional[int]							=						prediction_length
             a_      :	Tuple							=						context_length if context_length is not None else prediction_length
             a_      :	Tuple							=						distribution_output
             a_      :	int							=						loss
             a_      :	Tuple							=						input_size
             a_      :	int							=						num_time_features
             a_      :	Dict							=						lags_sequence
             a_      :	List[str]							=						scaling
             a_      :	Tuple							=						num_dynamic_real_features
             a_      :	Dict							=						num_static_real_features
             a_      :	Dict							=						num_static_categorical_features
             if cardinality is not None and num_static_categorical_features > 0:
                    if len(SCREAMING_SNAKE_CASE__  ) != num_static_categorical_features:
                           raise ValueError(
                               'The cardinality should be a list of the same length as `num_static_categorical_features`'  )
                    a_      :	Any							=						cardinality
             else:
                    a_      :	Tuple							=						[0]
             if embedding_dimension is not None and num_static_categorical_features > 0:
                    if len(SCREAMING_SNAKE_CASE__  ) != num_static_categorical_features:
                           raise ValueError(
                               'The embedding dimension should be a list of the same length as `num_static_categorical_features`'  )
                    a_      :	Tuple							=						embedding_dimension
             else:
                    a_      :	Optional[Any]							=						[min(5_0  ,							(cat + 1) // 2  ) for cat in self.cardinality]
             a_      :	Optional[Any]							=						num_parallel_samples

             # Transformer architecture configuration
             a_      :	Dict							=						input_size * len(self.lags_sequence  ) + self._number_of_features
             a_      :	Tuple							=						d_model
             a_      :	int							=						encoder_attention_heads
             a_      :	Optional[int]							=						decoder_attention_heads
             a_      :	str							=						encoder_ffn_dim
             a_      :	List[str]							=						decoder_ffn_dim
             a_      :	Any							=						encoder_layers
             a_      :	Any							=						decoder_layers

             a_      :	List[Any]							=						dropout
             a_      :	Tuple							=						attention_dropout
             a_      :	Union[str, Any]							=						activation_dropout
             a_      :	List[Any]							=						encoder_layerdrop
             a_      :	List[str]							=						decoder_layerdrop

             a_      :	Optional[Any]							=						activation_function
             a_      :	Union[str, Any]							=						init_std

             a_      :	List[str]							=						use_cache

             # Autoformer
             a_      :	Tuple							=						label_length
             a_      :	List[Any]							=						moving_average
             a_      :	Optional[Any]							=						autocorrelation_factor

             super().__init__(is_encoder_decoder=SCREAMING_SNAKE_CASE__  ,							**SCREAMING_SNAKE_CASE__  )

      @property
      def  SCREAMING_SNAKE_CASE							( self       : List[Any]  )	->    int:
             return (
                 sum(self.embedding_dimension  )
                 + self.num_dynamic_real_features
                 + self.num_time_features
                 + self.num_static_real_features
                 + self.input_size * 2  # the log1p(abs(loc)) and log(scale) features
             )


