






from typing import List, Optional, Union

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


UpperCAmelCase__				   =		logging.get_logger(__name__)

UpperCAmelCase__				   =		{
    "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 		lowercase_					(	lowercase   ):






      '''simple docstring'''




      __snake_case       =  '''informer'''
      __snake_case       =  {
          '''hidden_size''': '''d_model''',
          '''num_attention_heads''': '''encoder_attention_heads''',
          '''num_hidden_layers''': '''encoder_layers''',
      }







      def __init__(      self      :						Optional[int] ,					__UpperCAmelCase      :						Optional[int] = None ,					__UpperCAmelCase      :						Optional[int] = None ,					__UpperCAmelCase      :						str = "student_t" ,					__UpperCAmelCase      :						str = "nll" ,					__UpperCAmelCase      :						int = 1 ,					__UpperCAmelCase      :						List[int] = None ,					__UpperCAmelCase      :						Optional[Union[str, bool]] = "mean" ,					__UpperCAmelCase      :						int = 0 ,					__UpperCAmelCase      :						int = 0 ,					__UpperCAmelCase      :						int = 0 ,					__UpperCAmelCase      :						int = 0 ,					__UpperCAmelCase      :						Optional[List[int]] = None ,					__UpperCAmelCase      :						Optional[List[int]] = None ,					__UpperCAmelCase      :						int = 64 ,					__UpperCAmelCase      :						int = 32 ,					__UpperCAmelCase      :						int = 32 ,					__UpperCAmelCase      :						int = 2 ,					__UpperCAmelCase      :						int = 2 ,					__UpperCAmelCase      :						int = 2 ,					__UpperCAmelCase      :						int = 2 ,					__UpperCAmelCase      :						bool = True ,					__UpperCAmelCase      :						str = "gelu" ,					__UpperCAmelCase      :						float = 0.05 ,					__UpperCAmelCase      :						float = 0.1 ,					__UpperCAmelCase      :						float = 0.1 ,					__UpperCAmelCase      :						float = 0.1 ,					__UpperCAmelCase      :						float = 0.1 ,					__UpperCAmelCase      :						int = 100 ,					__UpperCAmelCase      :						float = 0.02 ,					__UpperCAmelCase      :						str=True ,					__UpperCAmelCase      :						str = "prob" ,					__UpperCAmelCase      :						int = 5 ,					__UpperCAmelCase      :						bool = True ,					**__UpperCAmelCase      :						List[str] ,					)    ->str:




       """simple docstring"""


       a		  =      prediction_length
       a		  =      context_length or prediction_length
       a		  =      distribution_output
       a		  =      loss
       a		  =      input_size
       a		  =      num_time_features
       a		  =      lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
       a		  =      scaling
       a		  =      num_dynamic_real_features
       a		  =      num_static_real_features
       a		  =      num_static_categorical_features

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

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

       a		  =      num_parallel_samples

       # Transformer architecture configuration
       a		  =      input_size * len(self.lags_sequence  ) + self._number_of_features
       a		  =      d_model
       a		  =      encoder_attention_heads
       a		  =      decoder_attention_heads
       a		  =      encoder_ffn_dim
       a		  =      decoder_ffn_dim
       a		  =      encoder_layers
       a		  =      decoder_layers

       a		  =      dropout
       a		  =      attention_dropout
       a		  =      activation_dropout
       a		  =      encoder_layerdrop
       a		  =      decoder_layerdrop

       a		  =      activation_function
       a		  =      init_std

       a		  =      use_cache

       # Informer
       a		  =      attention_type
       a		  =      sampling_factor
       a		  =      distil

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







      @property
      def       __lowerCAmelCase					(      self      :						Tuple  )    ->int:




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










import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_electra import ElectraTokenizer


UpperCAmelCase__				   =		{"vocab_file": "vocab.txt", "tokenizer_file": "tokenizer.json"}

UpperCAmelCase__				   =		{
    "vocab_file": {
        "google/electra-small-generator": (
            "https://huggingface.co/google/electra-small-generator/resolve/main/vocab.txt"
        ),
        "google/electra-base-generator": "https://huggingface.co/google/electra-base-generator/resolve/main/vocab.txt",
        "google/electra-large-generator": (
            "https://huggingface.co/google/electra-large-generator/resolve/main/vocab.txt"
        ),
        "google/electra-small-discriminator": (
            "https://huggingface.co/google/electra-small-discriminator/resolve/main/vocab.txt"
        ),
        "google/electra-base-discriminator": (
            "https://huggingface.co/google/electra-base-discriminator/resolve/main/vocab.txt"
        ),
        "google/electra-large-discriminator": (
            "https://huggingface.co/google/electra-large-discriminator/resolve/main/vocab.txt"
        ),
    },
    "tokenizer_file": {
        "google/electra-small-generator": (
            "https://huggingface.co/google/electra-small-generator/resolve/main/tokenizer.json"
        ),
        "google/electra-base-generator": (
            "https://huggingface.co/google/electra-base-generator/resolve/main/tokenizer.json"
        ),
        "google/electra-large-generator": (
            "https://huggingface.co/google/electra-large-generator/resolve/main/tokenizer.json"
        ),
        "google/electra-small-discriminator": (
            "https://huggingface.co/google/electra-small-discriminator/resolve/main/tokenizer.json"
        ),
        "google/electra-base-discriminator": (
            "https://huggingface.co/google/electra-base-discriminator/resolve/main/tokenizer.json"
        ),
        "google/electra-large-discriminator": (
            "https://huggingface.co/google/electra-large-discriminator/resolve/main/tokenizer.json"
        ),
    },
}

UpperCAmelCase__				   =		{
    "google/electra-small-generator": 512,
    "google/electra-base-generator": 512,
    "google/electra-large-generator": 512,
    "google/electra-small-discriminator": 512,
    "google/electra-base-discriminator": 512,
    "google/electra-large-discriminator": 512,
}

UpperCAmelCase__				   =		{
    "google/electra-small-generator": {"do_lower_case": True},
    "google/electra-base-generator": {"do_lower_case": True},
    "google/electra-large-generator": {"do_lower_case": True},
    "google/electra-small-discriminator": {"do_lower_case": True},
    "google/electra-base-discriminator": {"do_lower_case": True},
    "google/electra-large-discriminator": {"do_lower_case": True},
}






class 		lowercase_					(	lowercase   ):






      '''simple docstring'''




      __snake_case       =  VOCAB_FILES_NAMES
      __snake_case       =  PRETRAINED_VOCAB_FILES_MAP
      __snake_case       =  PRETRAINED_INIT_CONFIGURATION
      __snake_case       =  PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
      __snake_case       =  ElectraTokenizer







      def __init__(      self      :						Dict ,					__UpperCAmelCase      :						int=None ,					__UpperCAmelCase      :						str=None ,					__UpperCAmelCase      :						Optional[int]=True ,					__UpperCAmelCase      :						str="[UNK]" ,					__UpperCAmelCase      :						Any="[SEP]" ,					__UpperCAmelCase      :						str="[PAD]" ,					__UpperCAmelCase      :						Optional[Any]="[CLS]" ,					__UpperCAmelCase      :						Union[str, Any]="[MASK]" ,					__UpperCAmelCase      :						List[str]=True ,					__UpperCAmelCase      :						Tuple=None ,					**__UpperCAmelCase      :						Optional[int] ,					)    ->str:




       """simple docstring"""


       super().__init__(
           __UpperCAmelCase ,					tokenizer_file=__UpperCAmelCase ,					do_lower_case=__UpperCAmelCase ,					unk_token=__UpperCAmelCase ,					sep_token=__UpperCAmelCase ,					pad_token=__UpperCAmelCase ,					cls_token=__UpperCAmelCase ,					mask_token=__UpperCAmelCase ,					tokenize_chinese_chars=__UpperCAmelCase ,					strip_accents=__UpperCAmelCase ,					**__UpperCAmelCase ,					)

       a		  =      json.loads(self.backend_tokenizer.normalizer.__getstate__()  )
       if (
           normalizer_state.get('''lowercase''' ,					__UpperCAmelCase  ) != do_lower_case
           or normalizer_state.get('''strip_accents''' ,					__UpperCAmelCase  ) != strip_accents
           or normalizer_state.get('''handle_chinese_chars''' ,					__UpperCAmelCase  ) != tokenize_chinese_chars
       ):
        a		  =      getattr(__UpperCAmelCase ,					normalizer_state.pop('''type'''  )  )
        a		  =      do_lower_case
        a		  =      strip_accents
        a		  =      tokenize_chinese_chars
        a		  =      normalizer_class(**__UpperCAmelCase  )

       a		  =      do_lower_case







      def       __lowerCAmelCase					(      self      :						List[Any] ,					__UpperCAmelCase      :						Optional[int] ,					__UpperCAmelCase      :						Tuple=None  )    ->str:




       """simple docstring"""


       a		  =      [self.cls_token_id] + token_ids_a + [self.sep_token_id]

       if token_ids_a:
        output += token_ids_a + [self.sep_token_id]

       return output







      def       __lowerCAmelCase					(      self      :						Optional[Any] ,					__UpperCAmelCase      :						List[int] ,					__UpperCAmelCase      :						Optional[List[int]] = None  )    ->List[int]:




       """simple docstring"""


       a		  =      [self.sep_token_id]
       a		  =      [self.cls_token_id]
       if token_ids_a is None:
        return len(cls + token_ids_a + sep  ) * [0]
       return len(cls + token_ids_a + sep  ) * [0] + len(token_ids_a + sep  ) * [1]







      def       __lowerCAmelCase					(      self      :						List[str] ,					__UpperCAmelCase      :						str ,					__UpperCAmelCase      :						Optional[str] = None  )    ->Tuple[str]:




       """simple docstring"""


       a		  =      self._tokenizer.model.save(__UpperCAmelCase ,					name=__UpperCAmelCase  )
       return tuple(__UpperCAmelCase  )


