from typing import List, Optional, Union

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


UpperCAmelCase_			    =							logging.get_logger(__name__)

UpperCAmelCase_			    =							{
    '''huggingface/informer-tourism-monthly''': (
        '''https://huggingface.co/huggingface/informer-tourism-monthly/resolve/main/config.json'''
    ),
    # See all Informer models at https://huggingface.co/models?filter=informer
}




class  __magic_name__  (		__a    ):





   """simple docstring"""




   lowerCAmelCase      :    List[Any]  			=   '''informer'''
   lowerCAmelCase      :    Any  			=   {
       '''hidden_size''': '''d_model''',
       '''num_attention_heads''': '''encoder_attention_heads''',
       '''num_hidden_layers''': '''encoder_layers''',
   }



   def __init__(	self					:  Any		,  _lowercase					:  Optional[int] = None		,  _lowercase					:  Optional[int] = None		,  _lowercase					:  str = "student_t"		,  _lowercase					:  str = "nll"		,  _lowercase					:  int = 1		,  _lowercase					:  List[int] = None		,  _lowercase					:  Optional[Union[str, bool]] = "mean"		,  _lowercase					:  int = 0		,  _lowercase					:  int = 0		,  _lowercase					:  int = 0		,  _lowercase					:  int = 0		,  _lowercase					:  Optional[List[int]] = None		,  _lowercase					:  Optional[List[int]] = None		,  _lowercase					:  int = 64		,  _lowercase					:  int = 32		,  _lowercase					:  int = 32		,  _lowercase					:  int = 2		,  _lowercase					:  int = 2		,  _lowercase					:  int = 2		,  _lowercase					:  int = 2		,  _lowercase					:  bool = True		,  _lowercase					:  str = "gelu"		,  _lowercase					:  float = 0.05		,  _lowercase					:  float = 0.1		,  _lowercase					:  float = 0.1		,  _lowercase					:  float = 0.1		,  _lowercase					:  float = 0.1		,  _lowercase					:  int = 100		,  _lowercase					:  float = 0.02		,  _lowercase					:  Union[str, Any]=True		,  _lowercase					:  str = "prob"		,  _lowercase					:  int = 5		,  _lowercase					:  bool = True		,  **_lowercase					:  Optional[int]		,  ):



    """simple docstring"""



    _UpperCamelCase:     Any							= prediction_length
    _UpperCamelCase:     int							= context_length or prediction_length
    _UpperCamelCase:     int							= distribution_output
    _UpperCamelCase:     List[str]							= loss
    _UpperCamelCase:     int							= input_size
    _UpperCamelCase:     Union[str, Any]							= num_time_features
    _UpperCamelCase:     Optional[Any]							= lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
    _UpperCamelCase:     List[str]							= scaling
    _UpperCamelCase:     List[Any]							= num_dynamic_real_features
    _UpperCamelCase:     Tuple							= num_static_real_features
    _UpperCamelCase:     List[str]							= num_static_categorical_features

    # set cardinality
    if cardinality and num_static_categorical_features > 0:
     if len(_lowercase							) != num_static_categorical_features:
      raise ValueError(
          '''The cardinality should be a list of the same length as `num_static_categorical_features`'''							)
     _UpperCamelCase:     Optional[int]							= cardinality
    else:
     _UpperCamelCase:     List[str]							= [0]

    # set embedding_dimension
    if embedding_dimension and num_static_categorical_features > 0:
     if len(_lowercase							) != num_static_categorical_features:
      raise ValueError(
          '''The embedding dimension should be a list of the same length as `num_static_categorical_features`'''							)
     _UpperCamelCase:     List[str]							= embedding_dimension
    else:
     _UpperCamelCase:     str							= [min(50		,  (cat + 1) // 2							) for cat in self.cardinality]

    _UpperCamelCase:     Tuple							= num_parallel_samples

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

    _UpperCamelCase:     List[str]							= dropout
    _UpperCamelCase:     Optional[int]							= attention_dropout
    _UpperCamelCase:     int							= activation_dropout
    _UpperCamelCase:     Any							= encoder_layerdrop
    _UpperCamelCase:     List[Any]							= decoder_layerdrop

    _UpperCamelCase:     Optional[Any]							= activation_function
    _UpperCamelCase:     List[str]							= init_std

    _UpperCamelCase:     List[Any]							= use_cache

    # Informer
    _UpperCamelCase:     Optional[int]							= attention_type
    _UpperCamelCase:     Union[str, Any]							= sampling_factor
    _UpperCamelCase:     Optional[int]							= distil

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



   @property
   def   lowerCAmelCase						(	self					:  str							):



    """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
    )
import pytest

from datasets.splits import SplitDict, SplitInfo
from datasets.utils.py_utils import asdict




@pytest.mark.parametrize(
    '''split_dict'''  ,					[
        SplitDict(),
        SplitDict({'''train''': SplitInfo(name='''train'''  ,					num_bytes=1_337  ,					num_examples=42  ,					dataset_name='''my_dataset'''		)}		),
        SplitDict({'''train''': SplitInfo(name='''train'''  ,					num_bytes=1_337  ,					num_examples=42		)}		),
        SplitDict({'''train''': SplitInfo()}		),
    ]  ,					)
def       lowerCAmelCase_     (		lowercase:							SplitDict		)    ->				List[str]:







 '''simple docstring'''
 _UpperCamelCase:     List[str]							= split_dict._to_yaml_list()
 assert len(lowercase		) == len(lowercase		)
 _UpperCamelCase:     Tuple							= SplitDict._from_yaml_list(lowercase		)
 for split_name, split_info in split_dict.items():
  # dataset_name field is deprecated, and is therefore not part of the YAML dump
  _UpperCamelCase:     Optional[Any]							= None
  # the split name of split_dict takes over the name of the split info object
  _UpperCamelCase:     Any							= split_name
 assert split_dict == reloaded





@pytest.mark.parametrize(
    '''split_info'''  ,					[SplitInfo(), SplitInfo(dataset_name=lowercase		), SplitInfo(dataset_name='''my_dataset'''		)]		)
def       lowerCAmelCase_     (		lowercase:							str		)    ->				Tuple:







 '''simple docstring'''
 # For backward compatibility, we need asdict(split_dict) to return split info dictrionaries with the "dataset_name"
 # field even if it's deprecated. This way old versionso of `datasets` can still reload dataset_infos.json files
 _UpperCamelCase:     Optional[Any]							= asdict(SplitDict({'''train''': split_info}		)		)
 assert "dataset_name" in split_dict_asdict["train"]
 assert split_dict_asdict["train"]["dataset_name"] == split_info.dataset_name