




'''simple docstring'''


from typing import List, Optional, Union

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


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

_snake_case   :   Tuple     							=	{
    '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					(	_a					):
							lowercase_           =       'informer'
							lowercase_           =       {
							    'hidden_size': 'd_model',
							    'num_attention_heads': 'encoder_attention_heads',
							    'num_hidden_layers': 'encoder_layers',
							}







							def __init__(						self :						Union[str, Any]							,    lowerCAmelCase_ :						Optional[int] = None							,    lowerCAmelCase_ :						Optional[int] = None							,    lowerCAmelCase_ :						str = "student_t"							,    lowerCAmelCase_ :						str = "nll"							,    lowerCAmelCase_ :						int = 1							,    lowerCAmelCase_ :						List[int] = None							,    lowerCAmelCase_ :						Optional[Union[str, bool]] = "mean"							,    lowerCAmelCase_ :						int = 0							,    lowerCAmelCase_ :						int = 0							,    lowerCAmelCase_ :						int = 0							,    lowerCAmelCase_ :						int = 0							,    lowerCAmelCase_ :						Optional[List[int]] = None							,    lowerCAmelCase_ :						Optional[List[int]] = None							,    lowerCAmelCase_ :						int = 64							,    lowerCAmelCase_ :						int = 32							,    lowerCAmelCase_ :						int = 32							,    lowerCAmelCase_ :						int = 2							,    lowerCAmelCase_ :						int = 2							,    lowerCAmelCase_ :						int = 2							,    lowerCAmelCase_ :						int = 2							,    lowerCAmelCase_ :						bool = True							,    lowerCAmelCase_ :						str = "gelu"							,    lowerCAmelCase_ :						float = 0.0_5							,    lowerCAmelCase_ :						float = 0.1							,    lowerCAmelCase_ :						float = 0.1							,    lowerCAmelCase_ :						float = 0.1							,    lowerCAmelCase_ :						float = 0.1							,    lowerCAmelCase_ :						int = 1_00							,    lowerCAmelCase_ :						float = 0.0_2							,    lowerCAmelCase_ :						int=True							,    lowerCAmelCase_ :						str = "prob"							,    lowerCAmelCase_ :						int = 5							,    lowerCAmelCase_ :						bool = True							,    **lowerCAmelCase_ :						Tuple							,    )    ->							Optional[int]:


														"""simple docstring"""


														_a			  =       prediction_length
														_a			  =       context_length or prediction_length
														_a			  =       distribution_output
														_a			  =       loss
														_a			  =       input_size
														_a			  =       num_time_features
														_a			  =       lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
														_a			  =       scaling
														_a			  =       num_dynamic_real_features
														_a			  =       num_static_real_features
														_a			  =       num_static_categorical_features

														# set cardinality
														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			  =       cardinality
														else:
																					_a			  =       [0]

														# set embedding_dimension
														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			  =       embedding_dimension
														else:
																					_a			  =       [min(50							,    (cat + 1) // 2      ) for cat in self.cardinality]

														_a			  =       num_parallel_samples

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

														_a			  =       dropout
														_a			  =       attention_dropout
														_a			  =       activation_dropout
														_a			  =       encoder_layerdrop
														_a			  =       decoder_layerdrop

														_a			  =       activation_function
														_a			  =       init_std

														_a			  =       use_cache

														# Informer
														_a			  =       attention_type
														_a			  =       sampling_factor
														_a			  =       distil

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







							@property
							def      __lowerCAmelCase    (						self :						List[Any]      )    ->							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
														)







'''simple docstring'''


import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin


_snake_case   :   str     							=	'\nHugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that developed a chatbot app targeted at teenagers.[2] After open-sourcing the model behind the chatbot, the company pivoted to focus on being a platform for machine learning.\n\nIn March 2021, Hugging Face raised $40 million in a Series B funding round.[3]\n\nOn April 28, 2021, the company launched the BigScience Research Workshop in collaboration with several other research groups to release an open large language model.[4] In 2022, the workshop concluded with the announcement of BLOOM, a multilingual large language model with 176 billion parameters.[5]\n'

class     A					(	unittest.TestCase  ,_a					):







							def      __lowerCAmelCase    (						self :						Any      )    ->							Dict:


														"""simple docstring"""


														_a			  =       load_tool('''text-question-answering'''      )
														self.tool.setup()
														_a			  =       load_tool('''text-question-answering'''							,    remote=lowerCAmelCase_      )







							def      __lowerCAmelCase    (						self :						List[Any]      )    ->							Optional[int]:


														"""simple docstring"""


														_a			  =       self.tool(lowerCAmelCase_							,    '''What did Hugging Face do in April 2021?'''      )
														self.assertEqual(lowerCAmelCase_							,    '''launched the BigScience Research Workshop'''      )







							def      __lowerCAmelCase    (						self :						Union[str, Any]      )    ->							Dict:


														"""simple docstring"""


														_a			  =       self.remote_tool(lowerCAmelCase_							,    '''What did Hugging Face do in April 2021?'''      )
														self.assertEqual(lowerCAmelCase_							,    '''launched the BigScience Research Workshop'''      )







							def      __lowerCAmelCase    (						self :						List[Any]      )    ->							List[str]:


														"""simple docstring"""


														_a			  =       self.tool(text=lowerCAmelCase_							,    question='''What did Hugging Face do in April 2021?'''      )
														self.assertEqual(lowerCAmelCase_							,    '''launched the BigScience Research Workshop'''      )







							def      __lowerCAmelCase    (						self :						int      )    ->							List[Any]:


														"""simple docstring"""


														_a			  =       self.remote_tool(text=lowerCAmelCase_							,    question='''What did Hugging Face do in April 2021?'''      )
														self.assertEqual(lowerCAmelCase_							,    '''launched the BigScience Research Workshop'''      )

