






from typing import List, Optional

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


__UpperCAmelCase								=						logging.get_logger(__name__)

__UpperCAmelCase								=						{
    'huggingface/autoformer-tourism-monthly': 'https://huggingface.co/huggingface/autoformer-tourism-monthly/resolve/main/config.json',
}



class   lowerCamelCase      (_snake_case			):







		'''simple docstring'''



		_snake_case    :    Tuple       						=  '''autoformer'''
		_snake_case    :    Tuple       						=  {
		    '''hidden_size''': '''d_model''',
		    '''num_attention_heads''': '''encoder_attention_heads''',
		    '''num_hidden_layers''': '''encoder_layers''',
		}



		def __init__(							self				,		_UpperCamelCase = None				,		_UpperCamelCase = None				,		_UpperCamelCase = "student_t"				,		_UpperCamelCase = "nll"				,		_UpperCamelCase = 1				,		_UpperCamelCase = [1, 2, 3, 4, 5, 6, 7]				,		_UpperCamelCase = True				,		_UpperCamelCase = 0				,		_UpperCamelCase = 0				,		_UpperCamelCase = 0				,		_UpperCamelCase = 0				,		_UpperCamelCase = None				,		_UpperCamelCase = None				,		_UpperCamelCase = 6_4				,		_UpperCamelCase = 2				,		_UpperCamelCase = 2				,		_UpperCamelCase = 2				,		_UpperCamelCase = 2				,		_UpperCamelCase = 3_2				,		_UpperCamelCase = 3_2				,		_UpperCamelCase = "gelu"				,		_UpperCamelCase = 0.1				,		_UpperCamelCase = 0.1				,		_UpperCamelCase = 0.1				,		_UpperCamelCase = 0.1				,		_UpperCamelCase = 0.1				,		_UpperCamelCase = 1_0_0				,		_UpperCamelCase = 0.02				,		_UpperCamelCase = True				,		_UpperCamelCase=True				,		_UpperCamelCase = 1_0				,		_UpperCamelCase = 2_5				,		_UpperCamelCase = 3				,		**_UpperCamelCase				,		)	->							Union[str, Any]:
							# time series specific configuration
							UpperCAmelCase_    :      str            =						prediction_length
							UpperCAmelCase_    :      str            =						context_length if context_length is not None else prediction_length
							UpperCAmelCase_    :      Union[str, Any]            =						distribution_output
							UpperCAmelCase_    :      List[Any]            =						loss
							UpperCAmelCase_    :      Any            =						input_size
							UpperCAmelCase_    :      List[str]            =						num_time_features
							UpperCAmelCase_    :      Optional[Any]            =						lags_sequence
							UpperCAmelCase_    :      Optional[int]            =						scaling
							UpperCAmelCase_    :      Union[str, Any]            =						num_dynamic_real_features
							UpperCAmelCase_    :      Union[str, Any]            =						num_static_real_features
							UpperCAmelCase_    :      int            =						num_static_categorical_features
							if cardinality is not None 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`'   )
												UpperCAmelCase_    :      Union[str, Any]            =						cardinality
							else:
												UpperCAmelCase_    :      int            =						[0]
							if embedding_dimension is not None 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`'   )
												UpperCAmelCase_    :      Tuple            =						embedding_dimension
							else:
												UpperCAmelCase_    :      List[str]            =						[min(5_0				,		(cat + 1) // 2   ) for cat in self.cardinality]
							UpperCAmelCase_    :      Optional[Any]            =						num_parallel_samples

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

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

							UpperCAmelCase_    :      Union[str, Any]            =						activation_function
							UpperCAmelCase_    :      Union[str, Any]            =						init_std

							UpperCAmelCase_    :      Optional[int]            =						use_cache

							# Autoformer
							UpperCAmelCase_    :      int            =						label_length
							UpperCAmelCase_    :      List[Any]            =						moving_average
							UpperCAmelCase_    :      Optional[int]            =						autocorrelation_factor

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



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














import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_convbert import ConvBertTokenizer


__UpperCAmelCase								=						logging.get_logger(__name__)

__UpperCAmelCase								=						{'vocab_file': 'vocab.txt'}

__UpperCAmelCase								=						{
    'vocab_file': {
        'YituTech/conv-bert-base': 'https://huggingface.co/YituTech/conv-bert-base/resolve/main/vocab.txt',
        'YituTech/conv-bert-medium-small': (
            'https://huggingface.co/YituTech/conv-bert-medium-small/resolve/main/vocab.txt'
        ),
        'YituTech/conv-bert-small': 'https://huggingface.co/YituTech/conv-bert-small/resolve/main/vocab.txt',
    }
}

__UpperCAmelCase								=						{
    'YituTech/conv-bert-base': 512,
    'YituTech/conv-bert-medium-small': 512,
    'YituTech/conv-bert-small': 512,
}


__UpperCAmelCase								=						{
    'YituTech/conv-bert-base': {'do_lower_case': True},
    'YituTech/conv-bert-medium-small': {'do_lower_case': True},
    'YituTech/conv-bert-small': {'do_lower_case': True},
}



class   lowerCamelCase      (_snake_case			):







		'''simple docstring'''



		_snake_case    :    Optional[int]       						=  VOCAB_FILES_NAMES
		_snake_case    :    int       						=  PRETRAINED_VOCAB_FILES_MAP
		_snake_case    :    Dict       						=  PRETRAINED_INIT_CONFIGURATION
		_snake_case    :    List[str]       						=  PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
		_snake_case    :    Any       						=  ConvBertTokenizer



		def __init__(							self				,		_UpperCamelCase=None				,		_UpperCamelCase=None				,		_UpperCamelCase=True				,		_UpperCamelCase="[UNK]"				,		_UpperCamelCase="[SEP]"				,		_UpperCamelCase="[PAD]"				,		_UpperCamelCase="[CLS]"				,		_UpperCamelCase="[MASK]"				,		_UpperCamelCase=True				,		_UpperCamelCase=None				,		**_UpperCamelCase				,		)	->							Dict:
							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				,		)

							UpperCAmelCase_    :      Optional[int]            =						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
							):
												UpperCAmelCase_    :      Any            =						getattr(_UpperCamelCase				,		normalizer_state.pop('type'   )   )
												UpperCAmelCase_    :      str            =						do_lower_case
												UpperCAmelCase_    :      List[Any]            =						strip_accents
												UpperCAmelCase_    :      str            =						tokenize_chinese_chars
												UpperCAmelCase_    :      Tuple            =						normalizer_class(**_UpperCamelCase   )

							UpperCAmelCase_    :      Any            =						do_lower_case



		def 					__UpperCAmelCase			(							self				,		_UpperCamelCase				,		_UpperCamelCase=None   )	->							List[str]:
							UpperCAmelCase_    :      int            =						[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 					__UpperCAmelCase			(							self				,		_UpperCamelCase				,		_UpperCamelCase = None   )	->							List[int]:
							UpperCAmelCase_    :      Union[str, Any]            =						[self.sep_token_id]
							UpperCAmelCase_    :      int            =						[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 					__UpperCAmelCase			(							self				,		_UpperCamelCase				,		_UpperCamelCase = None   )	->							Tuple[str]:
							UpperCAmelCase_    :      Any            =						self._tokenizer.model.save(_UpperCamelCase				,		name=_UpperCamelCase   )
							return tuple(_UpperCamelCase   )






