






from typing import List, Optional, Union

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


A_						:						List[Any]						      =					logging.get_logger(__name__)

A_						:						Any						      =					{
    'huggingface/time-series-transformer-tourism-monthly': (
        'https://huggingface.co/huggingface/time-series-transformer-tourism-monthly/resolve/main/config.json'
    ),
    # See all TimeSeriesTransformer models at https://huggingface.co/models?filter=time_series_transformer
}




class 							_lowerCAmelCase(			UpperCAmelCase_   ):





       """simple docstring"""







       a							:						Dict										='''time_series_transformer'''
       a							:						Any										={
           '''hidden_size''': '''d_model''',
           '''num_attention_heads''': '''encoder_attention_heads''',
           '''num_hidden_layers''': '''encoder_layers''',
       }





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

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

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

         UpperCamelCase_:   int        =							activation_function
         UpperCamelCase_:   List[str]        =							init_std

         UpperCamelCase_:   str        =							use_cache

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





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


from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding







class 					lowercase							(			lowercase_     ):
				__SCREAMING_SNAKE_CASE   :					Union[str, Any]			     =     ['''image_processor''', '''tokenizer''']
				__SCREAMING_SNAKE_CASE   :					Tuple			     =     '''AutoImageProcessor'''
				__SCREAMING_SNAKE_CASE   :					Dict			     =     '''AutoTokenizer'''




				def __init__(   self ,  snake_case ,  snake_case			):
											super().__init__(snake_case ,  snake_case			)
											snake_case_     							=       self.image_processor




				def __call__(   self ,  snake_case=None ,  snake_case=None ,  snake_case=None ,  **snake_case			):

											if text is None and images is None:
																		raise ValueError('You have to specify either text or images. Both cannot be none.'			)

											if text is not None:
																		snake_case_     							=       self.tokenizer(snake_case ,  return_tensors=snake_case ,  **snake_case			)

											if images is not None:
																		snake_case_     							=       self.image_processor(snake_case ,  return_tensors=snake_case ,  **snake_case			)

											if text is not None and images is not None:
																		snake_case_     							=       image_features.pixel_values
																		return encoding
											elif text is not None:
																		return encoding
											else:
																		return BatchEncoding(data=dict(**snake_case			) ,  tensor_type=snake_case			)




				def        a				(   self ,  *snake_case ,  **snake_case			):
											return self.tokenizer.batch_decode(*snake_case ,  **snake_case			)




				def        a				(   self ,  *snake_case ,  **snake_case			):
											return self.tokenizer.decode(*snake_case ,  **snake_case			)




				@property
				def        a				(   self			):
											return ["input_ids", "attention_mask", "pixel_values"]




