



'''simple docstring'''




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


a   :			List[str]					  =    logging.get_logger(__name__)

a   :			Dict					  =    {
    """vinvino02/glpn-kitti""": """https://huggingface.co/vinvino02/glpn-kitti/resolve/main/config.json""",
    # See all GLPN models at https://huggingface.co/models?filter=glpn
}

class 			UpperCamelCase_ (							__magic_name__			):
	lowercase          = "glpn"





	def __init__(  self		,		A=3		,		A=4		,		A=[2, 2, 2, 2]		,		A=[8, 4, 2, 1]		,		A=[32, 64, 160, 256]		,		A=[7, 3, 3, 3]		,		A=[4, 2, 2, 2]		,		A=[1, 2, 5, 8]		,		A=[4, 4, 4, 4]		,		A="gelu"		,		A=0.0		,		A=0.0		,		A=0.0_2		,		A=0.1		,		A=1e-6		,		A=64		,		A=10		,		A=-1		,		**A		,		)			->			Optional[Any]:
								super().__init__(**UpperCAmelCase__    )

								UpperCAmelCase     :		Dict							     =		num_channels
								UpperCAmelCase     :		Optional[Any]							     =		num_encoder_blocks
								UpperCAmelCase     :		List[Any]							     =		depths
								UpperCAmelCase     :		List[str]							     =		sr_ratios
								UpperCAmelCase     :		Any							     =		hidden_sizes
								UpperCAmelCase     :		List[Any]							     =		patch_sizes
								UpperCAmelCase     :		Dict							     =		strides
								UpperCAmelCase     :		Tuple							     =		mlp_ratios
								UpperCAmelCase     :		List[Any]							     =		num_attention_heads
								UpperCAmelCase     :		Optional[int]							     =		hidden_act
								UpperCAmelCase     :		Optional[Any]							     =		hidden_dropout_prob
								UpperCAmelCase     :		str							     =		attention_probs_dropout_prob
								UpperCAmelCase     :		Union[str, Any]							     =		initializer_range
								UpperCAmelCase     :		Optional[int]							     =		drop_path_rate
								UpperCAmelCase     :		str							     =		layer_norm_eps
								UpperCAmelCase     :		Union[str, Any]							     =		decoder_hidden_size
								UpperCAmelCase     :		Any							     =		max_depth
								UpperCAmelCase     :		str							     =		head_in_index




"""simple docstring"""





from typing import List, Optional, Union

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


_a       =							logging.get_logger(__name__)

_a       =							{
    '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"""







 __UpperCAmelCase	:					int   		=	"time_series_transformer"
 __UpperCAmelCase	:					Any   		=	{
     "hidden_size": "d_model",
     "num_attention_heads": "encoder_attention_heads",
     "num_hidden_layers": "encoder_layers",
 }


 def __init__(			self							:			int,					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 = 3_2,					UpperCAmelCase__							:			int = 3_2,					UpperCAmelCase__							:			int = 2,					UpperCAmelCase__							:			int = 2,					UpperCAmelCase__							:			int = 2,					UpperCAmelCase__							:			int = 2,					UpperCAmelCase__							:			bool = True,					UpperCAmelCase__							:			str = "gelu",					UpperCAmelCase__							:			int = 6_4,					UpperCAmelCase__							:			float = 0.1,					UpperCAmelCase__							:			float = 0.1,					UpperCAmelCase__							:			float = 0.1,					UpperCAmelCase__							:			float = 0.1,					UpperCAmelCase__							:			float = 0.1,					UpperCAmelCase__							:			int = 1_0_0,					UpperCAmelCase__							:			float = 0.02,					UpperCAmelCase__							:			Any=True,					**UpperCAmelCase__							:			List[str],					):
    # time series specific configuration
    __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(5_0,					(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 					_lowercase (			self							:			Optional[Any]	):
    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
    )




