


'''simple docstring'''

from typing import List, Optional, Union

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


lowerCamelCase							:   Any  						=	logging.get_logger(__name__)

lowerCamelCase							:   Dict  						=	{
    '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						(lowercase_     ):





      '''simple docstring'''






      lowerCAmelCase__					:     Optional[Any]  					=							"""time_series_transformer"""
      lowerCAmelCase__					:     Optional[int]  					=							{
          """hidden_size""": """d_model""",
          """num_attention_heads""": """encoder_attention_heads""",
          """num_hidden_layers""": """encoder_layers""",
      }



      def __init__(self    :    Any   ,						UpperCamelCase    :    Optional[int] = None   ,						UpperCamelCase    :    Optional[int] = None   ,						UpperCamelCase    :    str = "student_t"   ,						UpperCamelCase    :    str = "nll"   ,						UpperCamelCase    :    int = 1   ,						UpperCamelCase    :    List[int] = [1, 2, 3, 4, 5, 6, 7]   ,						UpperCamelCase    :    Optional[Union[str, bool]] = "mean"   ,						UpperCamelCase    :    int = 0   ,						UpperCamelCase    :    int = 0   ,						UpperCamelCase    :    int = 0   ,						UpperCamelCase    :    int = 0   ,						UpperCamelCase    :    Optional[List[int]] = None   ,						UpperCamelCase    :    Optional[List[int]] = None   ,						UpperCamelCase    :    int = 32   ,						UpperCamelCase    :    int = 32   ,						UpperCamelCase    :    int = 2   ,						UpperCamelCase    :    int = 2   ,						UpperCamelCase    :    int = 2   ,						UpperCamelCase    :    int = 2   ,						UpperCamelCase    :    bool = True   ,						UpperCamelCase    :    str = "gelu"   ,						UpperCamelCase    :    int = 64   ,						UpperCamelCase    :    float = 0.1   ,						UpperCamelCase    :    float = 0.1   ,						UpperCamelCase    :    float = 0.1   ,						UpperCamelCase    :    float = 0.1   ,						UpperCamelCase    :    float = 0.1   ,						UpperCamelCase    :    int = 100   ,						UpperCamelCase    :    float = 0.02   ,						UpperCamelCase    :    Tuple=True   ,						**UpperCamelCase    :    Optional[Any]   ,						):

             '''simple docstring'''







             lowercase__      			= prediction_length
             lowercase__      			= context_length or prediction_length
             lowercase__      			= distribution_output
             lowercase__      			= loss
             lowercase__      			= input_size
             lowercase__      			= num_time_features
             lowercase__      			= lags_sequence
             lowercase__      			= scaling
             lowercase__      			= num_dynamic_real_features
             lowercase__      			= num_static_real_features
             lowercase__      			= num_static_categorical_features
             if cardinality 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`''' )
                    lowercase__      			= cardinality
             else:
                    lowercase__      			= [0]
             if embedding_dimension 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`''' )
                    lowercase__      			= embedding_dimension
             else:
                    lowercase__      			= [min(50   ,						(cat + 1) // 2 ) for cat in self.cardinality]
             lowercase__      			= num_parallel_samples

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

             lowercase__      			= dropout
             lowercase__      			= attention_dropout
             lowercase__      			= activation_dropout
             lowercase__      			= encoder_layerdrop
             lowercase__      			= decoder_layerdrop

             lowercase__      			= activation_function
             lowercase__      			= init_std

             lowercase__      			= use_cache

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






      @property
      def       UpperCamelCase__		(self    :    Optional[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_flax_available,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


A     :	Dict    = {
    'configuration_xlm_roberta': [
        'XLM_ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'XLMRobertaConfig',
        'XLMRobertaOnnxConfig',
    ],
}

try:
					if not is_sentencepiece_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					A     :	Union[str, Any]    = ['XLMRobertaTokenizer']

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

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					A     :	List[Any]    = [
					    'XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST',
					    'XLMRobertaForCausalLM',
					    'XLMRobertaForMaskedLM',
					    'XLMRobertaForMultipleChoice',
					    'XLMRobertaForQuestionAnswering',
					    'XLMRobertaForSequenceClassification',
					    'XLMRobertaForTokenClassification',
					    'XLMRobertaModel',
					    'XLMRobertaPreTrainedModel',
					]

try:
					if not is_tf_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					A     :	int    = [
					    'TF_XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST',
					    'TFXLMRobertaForCausalLM',
					    'TFXLMRobertaForMaskedLM',
					    'TFXLMRobertaForMultipleChoice',
					    'TFXLMRobertaForQuestionAnswering',
					    'TFXLMRobertaForSequenceClassification',
					    'TFXLMRobertaForTokenClassification',
					    'TFXLMRobertaModel',
					    'TFXLMRobertaPreTrainedModel',
					]

try:
					if not is_flax_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					A     :	Tuple    = [
					    'FLAX_XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST',
					    'FlaxXLMRobertaForMaskedLM',
					    'FlaxXLMRobertaForCausalLM',
					    'FlaxXLMRobertaForMultipleChoice',
					    'FlaxXLMRobertaForQuestionAnswering',
					    'FlaxXLMRobertaForSequenceClassification',
					    'FlaxXLMRobertaForTokenClassification',
					    'FlaxXLMRobertaModel',
					    'FlaxXLMRobertaPreTrainedModel',
					]

if TYPE_CHECKING:
					from .configuration_xlm_roberta import (
					    XLM_ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP,
					    XLMRobertaConfig,
					    XLMRobertaOnnxConfig,
					)

					try:
										if not is_sentencepiece_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .tokenization_xlm_roberta import XLMRobertaTokenizer

					try:
										if not is_tokenizers_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .tokenization_xlm_roberta_fast import XLMRobertaTokenizerFast

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_xlm_roberta import (
										    XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
										    XLMRobertaForCausalLM,
										    XLMRobertaForMaskedLM,
										    XLMRobertaForMultipleChoice,
										    XLMRobertaForQuestionAnswering,
										    XLMRobertaForSequenceClassification,
										    XLMRobertaForTokenClassification,
										    XLMRobertaModel,
										    XLMRobertaPreTrainedModel,
										)

					try:
										if not is_tf_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_tf_xlm_roberta import (
										    TF_XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
										    TFXLMRobertaForCausalLM,
										    TFXLMRobertaForMaskedLM,
										    TFXLMRobertaForMultipleChoice,
										    TFXLMRobertaForQuestionAnswering,
										    TFXLMRobertaForSequenceClassification,
										    TFXLMRobertaForTokenClassification,
										    TFXLMRobertaModel,
										    TFXLMRobertaPreTrainedModel,
										)

					try:
										if not is_flax_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_flax_xlm_roberta import (
										    FLAX_XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
										    FlaxXLMRobertaForCausalLM,
										    FlaxXLMRobertaForMaskedLM,
										    FlaxXLMRobertaForMultipleChoice,
										    FlaxXLMRobertaForQuestionAnswering,
										    FlaxXLMRobertaForSequenceClassification,
										    FlaxXLMRobertaForTokenClassification,
										    FlaxXLMRobertaModel,
										    FlaxXLMRobertaPreTrainedModel,
										)

else:
					import sys

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