






'''simple docstring'''



from typing import List, Optional, Union

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


SCREAMING_SNAKE_CASE						=	logging.get_logger(__name__)

SCREAMING_SNAKE_CASE						=	{
    '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_					(    __A				):




      """simple docstring"""




      UpperCamelCase_								=			'''informer'''
      UpperCamelCase_								=			{
          '''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.0_5     ,      UpperCAmelCase			:		float = 0.1     ,      UpperCAmelCase			:		float = 0.1     ,      UpperCAmelCase			:		float = 0.1     ,      UpperCAmelCase			:		float = 0.1     ,      UpperCAmelCase			:		int = 100     ,      UpperCAmelCase			:		float = 0.0_2     ,      UpperCAmelCase			:		List[Any]=True     ,      UpperCAmelCase			:		str = "prob"     ,      UpperCAmelCase			:		int = 5     ,      UpperCAmelCase			:		bool = True     ,      **UpperCAmelCase			:		int     ,      )  ->  Dict:


       '''simple docstring'''

       lowercase					:   Optional[Any]				  =prediction_length
       lowercase					:   Union[str, Any]				  =context_length or prediction_length
       lowercase					:   Optional[Any]				  =distribution_output
       lowercase					:   int				  =loss
       lowercase					:   str				  =input_size
       lowercase					:   Optional[Any]				  =num_time_features
       lowercase					:   Union[str, Any]				  =lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
       lowercase					:   Any				  =scaling
       lowercase					:   Any				  =num_dynamic_real_features
       lowercase					:   Any				  =num_static_real_features
       lowercase					:   Any				  =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`'''		)
        lowercase					:   Dict				  =cardinality
       else:
        lowercase					:   Tuple				  =[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`'''		)
        lowercase					:   str				  =embedding_dimension
       else:
        lowercase					:   Optional[Any]				  =[min(50     ,      (cat + 1) // 2		) for cat in self.cardinality]

       lowercase					:   str				  =num_parallel_samples

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

       lowercase					:   str				  =dropout
       lowercase					:   Tuple				  =attention_dropout
       lowercase					:   Optional[int]				  =activation_dropout
       lowercase					:   Tuple				  =encoder_layerdrop
       lowercase					:   Any				  =decoder_layerdrop

       lowercase					:   str				  =activation_function
       lowercase					:   Any				  =init_std

       lowercase					:   Tuple				  =use_cache

       # Informer
       lowercase					:   Optional[int]				  =attention_type
       lowercase					:   Union[str, Any]				  =sampling_factor
       lowercase					:   Tuple				  =distil

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






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











'''simple docstring'''



from typing import List, Optional, Tuple

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_herbert import HerbertTokenizer


SCREAMING_SNAKE_CASE						=	logging.get_logger(__name__)

SCREAMING_SNAKE_CASE						=	{'vocab_file': 'vocab.json', 'merges_file': 'merges.txt', 'tokenizer_file': 'tokenizer.json'}

SCREAMING_SNAKE_CASE						=	{
    'vocab_file': {
        'allegro/herbert-base-cased': 'https://huggingface.co/allegro/herbert-base-cased/resolve/main/vocab.json'
    },
    'merges_file': {
        'allegro/herbert-base-cased': 'https://huggingface.co/allegro/herbert-base-cased/resolve/main/merges.txt'
    },
}

SCREAMING_SNAKE_CASE						=	{'allegro/herbert-base-cased': 514}
SCREAMING_SNAKE_CASE						=	{}
class UpperCAmelCase_					(    __A				):




      """simple docstring"""




      UpperCamelCase_								=			VOCAB_FILES_NAMES
      UpperCamelCase_								=			PRETRAINED_VOCAB_FILES_MAP
      UpperCamelCase_								=			PRETRAINED_INIT_CONFIGURATION
      UpperCamelCase_								=			PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
      UpperCamelCase_								=			HerbertTokenizer






      def __init__( self			:		Dict     ,      UpperCAmelCase			:		Optional[Any]=None     ,      UpperCAmelCase			:		Optional[int]=None     ,      UpperCAmelCase			:		Any=None     ,      UpperCAmelCase			:		Tuple="<s>"     ,      UpperCAmelCase			:		List[Any]="<unk>"     ,      UpperCAmelCase			:		str="<pad>"     ,      UpperCAmelCase			:		Optional[Any]="<mask>"     ,      UpperCAmelCase			:		List[str]="</s>"     ,      **UpperCAmelCase			:		List[str]     ,      )  ->  Dict:


       '''simple docstring'''

       super().__init__(
           UpperCAmelCase     ,      UpperCAmelCase     ,      tokenizer_file=UpperCAmelCase     ,      cls_token=UpperCAmelCase     ,      unk_token=UpperCAmelCase     ,      pad_token=UpperCAmelCase     ,      mask_token=UpperCAmelCase     ,      sep_token=UpperCAmelCase     ,      **UpperCAmelCase     ,      )






      def 				A__      ( self			:		int     ,      UpperCAmelCase			:		List[int]     ,      UpperCAmelCase			:		Optional[List[int]] = None		)  ->  List[int]:


       '''simple docstring'''

       lowercase					:   List[Any]				  =[self.cls_token_id]
       lowercase					:   Any				  =[self.sep_token_id]
       if token_ids_a is None:
        return cls + token_ids_a + sep

       return cls + token_ids_a + sep + token_ids_a + sep






      def 				A__      ( self			:		Any     ,      UpperCAmelCase			:		List[int]     ,      UpperCAmelCase			:		Optional[List[int]] = None     ,      UpperCAmelCase			:		bool = False		)  ->  List[int]:


       '''simple docstring'''

       if already_has_special_tokens:
        return super().get_special_tokens_mask(
            token_ids_a=UpperCAmelCase     ,      token_ids_a=UpperCAmelCase     ,      already_has_special_tokens=UpperCAmelCase		)

       if token_ids_a is None:
        return [1] + ([0] * len(UpperCAmelCase		)) + [1]
       return [1] + ([0] * len(UpperCAmelCase		)) + [1] + ([0] * len(UpperCAmelCase		)) + [1]






      def 				A__      ( self			:		Optional[int]     ,      UpperCAmelCase			:		List[int]     ,      UpperCAmelCase			:		Optional[List[int]] = None		)  ->  List[int]:


       '''simple docstring'''

       lowercase					:   Optional[Any]				  =[self.sep_token_id]
       lowercase					:   Dict				  =[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 				A__      ( self			:		Union[str, Any]     ,      UpperCAmelCase			:		str     ,      UpperCAmelCase			:		Optional[str] = None		)  ->  Tuple[str]:


       '''simple docstring'''

       lowercase					:   List[Any]				  =self._tokenizer.model.save(UpperCAmelCase     ,      name=UpperCAmelCase		)
       return tuple(UpperCAmelCase		)



