"""simple docstring"""


from typing import List, Optional

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


a				=logging.get_logger(__name__)

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






class   __UpperCAmelCase		(      __lowerCAmelCase      ):
				A__ :  Any    				=			'''autoformer'''
				A__ :  List[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 = True      ,					_lowerCamelCase = 0      ,					_lowerCamelCase = 0      ,					_lowerCamelCase = 0      ,					_lowerCamelCase = 0      ,					_lowerCamelCase = None      ,					_lowerCamelCase = None      ,					_lowerCamelCase = 64      ,					_lowerCamelCase = 2      ,					_lowerCamelCase = 2      ,					_lowerCamelCase = 2      ,					_lowerCamelCase = 2      ,					_lowerCamelCase = 32      ,					_lowerCamelCase = 32      ,					_lowerCamelCase = "gelu"      ,					_lowerCamelCase = 0.1      ,					_lowerCamelCase = 0.1      ,					_lowerCamelCase = 0.1      ,					_lowerCamelCase = 0.1      ,					_lowerCamelCase = 0.1      ,					_lowerCamelCase = 100      ,					_lowerCamelCase = 0.0_2      ,					_lowerCamelCase = True      ,					_lowerCamelCase=True      ,					_lowerCamelCase = 10      ,					_lowerCamelCase = 25      ,					_lowerCamelCase = 3      ,					**_lowerCamelCase      ,					):
										lowerCamelCase__   =prediction_length
										lowerCamelCase__   =context_length if context_length is not None else prediction_length
										lowerCamelCase__   =distribution_output
										lowerCamelCase__   =loss
										lowerCamelCase__   =input_size
										lowerCamelCase__   =num_time_features
										lowerCamelCase__   =lags_sequence
										lowerCamelCase__   =scaling
										lowerCamelCase__   =num_dynamic_real_features
										lowerCamelCase__   =num_static_real_features
										lowerCamelCase__   =num_static_categorical_features
										if cardinality is not None 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`" )
																lowerCamelCase__   =cardinality
										else:
																lowerCamelCase__   =[0]
										if embedding_dimension is not None 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`" )
																lowerCamelCase__   =embedding_dimension
										else:
																lowerCamelCase__   =[min(50      ,					(cat + 1) // 2 ) for cat in self.cardinality]
										lowerCamelCase__   =num_parallel_samples

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

										lowerCamelCase__   =dropout
										lowerCamelCase__   =attention_dropout
										lowerCamelCase__   =activation_dropout
										lowerCamelCase__   =encoder_layerdrop
										lowerCamelCase__   =decoder_layerdrop

										lowerCamelCase__   =activation_function
										lowerCamelCase__   =init_std

										lowerCamelCase__   =use_cache

										# Autoformer
										lowerCamelCase__   =label_length
										lowerCamelCase__   =moving_average
										lowerCamelCase__   =autocorrelation_factor

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






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



import warnings

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




class 					_UpperCAmelCase			(     lowerCAmelCase  ):



 '''simple docstring'''




 __A			       =					['''image_processor''', '''tokenizer''']
 __A			       =					'''ViTImageProcessor'''
 __A			       =					('''CLIPTokenizer''', '''CLIPTokenizerFast''')







 def __init__(		self				:   Union[str, Any]							, lowercase_				:   Optional[int]=None							, lowercase_				:   Dict=None							, **lowercase_				:   List[str])						->	str:


   """simple docstring"""







   _UpperCamelCase           =    None
   if "feature_extractor" in kwargs:
     warnings.warn(
         "The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`"
         " instead."							, lowercase_							, )
     _UpperCamelCase           =    kwargs.pop("feature_extractor")

   _UpperCamelCase           =    image_processor if image_processor is not None else feature_extractor
   if image_processor is None:
     raise ValueError("You need to specify an `image_processor`.")
   if tokenizer is None:
     raise ValueError("You need to specify a `tokenizer`.")

   super().__init__(lowercase_							, lowercase_)







 def __call__(		self				:   Any							, lowercase_				:   List[str]=None							, lowercase_				:   int=None							, lowercase_				:   Optional[Any]=None							, lowercase_				:   Dict=None							, **lowercase_				:   Dict)						->	int:


   """simple docstring"""







   if text is None and visual_prompt is None and images is None:
     raise ValueError("You have to specify either text, visual prompt or images.")

   if text is not None and visual_prompt is not None:
     raise ValueError("You have to specify exactly one type of prompt. Either text or visual prompt.")

   if text is not None:
     _UpperCamelCase           =    self.tokenizer(lowercase_							, return_tensors=lowercase_							, **lowercase_)

   if visual_prompt is not None:
     _UpperCamelCase           =    self.image_processor(lowercase_							, return_tensors=lowercase_							, **lowercase_)

   if images is not None:
     _UpperCamelCase           =    self.image_processor(lowercase_							, return_tensors=lowercase_							, **lowercase_)

   if visual_prompt is not None and images is not None:
     _UpperCamelCase           =    {
         "pixel_values": image_features.pixel_values,
         "conditional_pixel_values": prompt_features.pixel_values,
     }
     return encoding
   elif text is not None and images is not None:
     _UpperCamelCase           =    image_features.pixel_values
     return encoding
   elif text is not None:
     return encoding
   elif visual_prompt is not None:
     _UpperCamelCase           =    {
         "conditional_pixel_values": prompt_features.pixel_values,
     }
     return encoding
   else:
     return BatchEncoding(data=dict(**lowercase_)							, tensor_type=lowercase_)







 def 		__UpperCAmelCase				(		self				:   Optional[Any]							, *lowercase_				:   List[Any]							, **lowercase_				:   List[Any])						->	int:


   """simple docstring"""







   return self.tokenizer.batch_decode(*lowercase_							, **lowercase_)







 def 		__UpperCAmelCase				(		self				:   Union[str, Any]							, *lowercase_				:   Any							, **lowercase_				:   int)						->	Optional[int]:


   """simple docstring"""







   return self.tokenizer.decode(*lowercase_							, **lowercase_)







 @property
 def 		__UpperCAmelCase				(		self				:   Optional[int])						->	str:


   """simple docstring"""







   warnings.warn(
       "`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."							, lowercase_							, )
   return self.image_processor_class







 @property
 def 		__UpperCAmelCase				(		self				:   int)						->	int:


   """simple docstring"""







   warnings.warn(
       "`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead."							, lowercase_							, )
   return self.image_processor




