





'''simple docstring'''

from typing import List, Optional, Union

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


UpperCAmelCase					:		int		=							logging.get_logger(__name__)

UpperCAmelCase					:		Union[str, 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 lowerCamelCase						(a__					):
  _lowercase  :	Optional[Any]       					=				"""informer"""
  _lowercase  :	Optional[Any]       					=				{
      """hidden_size""": """d_model""",
      """num_attention_heads""": """encoder_attention_heads""",
      """num_hidden_layers""": """encoder_layers""",
  }







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






        """simple docstring"""





        _snake_case		:	List[str]					     =     prediction_length
        _snake_case		:	Any					     =     context_length or prediction_length
        _snake_case		:	Any					     =     distribution_output
        _snake_case		:	Tuple					     =     loss
        _snake_case		:	Dict					     =     input_size
        _snake_case		:	List[Any]					     =     num_time_features
        _snake_case		:	Tuple					     =     lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
        _snake_case		:	str					     =     scaling
        _snake_case		:	Optional[Any]					     =     num_dynamic_real_features
        _snake_case		:	Dict					     =     num_static_real_features
        _snake_case		:	List[str]					     =     num_static_categorical_features

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

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

        _snake_case		:	Optional[Any]					     =     num_parallel_samples

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

        _snake_case		:	Dict					     =     dropout
        _snake_case		:	List[str]					     =     attention_dropout
        _snake_case		:	Optional[int]					     =     activation_dropout
        _snake_case		:	List[Any]					     =     encoder_layerdrop
        _snake_case		:	Union[str, Any]					     =     decoder_layerdrop

        _snake_case		:	Tuple					     =     activation_function
        _snake_case		:	Union[str, Any]					     =     init_std

        _snake_case		:	Union[str, Any]					     =     use_cache

        # Informer
        _snake_case		:	List[Any]					     =     attention_type
        _snake_case		:	Optional[int]					     =     sampling_factor
        _snake_case		:	Tuple					     =     distil

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







  @property
  def 				UpperCAmelCase_				(		self		)		->						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
        )









'''simple docstring'''

import json
from typing import TYPE_CHECKING, List, Optional, Tuple

from tokenizers import pre_tokenizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging


if TYPE_CHECKING:
   from transformers.pipelines.conversational import Conversation


UpperCAmelCase					:		Optional[int]		=							logging.get_logger(__name__)

UpperCAmelCase					:		List[Any]		=							{'vocab_file': 'vocab.json', 'merges_file': 'merges.txt', 'tokenizer_file': 'tokenizer.json'}

UpperCAmelCase					:		Any		=							{
    'tokenizer_file': {
        'EleutherAI/gpt-neox-20b': 'https://huggingface.co/EleutherAI/gpt-neox-20b/resolve/main/tokenizer.json',
    },
}

UpperCAmelCase					:		Optional[Any]		=							{
    'gpt-neox-20b': 2_0_4_8,
}





class lowerCamelCase						(a__					):
  _lowercase  :	Optional[int]       					=				VOCAB_FILES_NAMES
  _lowercase  :	str       					=				PRETRAINED_VOCAB_FILES_MAP
  _lowercase  :	Dict       					=				PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
  _lowercase  :	Optional[int]       					=				["""input_ids""", """attention_mask"""]







  def __init__(		self     ,     lowercase__=None     ,     lowercase__=None     ,     lowercase__=None     ,     lowercase__="<|endoftext|>"     ,     lowercase__="<|endoftext|>"     ,     lowercase__="<|endoftext|>"     ,     lowercase__=False     ,     **lowercase__     ,     )		->						List[Any]:






        """simple docstring"""





        super().__init__(
            lowercase__     ,     lowercase__     ,     tokenizer_file=lowercase__     ,     unk_token=lowercase__     ,     bos_token=lowercase__     ,     eos_token=lowercase__     ,     add_prefix_space=lowercase__     ,     **lowercase__     ,     )

        _snake_case		:	Optional[int]					     =     json.loads(self.backend_tokenizer.pre_tokenizer.__getstate__()		)
        if pre_tok_state.get('''add_prefix_space'''     ,     lowercase__		) != add_prefix_space:
              _snake_case		:	int					     =     getattr(lowercase__     ,     pre_tok_state.pop('''type'''		)		)
              _snake_case		:	int					     =     add_prefix_space
              _snake_case		:	Optional[Any]					     =     pre_tok_class(**lowercase__		)

        _snake_case		:	List[str]					     =     add_prefix_space







  def 				UpperCAmelCase_				(		self     ,     lowercase__     ,     lowercase__ = None		)		->						Tuple[str]:






        """simple docstring"""





        _snake_case		:	Optional[int]					     =     self._tokenizer.model.save(lowercase__     ,     name=lowercase__		)
        return tuple(lowercase__		)







  def 				UpperCAmelCase_				(		self     ,     lowercase__		)		->						List[int]:






        """simple docstring"""





        _snake_case		:	List[str]					     =     []
        for is_user, text in conversation.iter_texts():
              input_ids.extend(self.encode(lowercase__     ,     add_special_tokens=lowercase__		) + [self.eos_token_id]		)

        if len(lowercase__		) > self.model_max_length:
              _snake_case		:	Dict					     =     input_ids[-self.model_max_length :]
        return input_ids


