





"""simple docstring"""






from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
    is_vision_available,
)


A 			=  {
    '''configuration_clip''': [
        '''CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''CLIPConfig''',
        '''CLIPOnnxConfig''',
        '''CLIPTextConfig''',
        '''CLIPVisionConfig''',
    ],
    '''processing_clip''': ['''CLIPProcessor'''],
    '''tokenization_clip''': ['''CLIPTokenizer'''],
}

try:
		if not is_tokenizers_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		A 			=  ['''CLIPTokenizerFast''']

try:
		if not is_vision_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		A 			=  ['''CLIPFeatureExtractor''']
		A 			=  ['''CLIPImageProcessor''']

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		A 			=  [
		    '''CLIP_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''CLIPModel''',
		    '''CLIPPreTrainedModel''',
		    '''CLIPTextModel''',
		    '''CLIPTextModelWithProjection''',
		    '''CLIPVisionModel''',
		    '''CLIPVisionModelWithProjection''',
		]

try:
		if not is_tf_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		A 			=  [
		    '''TF_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''TFCLIPModel''',
		    '''TFCLIPPreTrainedModel''',
		    '''TFCLIPTextModel''',
		    '''TFCLIPVisionModel''',
		]

try:
		if not is_flax_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		A 			=  [
		    '''FlaxCLIPModel''',
		    '''FlaxCLIPPreTrainedModel''',
		    '''FlaxCLIPTextModel''',
		    '''FlaxCLIPTextPreTrainedModel''',
		    '''FlaxCLIPVisionModel''',
		    '''FlaxCLIPVisionPreTrainedModel''',
		]


if TYPE_CHECKING:
		from .configuration_clip import (
		    CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
		    CLIPConfig,
		    CLIPOnnxConfig,
		    CLIPTextConfig,
		    CLIPVisionConfig,
		)
		from .processing_clip import CLIPProcessor
		from .tokenization_clip import CLIPTokenizer

		try:
				if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_clip_fast import CLIPTokenizerFast

		try:
				if not is_vision_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .feature_extraction_clip import CLIPFeatureExtractor
				from .image_processing_clip import CLIPImageProcessor

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_clip import (
				    CLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
				    CLIPModel,
				    CLIPPreTrainedModel,
				    CLIPTextModel,
				    CLIPTextModelWithProjection,
				    CLIPVisionModel,
				    CLIPVisionModelWithProjection,
				)

		try:
				if not is_tf_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_tf_clip import (
				    TF_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
				    TFCLIPModel,
				    TFCLIPPreTrainedModel,
				    TFCLIPTextModel,
				    TFCLIPVisionModel,
				)

		try:
				if not is_flax_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_flax_clip import (
				    FlaxCLIPModel,
				    FlaxCLIPPreTrainedModel,
				    FlaxCLIPTextModel,
				    FlaxCLIPTextPreTrainedModel,
				    FlaxCLIPVisionModel,
				    FlaxCLIPVisionPreTrainedModel,
				)


else:
		import sys

		A 			=  _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)






"""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 				__lowercase			(			_UpperCamelCase							):







					'''simple docstring'''




					__lowerCAmelCase  =  '''autoformer'''
					__lowerCAmelCase  =  {
					    '''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 = 64	,			_UpperCAmelCase = 2	,			_UpperCAmelCase = 2	,			_UpperCAmelCase = 2	,			_UpperCAmelCase = 2	,			_UpperCAmelCase = 32	,			_UpperCAmelCase = 32	,			_UpperCAmelCase = "gelu"	,			_UpperCAmelCase = 0.1	,			_UpperCAmelCase = 0.1	,			_UpperCAmelCase = 0.1	,			_UpperCAmelCase = 0.1	,			_UpperCAmelCase = 0.1	,			_UpperCAmelCase = 100	,			_UpperCAmelCase = 0.0_2	,			_UpperCAmelCase = True	,			_UpperCAmelCase=True	,			_UpperCAmelCase = 10	,			_UpperCAmelCase = 25	,			_UpperCAmelCase = 3	,			**_UpperCAmelCase	,			):
									# time series specific configuration
									__a :						Optional[int]			       =  prediction_length
									__a :						Optional[int]			       =  context_length if context_length is not None else prediction_length
									__a :						Union[str, Any]			       =  distribution_output
									__a :						str			       =  loss
									__a :						Optional[Any]			       =  input_size
									__a :						str			       =  num_time_features
									__a :						Optional[Any]			       =  lags_sequence
									__a :						Any			       =  scaling
									__a :						Optional[Any]			       =  num_dynamic_real_features
									__a :						str			       =  num_static_real_features
									__a :						Any			       =  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`'''     )
													__a :						List[str]			       =  cardinality
									else:
													__a :						Any			       =  [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`'''     )
													__a :						Any			       =  embedding_dimension
									else:
													__a :						Tuple			       =  [min(50	,			(cat + 1) // 2     ) for cat in self.cardinality]
									__a :						Union[str, Any]			       =  num_parallel_samples

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

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

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

									__a :						List[str]			       =  use_cache

									# Autoformer
									__a :						int			       =  label_length
									__a :						List[Any]			       =  moving_average
									__a :						str			       =  autocorrelation_factor

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







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