


from typing import List, Optional, Union

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


lowercase_	   =     logging.get_logger(__name__)

lowercase_	   =     {
    '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 	A_ (	__UpperCamelCase   ):




      '''simple docstring'''


      __snake_case 	=       """informer"""
      __snake_case 	=       {
          """hidden_size""": """d_model""",
          """num_attention_heads""": """encoder_attention_heads""",
          """num_hidden_layers""": """encoder_layers""",
      }




      def __init__(    self:	List[str]						,				a:	Optional[int] = None						,				a:	Optional[int] = None						,				a:	str = "student_t"						,				a:	str = "nll"						,				a:	int = 1						,				a:	List[int] = None						,				a:	Optional[Union[str, bool]] = "mean"						,				a:	int = 0						,				a:	int = 0						,				a:	int = 0						,				a:	int = 0						,				a:	Optional[List[int]] = None						,				a:	Optional[List[int]] = None						,				a:	int = 64						,				a:	int = 32						,				a:	int = 32						,				a:	int = 2						,				a:	int = 2						,				a:	int = 2						,				a:	int = 2						,				a:	bool = True						,				a:	str = "gelu"						,				a:	float = 0.0_5						,				a:	float = 0.1						,				a:	float = 0.1						,				a:	float = 0.1						,				a:	float = 0.1						,				a:	int = 100						,				a:	float = 0.0_2						,				a:	List[str]=True						,				a:	str = "prob"						,				a:	int = 5						,				a:	bool = True						,				**a:	str						,				):
       # time series specific configuration
       __lowerCamelCase		:							Optional[int]		 =						prediction_length
       __lowerCamelCase		:							Optional[Any]		 =						context_length or prediction_length
       __lowerCamelCase		:							Optional[Any]		 =						distribution_output
       __lowerCamelCase		:							int		 =						loss
       __lowerCamelCase		:							Dict		 =						input_size
       __lowerCamelCase		:							Union[str, Any]		 =						num_time_features
       __lowerCamelCase		:							List[Any]		 =						lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
       __lowerCamelCase		:							Optional[Any]		 =						scaling
       __lowerCamelCase		:							int		 =						num_dynamic_real_features
       __lowerCamelCase		:							Tuple		 =						num_static_real_features
       __lowerCamelCase		:							str		 =						num_static_categorical_features

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

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

       __lowerCamelCase		:							Any		 =						num_parallel_samples

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

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

       __lowerCamelCase		:							Optional[Any]		 =						activation_function
       __lowerCamelCase		:							List[Any]		 =						init_std

       __lowerCamelCase		:							Union[str, Any]		 =						use_cache

       # Informer
       __lowerCamelCase		:							List[str]		 =						attention_type
       __lowerCamelCase		:							Optional[int]		 =						sampling_factor
       __lowerCamelCase		:							str		 =						distil

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




      @property
      def 					_snake_case     (    self:	int    ):
       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 datasets


lowercase_	   =     '\\n@InProceedings{conneau2018xnli,\n  author = "Conneau, Alexis\n                 and Rinott, Ruty\n                 and Lample, Guillaume\n                 and Williams, Adina\n                 and Bowman, Samuel R.\n                 and Schwenk, Holger\n                 and Stoyanov, Veselin",\n  title = "XNLI: Evaluating Cross-lingual Sentence Representations",\n  booktitle = "Proceedings of the 2018 Conference on Empirical Methods\n               in Natural Language Processing",\n  year = "2018",\n  publisher = "Association for Computational Linguistics",\n  location = "Brussels, Belgium",\n}\n'

lowercase_	   =     '\\nXNLI is a subset of a few thousand examples from MNLI which has been translated\ninto a 14 different languages (some low-ish resource). As with MNLI, the goal is\nto predict textual entailment (does sentence A imply/contradict/neither sentence\nB) and is a classification task (given two sentences, predict one of three\nlabels).\n'

lowercase_	   =     '\nComputes XNLI score which is just simple accuracy.\nArgs:\n    predictions: Predicted labels.\n    references: Ground truth labels.\nReturns:\n    \'accuracy\': accuracy\nExamples:\n\n    >>> predictions = [0, 1]\n    >>> references = [0, 1]\n    >>> xnli_metric = datasets.load_metric("xnli")\n    >>> results = xnli_metric.compute(predictions=predictions, references=references)\n    >>> print(results)\n    {\'accuracy\': 1.0}\n'
def 				UpperCamelCase__					(  SCREAMING_SNAKE_CASE__      ,	SCREAMING_SNAKE_CASE__						):
 return (preds == labels).mean()



@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION ,				_KWARGS_DESCRIPTION   )
class 	A_ (	datasets.Metric   ):




      '''simple docstring'''


      def 					_snake_case     (    self:	Union[str, Any]    ):
       return datasets.MetricInfo(
           description=_DESCRIPTION						,				citation=_CITATION						,				inputs_description=_KWARGS_DESCRIPTION						,				features=datasets.Features(
               {
                   'predictions': datasets.Value('int64' if self.config_name != 'sts-b' else 'float32'    ),
                   'references': datasets.Value('int64' if self.config_name != 'sts-b' else 'float32'    ),
               }    )						,				codebase_urls=[]						,				reference_urls=[]						,				format='numpy'						,				)




      def 					_snake_case     (    self:	int						,				a:	Optional[Any]						,				a:	Optional[Any]    ):
       return {"accuracy": simple_accuracy(a						,				a    )}

