


'''simple docstring'''







from typing import List, Optional, Union

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


A__:    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 A__       (						UpperCAmelCase__      ):
      __UpperCamelCase       :  str	       =							"time_series_transformer"
      __UpperCamelCase       :  Tuple	       =							{
          "hidden_size": "d_model",
          "num_attention_heads": "encoder_attention_heads",
          "num_hidden_layers": "encoder_layers",
      }






      def __init__( self			:Optional[int]     ,						SCREAMING_SNAKE_CASE			:Optional[int] = None     ,						SCREAMING_SNAKE_CASE			:Optional[int] = None     ,						SCREAMING_SNAKE_CASE			:str = "student_t"     ,						SCREAMING_SNAKE_CASE			:str = "nll"     ,						SCREAMING_SNAKE_CASE			:int = 1     ,						SCREAMING_SNAKE_CASE			:List[int] = [1, 2, 3, 4, 5, 6, 7]     ,						SCREAMING_SNAKE_CASE			:Optional[Union[str, bool]] = "mean"     ,						SCREAMING_SNAKE_CASE			:int = 0     ,						SCREAMING_SNAKE_CASE			:int = 0     ,						SCREAMING_SNAKE_CASE			:int = 0     ,						SCREAMING_SNAKE_CASE			:int = 0     ,						SCREAMING_SNAKE_CASE			:Optional[List[int]] = None     ,						SCREAMING_SNAKE_CASE			:Optional[List[int]] = None     ,						SCREAMING_SNAKE_CASE			:int = 3_2     ,						SCREAMING_SNAKE_CASE			:int = 3_2     ,						SCREAMING_SNAKE_CASE			:int = 2     ,						SCREAMING_SNAKE_CASE			:int = 2     ,						SCREAMING_SNAKE_CASE			:int = 2     ,						SCREAMING_SNAKE_CASE			:int = 2     ,						SCREAMING_SNAKE_CASE			:bool = True     ,						SCREAMING_SNAKE_CASE			:str = "gelu"     ,						SCREAMING_SNAKE_CASE			:int = 6_4     ,						SCREAMING_SNAKE_CASE			:float = 0.1     ,						SCREAMING_SNAKE_CASE			:float = 0.1     ,						SCREAMING_SNAKE_CASE			:float = 0.1     ,						SCREAMING_SNAKE_CASE			:float = 0.1     ,						SCREAMING_SNAKE_CASE			:float = 0.1     ,						SCREAMING_SNAKE_CASE			:int = 1_0_0     ,						SCREAMING_SNAKE_CASE			:float = 0.02     ,						SCREAMING_SNAKE_CASE			:str=True     ,						**SCREAMING_SNAKE_CASE			:Tuple     ,						)       ->					str:




             '''simple docstring'''
             # time series specific configuration
             _a    : Dict     					=prediction_length
             _a    : Optional[int]     					=context_length or prediction_length
             _a    : int     					=distribution_output
             _a    : Any     					=loss
             _a    : List[Any]     					=input_size
             _a    : Optional[Any]     					=num_time_features
             _a    : Optional[Any]     					=lags_sequence
             _a    : str     					=scaling
             _a    : Optional[Any]     					=num_dynamic_real_features
             _a    : int     					=num_static_real_features
             _a    : Optional[Any]     					=num_static_categorical_features
             if cardinality and num_static_categorical_features > 0:
                    if len(SCREAMING_SNAKE_CASE	) != num_static_categorical_features:
                           raise ValueError(
                               """The cardinality should be a list of the same length as `num_static_categorical_features`"""	)
                    _a    : List[Any]     					=cardinality
             else:
                    _a    : Union[str, Any]     					=[0]
             if embedding_dimension and num_static_categorical_features > 0:
                    if len(SCREAMING_SNAKE_CASE	) != num_static_categorical_features:
                           raise ValueError(
                               """The embedding dimension should be a list of the same length as `num_static_categorical_features`"""	)
                    _a    : str     					=embedding_dimension
             else:
                    _a    : Optional[int]     					=[min(5_0     ,						(cat + 1) // 2	) for cat in self.cardinality]
             _a    : Dict     					=num_parallel_samples

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

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

             _a    : Any     					=activation_function
             _a    : Any     					=init_std

             _a    : Any     					=use_cache

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






      @property
      def __UpperCAmelCase       ( self			:Optional[int]	)       ->					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 TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


A__:    List[str]					    =       {
    '''configuration_chinese_clip''': [
        '''CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''ChineseCLIPConfig''',
        '''ChineseCLIPOnnxConfig''',
        '''ChineseCLIPTextConfig''',
        '''ChineseCLIPVisionConfig''',
    ],
    '''processing_chinese_clip''': ['''ChineseCLIPProcessor'''],
}

try:
   if not is_vision_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   A__:    Optional[int]					    =       ['''ChineseCLIPFeatureExtractor''']
   A__:    Any					    =       ['''ChineseCLIPImageProcessor''']

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   A__:    Dict					    =       [
       '''CHINESE_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST''',
       '''ChineseCLIPModel''',
       '''ChineseCLIPPreTrainedModel''',
       '''ChineseCLIPTextModel''',
       '''ChineseCLIPVisionModel''',
   ]

if TYPE_CHECKING:
   from .configuration_chinese_clip import (
       CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
       ChineseCLIPConfig,
       ChineseCLIPOnnxConfig,
       ChineseCLIPTextConfig,
       ChineseCLIPVisionConfig,
   )
   from .processing_chinese_clip import ChineseCLIPProcessor

   try:
      if not is_vision_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .feature_extraction_chinese_clip import ChineseCLIPFeatureExtractor, ChineseCLIPImageProcessor

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_chinese_clip import (
          CHINESE_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
          ChineseCLIPModel,
          ChineseCLIPPreTrainedModel,
          ChineseCLIPTextModel,
          ChineseCLIPVisionModel,
      )

else:
   import sys

   A__:    str					    =       _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)


