
from collections import OrderedDict
from typing import Mapping

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


UpperCAmelCase__		:     List[str]     			=      logging.get_logger(__name__)

UpperCAmelCase__		:     Union[str, Any]     			=      {
    'xlm-mlm-en-2048': 'https://huggingface.co/xlm-mlm-en-2048/resolve/main/config.json',
    'xlm-mlm-ende-1024': 'https://huggingface.co/xlm-mlm-ende-1024/resolve/main/config.json',
    'xlm-mlm-enfr-1024': 'https://huggingface.co/xlm-mlm-enfr-1024/resolve/main/config.json',
    'xlm-mlm-enro-1024': 'https://huggingface.co/xlm-mlm-enro-1024/resolve/main/config.json',
    'xlm-mlm-tlm-xnli15-1024': 'https://huggingface.co/xlm-mlm-tlm-xnli15-1024/resolve/main/config.json',
    'xlm-mlm-xnli15-1024': 'https://huggingface.co/xlm-mlm-xnli15-1024/resolve/main/config.json',
    'xlm-clm-enfr-1024': 'https://huggingface.co/xlm-clm-enfr-1024/resolve/main/config.json',
    'xlm-clm-ende-1024': 'https://huggingface.co/xlm-clm-ende-1024/resolve/main/config.json',
    'xlm-mlm-17-1280': 'https://huggingface.co/xlm-mlm-17-1280/resolve/main/config.json',
    'xlm-mlm-100-1280': 'https://huggingface.co/xlm-mlm-100-1280/resolve/main/config.json',
}






class UpperCAmelCase   (						SCREAMING_SNAKE_CASE__   ):





   '''simple docstring'''
   __UpperCamelCase		:    int 				=    '''xlm'''
   __UpperCamelCase		:    Optional[Any] 				=    {
       '''hidden_size''': '''emb_dim''',
       '''num_attention_heads''': '''n_heads''',
       '''num_hidden_layers''': '''n_layers''',
       '''n_words''': '''vocab_size''',  # For backward compatibility
   }


   def __init__(					self     :							List[Any]			,			lowerCAmelCase_     :							Dict=3_0_1_4_5			,			lowerCAmelCase_     :							Union[str, Any]=2_0_4_8			,			lowerCAmelCase_     :							List[str]=1_2			,			lowerCAmelCase_     :							Optional[Any]=1_6			,			lowerCAmelCase_     :							Union[str, Any]=0.1			,			lowerCAmelCase_     :							List[str]=0.1			,			lowerCAmelCase_     :							Optional[int]=True			,			lowerCAmelCase_     :							List[str]=False			,			lowerCAmelCase_     :							Tuple=False			,			lowerCAmelCase_     :							List[str]=False			,			lowerCAmelCase_     :							Optional[Any]=1			,			lowerCAmelCase_     :							List[str]=True			,			lowerCAmelCase_     :							Tuple=5_1_2			,			lowerCAmelCase_     :							Tuple=2_0_4_8**-0.5			,			lowerCAmelCase_     :							List[str]=1e-12			,			lowerCAmelCase_     :							Any=0.02			,			lowerCAmelCase_     :							int=0			,			lowerCAmelCase_     :							int=1			,			lowerCAmelCase_     :							Dict=2			,			lowerCAmelCase_     :							List[Any]=3			,			lowerCAmelCase_     :							int=5			,			lowerCAmelCase_     :							Optional[int]=True			,			lowerCAmelCase_     :							Union[str, Any]="first"			,			lowerCAmelCase_     :							int=True			,			lowerCAmelCase_     :							List[Any]=None			,			lowerCAmelCase_     :							Any=True			,			lowerCAmelCase_     :							int=0.1			,			lowerCAmelCase_     :							Tuple=5			,			lowerCAmelCase_     :							Tuple=5			,			lowerCAmelCase_     :							Optional[int]=0			,			lowerCAmelCase_     :							Optional[Any]=0			,			lowerCAmelCase_     :							str=2			,			lowerCAmelCase_     :							Dict=0			,			**lowerCAmelCase_     :							List[Any]			,			):

      """simple docstring"""
      _A:  Dict					=       vocab_size
      _A:  Dict					=       emb_dim
      _A:  Optional[Any]					=       n_layers
      _A:  str					=       n_heads
      _A:  Optional[int]					=       dropout
      _A:  Union[str, Any]					=       attention_dropout
      _A:  Any					=       gelu_activation
      _A:  Optional[Any]					=       sinusoidal_embeddings
      _A:  Any					=       causal
      _A:  Optional[int]					=       asm
      _A:  List[str]					=       n_langs
      _A:  int					=       use_lang_emb
      _A:  Any					=       layer_norm_eps
      _A:  Tuple					=       bos_index
      _A:  Any					=       eos_index
      _A:  List[str]					=       pad_index
      _A:  str					=       unk_index
      _A:  str					=       mask_index
      _A:  List[Any]					=       is_encoder
      _A:  List[Any]					=       max_position_embeddings
      _A:  str					=       embed_init_std
      _A:  int					=       init_std
      _A:  List[str]					=       summary_type
      _A:  List[str]					=       summary_use_proj
      _A:  Tuple					=       summary_activation
      _A:  Dict					=       summary_proj_to_labels
      _A:  Tuple					=       summary_first_dropout
      _A:  str					=       start_n_top
      _A:  str					=       end_n_top
      _A:  Optional[Any]					=       mask_token_id
      _A:  Any					=       lang_id

      if "n_words" in kwargs:
         _A:  Union[str, Any]					=       kwargs['''n_words''']

      super().__init__(pad_token_id=lowerCAmelCase_			,			bos_token_id=lowerCAmelCase_			,			**lowerCAmelCase_     )






