



'''simple docstring'''




import pickle
import shutil
import tempfile
import unittest

from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast
from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow
from transformers.utils import cached_property

from ...test_tokenization_common import TokenizerTesterMixin


a   :			Dict					  =    get_tests_dir("""fixtures/test_sentencepiece.model""")

@require_sentencepiece
@require_tokenizers
class 			UpperCamelCase_ (							lowercase_      ,     unittest.TestCase			):
	lowercase          = XLMRobertaTokenizer
	lowercase          = XLMRobertaTokenizerFast
	lowercase          = True
	lowercase          = True





	def  _lowercase(  self    )			->			int:
								super().setUp()

								# We have a SentencePiece fixture for testing
								UpperCAmelCase     :		Any							     =		XLMRobertaTokenizer(SCREAMING_SNAKE_CASE_		,		keep_accents=SCREAMING_SNAKE_CASE_    )
								tokenizer.save_pretrained(self.tmpdirname    )





	def  _lowercase(  self    )			->			int:
								UpperCAmelCase     :		Any							     =		'<pad>'
								UpperCAmelCase     :		int							     =		1

								self.assertEqual(self.get_tokenizer()._convert_token_to_id(SCREAMING_SNAKE_CASE_    )		,		SCREAMING_SNAKE_CASE_    )
								self.assertEqual(self.get_tokenizer()._convert_id_to_token(SCREAMING_SNAKE_CASE_    )		,		SCREAMING_SNAKE_CASE_    )





	def  _lowercase(  self    )			->			Tuple:
								UpperCAmelCase     :		int							     =		list(self.get_tokenizer().get_vocab().keys()    )

								self.assertEqual(vocab_keys[0]		,		"""<s>"""    )
								self.assertEqual(vocab_keys[1]		,		"""<pad>"""    )
								self.assertEqual(vocab_keys[-1]		,		"""<mask>"""    )
								self.assertEqual(len(SCREAMING_SNAKE_CASE_    )		,		1002    )





	def  _lowercase(  self    )			->			Union[str, Any]:
								self.assertEqual(self.get_tokenizer().vocab_size		,		1002    )





	def  _lowercase(  self    )			->			List[Any]:
								UpperCAmelCase     :		int							     =		XLMRobertaTokenizer(SCREAMING_SNAKE_CASE_		,		keep_accents=SCREAMING_SNAKE_CASE_    )

								UpperCAmelCase     :		Optional[Any]							     =		tokenizer.tokenize("""This is a test"""    )
								self.assertListEqual(SCREAMING_SNAKE_CASE_		,		["""▁This""", """▁is""", """▁a""", """▁t""", """est"""]    )

								self.assertListEqual(
								    tokenizer.convert_tokens_to_ids(SCREAMING_SNAKE_CASE_    )		,		[value + tokenizer.fairseq_offset for value in [285, 46, 10, 170, 382]]		,		)

								UpperCAmelCase     :		int							     =		tokenizer.tokenize("""I was born in 92000, and this is falsé."""    )
								self.assertListEqual(
								    SCREAMING_SNAKE_CASE_		,		[
								        SPIECE_UNDERLINE + """I""",
								        SPIECE_UNDERLINE + """was""",
								        SPIECE_UNDERLINE + """b""",
								        """or""",
								        """n""",
								        SPIECE_UNDERLINE + """in""",
								        SPIECE_UNDERLINE + """""",
								        """9""",
								        """2""",
								        """0""",
								        """0""",
								        """0""",
								        """,""",
								        SPIECE_UNDERLINE + """and""",
								        SPIECE_UNDERLINE + """this""",
								        SPIECE_UNDERLINE + """is""",
								        SPIECE_UNDERLINE + """f""",
								        """al""",
								        """s""",
								        """é""",
								        """.""",
								    ]		,		)
								UpperCAmelCase     :		Any							     =		tokenizer.convert_tokens_to_ids(SCREAMING_SNAKE_CASE_    )
								self.assertListEqual(
								    SCREAMING_SNAKE_CASE_		,		[
								        value + tokenizer.fairseq_offset
								        for value in [8, 21, 84, 55, 24, 19, 7, 2, 602, 347, 347, 347, 3, 12, 66, 46, 72, 80, 6, 2, 4]
								        #                                       ^ unk: 2 + 1 = 3                  unk: 2 + 1 = 3 ^
								    ]		,		)

								UpperCAmelCase     :		Union[str, Any]							     =		tokenizer.convert_ids_to_tokens(SCREAMING_SNAKE_CASE_    )
								self.assertListEqual(
								    SCREAMING_SNAKE_CASE_		,		[
								        SPIECE_UNDERLINE + """I""",
								        SPIECE_UNDERLINE + """was""",
								        SPIECE_UNDERLINE + """b""",
								        """or""",
								        """n""",
								        SPIECE_UNDERLINE + """in""",
								        SPIECE_UNDERLINE + """""",
								        """<unk>""",
								        """2""",
								        """0""",
								        """0""",
								        """0""",
								        """,""",
								        SPIECE_UNDERLINE + """and""",
								        SPIECE_UNDERLINE + """this""",
								        SPIECE_UNDERLINE + """is""",
								        SPIECE_UNDERLINE + """f""",
								        """al""",
								        """s""",
								        """<unk>""",
								        """.""",
								    ]		,		)





	def  _lowercase(  self    )			->			Optional[Any]:
								if not self.test_slow_tokenizer:
															# as we don't have a slow version, we can't compare the outputs between slow and fast versions
															return

								UpperCAmelCase     :		List[str]							     =		(self.rust_tokenizer_class, 'hf-internal-testing/tiny-xlm-roberta', {})
								for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
															with self.subTest(f'''{tokenizer.__class__.__name__} ({pretrained_name})'''    ):
																						UpperCAmelCase     :		str							     =		self.rust_tokenizer_class.from_pretrained(SCREAMING_SNAKE_CASE_		,		**SCREAMING_SNAKE_CASE_    )
																						UpperCAmelCase     :		Optional[int]							     =		self.tokenizer_class.from_pretrained(SCREAMING_SNAKE_CASE_		,		**SCREAMING_SNAKE_CASE_    )

																						UpperCAmelCase     :		str							     =		tempfile.mkdtemp()

																						UpperCAmelCase     :		int							     =		tokenizer_r.save_pretrained(SCREAMING_SNAKE_CASE_    )
																						UpperCAmelCase     :		Optional[int]							     =		tokenizer_p.save_pretrained(SCREAMING_SNAKE_CASE_    )

																						# Checks it save with the same files + the tokenizer.json file for the fast one
																						self.assertTrue(any("""tokenizer.json""" in f for f in tokenizer_r_files    )    )
																						UpperCAmelCase     :		Optional[Any]							     =		tuple(f for f in tokenizer_r_files if """tokenizer.json""" not in f    )
																						self.assertSequenceEqual(SCREAMING_SNAKE_CASE_		,		SCREAMING_SNAKE_CASE_    )

																						# Checks everything loads correctly in the same way
																						UpperCAmelCase     :		int							     =		tokenizer_r.from_pretrained(SCREAMING_SNAKE_CASE_    )
																						UpperCAmelCase     :		Optional[int]							     =		tokenizer_p.from_pretrained(SCREAMING_SNAKE_CASE_    )

																						# Check special tokens are set accordingly on Rust and Python
																						for key in tokenizer_pp.special_tokens_map:
																													self.assertTrue(hasattr(SCREAMING_SNAKE_CASE_		,		SCREAMING_SNAKE_CASE_    )    )
																													# self.assertEqual(getattr(tokenizer_rp, key), getattr(tokenizer_pp, key))
																													# self.assertEqual(getattr(tokenizer_rp, key + "_id"), getattr(tokenizer_pp, key + "_id"))

																						shutil.rmtree(SCREAMING_SNAKE_CASE_    )

																						# Save tokenizer rust, legacy_format=True
																						UpperCAmelCase     :		str							     =		tempfile.mkdtemp()

																						UpperCAmelCase     :		List[str]							     =		tokenizer_r.save_pretrained(SCREAMING_SNAKE_CASE_		,		legacy_format=SCREAMING_SNAKE_CASE_    )
																						UpperCAmelCase     :		str							     =		tokenizer_p.save_pretrained(SCREAMING_SNAKE_CASE_    )

																						# Checks it save with the same files
																						self.assertSequenceEqual(SCREAMING_SNAKE_CASE_		,		SCREAMING_SNAKE_CASE_    )

																						# Checks everything loads correctly in the same way
																						UpperCAmelCase     :		str							     =		tokenizer_r.from_pretrained(SCREAMING_SNAKE_CASE_    )
																						UpperCAmelCase     :		Union[str, Any]							     =		tokenizer_p.from_pretrained(SCREAMING_SNAKE_CASE_    )

																						# Check special tokens are set accordingly on Rust and Python
																						for key in tokenizer_pp.special_tokens_map:
																													self.assertTrue(hasattr(SCREAMING_SNAKE_CASE_		,		SCREAMING_SNAKE_CASE_    )    )

																						shutil.rmtree(SCREAMING_SNAKE_CASE_    )

																						# Save tokenizer rust, legacy_format=False
																						UpperCAmelCase     :		int							     =		tempfile.mkdtemp()

																						UpperCAmelCase     :		Optional[Any]							     =		tokenizer_r.save_pretrained(SCREAMING_SNAKE_CASE_		,		legacy_format=SCREAMING_SNAKE_CASE_    )
																						UpperCAmelCase     :		int							     =		tokenizer_p.save_pretrained(SCREAMING_SNAKE_CASE_    )

																						# Checks it saved the tokenizer.json file
																						self.assertTrue(any("""tokenizer.json""" in f for f in tokenizer_r_files    )    )

																						# Checks everything loads correctly in the same way
																						UpperCAmelCase     :		List[str]							     =		tokenizer_r.from_pretrained(SCREAMING_SNAKE_CASE_    )
																						UpperCAmelCase     :		Optional[int]							     =		tokenizer_p.from_pretrained(SCREAMING_SNAKE_CASE_    )

																						# Check special tokens are set accordingly on Rust and Python
																						for key in tokenizer_pp.special_tokens_map:
																													self.assertTrue(hasattr(SCREAMING_SNAKE_CASE_		,		SCREAMING_SNAKE_CASE_    )    )

																						shutil.rmtree(SCREAMING_SNAKE_CASE_    )





	@cached_property
	def  _lowercase(  self    )			->			List[Any]:
								return XLMRobertaTokenizer.from_pretrained("""xlm-roberta-base"""    )





	def  _lowercase(  self    )			->			str:
								with tempfile.NamedTemporaryFile() as f:
															shutil.copyfile(SCREAMING_SNAKE_CASE_		,		f.name    )
															UpperCAmelCase     :		Tuple							     =		XLMRobertaTokenizer(f.name		,		keep_accents=SCREAMING_SNAKE_CASE_    )
															UpperCAmelCase     :		Dict							     =		pickle.dumps(SCREAMING_SNAKE_CASE_    )
								pickle.loads(SCREAMING_SNAKE_CASE_    )





	def  _lowercase(  self    )			->			Any:
								if not self.test_rust_tokenizer:
															return

								UpperCAmelCase     :		Union[str, Any]							     =		self.get_tokenizer()
								UpperCAmelCase     :		Dict							     =		self.get_rust_tokenizer()

								UpperCAmelCase     :		Tuple							     =		'I was born in 92000, and this is falsé.'

								UpperCAmelCase     :		Union[str, Any]							     =		tokenizer.tokenize(SCREAMING_SNAKE_CASE_    )
								UpperCAmelCase     :		Dict							     =		rust_tokenizer.tokenize(SCREAMING_SNAKE_CASE_    )
								self.assertListEqual(SCREAMING_SNAKE_CASE_		,		SCREAMING_SNAKE_CASE_    )

								UpperCAmelCase     :		Any							     =		tokenizer.encode(SCREAMING_SNAKE_CASE_		,		add_special_tokens=SCREAMING_SNAKE_CASE_    )
								UpperCAmelCase     :		List[str]							     =		rust_tokenizer.encode(SCREAMING_SNAKE_CASE_		,		add_special_tokens=SCREAMING_SNAKE_CASE_    )
								self.assertListEqual(SCREAMING_SNAKE_CASE_		,		SCREAMING_SNAKE_CASE_    )

								UpperCAmelCase     :		int							     =		self.get_rust_tokenizer()
								UpperCAmelCase     :		Any							     =		tokenizer.encode(SCREAMING_SNAKE_CASE_    )
								UpperCAmelCase     :		List[Any]							     =		rust_tokenizer.encode(SCREAMING_SNAKE_CASE_    )
								self.assertListEqual(SCREAMING_SNAKE_CASE_		,		SCREAMING_SNAKE_CASE_    )





	@slow
	def  _lowercase(  self    )			->			Union[str, Any]:
								UpperCAmelCase     :		Any							     =		'Hello World!'
								UpperCAmelCase     :		Union[str, Any]							     =		[0, 35378, 6661, 38, 2]
								# xlmr = torch.hub.load('pytorch/fairseq', 'xlmr.base')  # xlmr.large has same tokenizer
								# xlmr.eval()
								# xlmr.encode(symbols)

								self.assertListEqual(SCREAMING_SNAKE_CASE_		,		self.big_tokenizer.encode(SCREAMING_SNAKE_CASE_    )    )





	@slow
	def  _lowercase(  self    )			->			Optional[Any]:
								UpperCAmelCase     :		Tuple							     =		(
								    'This is a very long text with a lot of weird characters, such as: . , ~ ? ( ) " [ ] ! : - . Also we will'
								    ' add words that should not exsist and be tokenized to <unk>, such as saoneuhaoesuth'
								)
								UpperCAmelCase     :		int							     =		[
								    0,
								    3293,
								    83,
								    10,
								    4552,
								    4989,
								    7986,
								    678,
								    10,
								    5915,
								    111,
								    179459,
								    124850,
								    4,
								    6044,
								    237,
								    12,
								    6,
								    5,
								    6,
								    4,
								    6780,
								    705,
								    15,
								    1388,
								    44,
								    378,
								    10114,
								    711,
								    152,
								    20,
								    6,
								    5,
								    22376,
								    642,
								    1221,
								    15190,
								    34153,
								    450,
								    5608,
								    959,
								    1119,
								    57702,
								    136,
								    186,
								    47,
								    1098,
								    29367,
								    47,
								    # 4426, # What fairseq tokenizes from "<unk>": "_<"
								    # 3678, # What fairseq tokenizes from "<unk>": "unk"
								    # 2740, # What fairseq tokenizes from "<unk>": ">"
								    3,  # What we tokenize from "<unk>": "<unk>"
								    6,  # Residue from the tokenization: an extra sentencepiece underline
								    4,
								    6044,
								    237,
								    6284,
								    50901,
								    528,
								    31,
								    90,
								    34,
								    927,
								    2,
								]
								# xlmr = torch.hub.load('pytorch/fairseq', 'xlmr.base')  # xlmr.large has same tokenizer
								# xlmr.eval()
								# xlmr.encode(symbols)

								self.assertListEqual(SCREAMING_SNAKE_CASE_		,		self.big_tokenizer.encode(SCREAMING_SNAKE_CASE_    )    )






	@slow
	def  _lowercase(  self    )			->			Union[str, Any]:
								# fmt: off
								UpperCAmelCase     :		List[str]							     =		{'input_ids': [[0, 11062, 82772, 7, 15, 82772, 538, 51529, 237, 17198, 1290, 206, 9, 215175, 1314, 136, 17198, 1290, 206, 9, 56359, 42, 122009, 9, 16466, 16, 87344, 4537, 9, 4717, 78381, 6, 159958, 7, 15, 24480, 618, 4, 527, 22693, 5428, 4, 2777, 24480, 9874, 4, 43523, 594, 4, 803, 18392, 33189, 18, 4, 43523, 24447, 12399, 100, 24955, 83658, 9626, 144057, 15, 839, 22335, 16, 136, 24955, 83658, 83479, 15, 39102, 724, 16, 678, 645, 2789, 1328, 4589, 42, 122009, 115774, 23, 805, 1328, 46876, 7, 136, 53894, 1940, 42227, 41159, 17721, 823, 425, 4, 27512, 98722, 206, 136, 5531, 4970, 919, 17336, 5, 2], [0, 20080, 618, 83, 82775, 47, 479, 9, 1517, 73, 53894, 333, 80581, 110117, 18811, 5256, 1295, 51, 152526, 297, 7986, 390, 124416, 538, 35431, 214, 98, 15044, 25737, 136, 7108, 43701, 23, 756, 135355, 7, 5, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 581, 63773, 119455, 6, 147797, 88203, 7, 645, 70, 21, 3285, 10269, 5, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], 'attention_mask': [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]}  # noqa: E501
								# fmt: on

								self.tokenizer_integration_test_util(
								    expected_encoding=SCREAMING_SNAKE_CASE_		,		model_name="""xlm-roberta-base"""		,		revision="""d9d8a8ea5eb94b1c6654ae9249df7793cd2933d3"""		,		)






"""simple docstring"""







from typing import List, Optional, Union

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


lowercase__		:				Union[str, Any]          =	logging.get_logger(__name__)

lowercase__		:				List[str]          =	{
    """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       UpperCamelCase__   (	lowercase_  ):




      """simple docstring"""




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



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

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

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

        lowerCAmelCase_   :				Optional[int]								= num_parallel_samples

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

        lowerCAmelCase_   :				Optional[int]								= dropout
        lowerCAmelCase_   :				Dict								= attention_dropout
        lowerCAmelCase_   :				int								= activation_dropout
        lowerCAmelCase_   :				Dict								= encoder_layerdrop
        lowerCAmelCase_   :				str								= decoder_layerdrop

        lowerCAmelCase_   :				Union[str, Any]								= activation_function
        lowerCAmelCase_   :				Union[str, Any]								= init_std

        lowerCAmelCase_   :				Union[str, Any]								= use_cache

        # Informer
        lowerCAmelCase_   :				Optional[int]								= attention_type
        lowerCAmelCase_   :				Any								= sampling_factor
        lowerCAmelCase_   :				int								= distil

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





      @property
      def      SCREAMING_SNAKE_CASE__ (      self				:      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
        )





