





from typing import List, Optional, Union

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


UpperCAmelCase	:	Any		     =       logging.get_logger(__name__)

UpperCAmelCase	:	int		     =       {
    """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__):
      _lowercase				:					Any						=			"""time_series_transformer"""
      _lowercase				:					Union[str, 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.02		,      lowerCAmelCase__=True		,      **lowerCAmelCase__		,      )   ->						List[str]:



        '''simple docstring'''




        a__	:					int										=prediction_length
        a__	:					List[Any]										=context_length or prediction_length
        a__	:					int										=distribution_output
        a__	:					List[str]										=loss
        a__	:					Optional[int]										=input_size
        a__	:					Dict										=num_time_features
        a__	:					Any										=lags_sequence
        a__	:					List[Any]										=scaling
        a__	:					Optional[Any]										=num_dynamic_real_features
        a__	:					Dict										=num_static_real_features
        a__	:					Optional[int]										=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`"							)
          a__	:					Optional[Any]										=cardinality
        else:
          a__	:					List[Any]										=[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`"							)
          a__	:					List[str]										=embedding_dimension
        else:
          a__	:					int										=[min(5_0		,      (cat + 1) // 2							) for cat in self.cardinality]
        a__	:					Any										=num_parallel_samples

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

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

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

        a__	:					Optional[Any]										=use_cache

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







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













from typing import TYPE_CHECKING

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


UpperCAmelCase	:	Any		     =       {
    """configuration_convbert""": ["""CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ConvBertConfig""", """ConvBertOnnxConfig"""],
    """tokenization_convbert""": ["""ConvBertTokenizer"""],
}

try:
     if not is_tokenizers_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     UpperCAmelCase	:	List[Any]		     =       ["""ConvBertTokenizerFast"""]

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     UpperCAmelCase	:	List[str]		     =       [
         """CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
         """ConvBertForMaskedLM""",
         """ConvBertForMultipleChoice""",
         """ConvBertForQuestionAnswering""",
         """ConvBertForSequenceClassification""",
         """ConvBertForTokenClassification""",
         """ConvBertLayer""",
         """ConvBertModel""",
         """ConvBertPreTrainedModel""",
         """load_tf_weights_in_convbert""",
     ]


try:
     if not is_tf_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     UpperCAmelCase	:	Union[str, Any]		     =       [
         """TF_CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
         """TFConvBertForMaskedLM""",
         """TFConvBertForMultipleChoice""",
         """TFConvBertForQuestionAnswering""",
         """TFConvBertForSequenceClassification""",
         """TFConvBertForTokenClassification""",
         """TFConvBertLayer""",
         """TFConvBertModel""",
         """TFConvBertPreTrainedModel""",
     ]


if TYPE_CHECKING:
     from .configuration_convbert import CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, ConvBertConfig, ConvBertOnnxConfig
     from .tokenization_convbert import ConvBertTokenizer

     try:
          if not is_tokenizers_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .tokenization_convbert_fast import ConvBertTokenizerFast

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_convbert import (
              CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
              ConvBertForMaskedLM,
              ConvBertForMultipleChoice,
              ConvBertForQuestionAnswering,
              ConvBertForSequenceClassification,
              ConvBertForTokenClassification,
              ConvBertLayer,
              ConvBertModel,
              ConvBertPreTrainedModel,
              load_tf_weights_in_convbert,
          )

     try:
          if not is_tf_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_tf_convbert import (
              TF_CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
              TFConvBertForMaskedLM,
              TFConvBertForMultipleChoice,
              TFConvBertForQuestionAnswering,
              TFConvBertForSequenceClassification,
              TFConvBertForTokenClassification,
              TFConvBertLayer,
              TFConvBertModel,
              TFConvBertPreTrainedModel,
          )


else:
     import sys

     UpperCAmelCase	:	Union[str, Any]		     =       _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)