class UpperCAmelCase   (						SCREAMING_SNAKE_CASE__   ):





   '''simple docstring'''


   @property
   def  __magic_name__				(					self     :							List[str]     ):

      """simple docstring"""
      if self.task == "multiple-choice":
         _A:  int					=       {0: '''batch''', 1: '''choice''', 2: '''sequence'''}
      else:
         _A:  Tuple					=       {0: '''batch''', 1: '''sequence'''}
      return OrderedDict(
          [
              ('''input_ids''', dynamic_axis),
              ('''attention_mask''', dynamic_axis),
              ('''token_type_ids''', dynamic_axis),
          ]     )





from typing import List, Optional, Union

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


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

UpperCAmelCase__		:     Any     			=      {
    'huggingface/informer-tourism-monthly': (
        'https://huggingface.co/huggingface/informer-tourism-monthly/resolve/main/config.json'
    ),
    # See all Informer models at https://huggingface.co/models?filter=informer
}






class UpperCAmelCase   (						SCREAMING_SNAKE_CASE__   ):





   '''simple docstring'''
   __UpperCamelCase		:    List[Any] 				=    '''informer'''
   __UpperCamelCase		:    List[str] 				=    {
       '''hidden_size''': '''d_model''',
       '''num_attention_heads''': '''encoder_attention_heads''',
       '''num_hidden_layers''': '''encoder_layers''',
   }


   def __init__(					self     :							Optional[Any]			,			lowerCAmelCase_     :							Optional[int] = None			,			lowerCAmelCase_     :							Optional[int] = None			,			lowerCAmelCase_     :							str = "student_t"			,			lowerCAmelCase_     :							str = "nll"			,			lowerCAmelCase_     :							int = 1			,			lowerCAmelCase_     :							List[int] = None			,			lowerCAmelCase_     :							Optional[Union[str, bool]] = "mean"			,			lowerCAmelCase_     :							int = 0			,			lowerCAmelCase_     :							int = 0			,			lowerCAmelCase_     :							int = 0			,			lowerCAmelCase_     :							int = 0			,			lowerCAmelCase_     :							Optional[List[int]] = None			,			lowerCAmelCase_     :							Optional[List[int]] = None			,			lowerCAmelCase_     :							int = 6_4			,			lowerCAmelCase_     :							int = 3_2			,			lowerCAmelCase_     :							int = 3_2			,			lowerCAmelCase_     :							int = 2			,			lowerCAmelCase_     :							int = 2			,			lowerCAmelCase_     :							int = 2			,			lowerCAmelCase_     :							int = 2			,			lowerCAmelCase_     :							bool = True			,			lowerCAmelCase_     :							str = "gelu"			,			lowerCAmelCase_     :							float = 0.05			,			lowerCAmelCase_     :							float = 0.1			,			lowerCAmelCase_     :							float = 0.1			,			lowerCAmelCase_     :							float = 0.1			,			lowerCAmelCase_     :							float = 0.1			,			lowerCAmelCase_     :							int = 1_0_0			,			lowerCAmelCase_     :							float = 0.02			,			lowerCAmelCase_     :							Tuple=True			,			lowerCAmelCase_     :							str = "prob"			,			lowerCAmelCase_     :							int = 5			,			lowerCAmelCase_     :							bool = True			,			**lowerCAmelCase_     :							str			,			):

      """simple docstring"""
      # time series specific configuration
      _A:  Optional[Any]					=       prediction_length
      _A:  Optional[Any]					=       context_length or prediction_length
      _A:  Dict					=       distribution_output
      _A:  List[str]					=       loss
      _A:  int					=       input_size
      _A:  List[str]					=       num_time_features
      _A:  Optional[Any]					=       lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
      _A:  str					=       scaling
      _A:  Optional[Any]					=       num_dynamic_real_features
      _A:  List[Any]					=       num_static_real_features
      _A:  Tuple					=       num_static_categorical_features

      # set cardinality
      if cardinality and num_static_categorical_features > 0:
         if len(lowerCAmelCase_     ) != num_static_categorical_features:
            raise ValueError(
                '''The cardinality should be a list of the same length as `num_static_categorical_features`'''     )
         _A:  str					=       cardinality
      else:
         _A:  Union[str, Any]					=       [0]

      # set embedding_dimension
      if embedding_dimension and num_static_categorical_features > 0:
         if len(lowerCAmelCase_     ) != num_static_categorical_features:
            raise ValueError(
                '''The embedding dimension should be a list of the same length as `num_static_categorical_features`'''     )
         _A:  List[str]					=       embedding_dimension
      else:
         _A:  Union[str, Any]					=       [min(5_0			,			(cat + 1) // 2     ) for cat in self.cardinality]

      _A:  int					=       num_parallel_samples

      # Transformer architecture configuration
      _A:  Union[str, Any]					=       input_size * len(self.lags_sequence     ) + self._number_of_features
      _A:  Union[str, Any]					=       d_model
      _A:  Optional[Any]					=       encoder_attention_heads
      _A:  Optional[Any]					=       decoder_attention_heads
      _A:  Optional[Any]					=       encoder_ffn_dim
      _A:  Union[str, Any]					=       decoder_ffn_dim
      _A:  Any					=       encoder_layers
      _A:  str					=       decoder_layers

      _A:  List[str]					=       dropout
      _A:  Any					=       attention_dropout
      _A:  Optional[int]					=       activation_dropout
      _A:  List[Any]					=       encoder_layerdrop
      _A:  str					=       decoder_layerdrop

      _A:  int					=       activation_function
      _A:  Tuple					=       init_std

      _A:  Union[str, Any]					=       use_cache

      # Informer
      _A:  Union[str, Any]					=       attention_type
      _A:  str					=       sampling_factor
      _A:  List[str]					=       distil

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


   @property
   def  __magic_name__				(					self     :							List[str]     ):

      """simple docstring"""
      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
      )



