
"""simple docstring"""





import json
import os
import tempfile

from transformers.testing_utils import check_json_file_has_correct_format
class 						SCREAMING_SNAKE_CASE_ :




		"""simple docstring"""





		__lowercase							:  int						   =		None




		def 	snake_case_     (     self):
				__SCREAMING_SNAKE_CASE            = self.feature_extraction_class(**self.feat_extract_dict)
				__SCREAMING_SNAKE_CASE            = json.loads(feat_extract.to_json_string())
				for key, value in self.feat_extract_dict.items():
						self.assertEqual(obj[key]							,  __UpperCAmelCase)




		def 	snake_case_     (     self):
				__SCREAMING_SNAKE_CASE            = self.feature_extraction_class(**self.feat_extract_dict)

				with tempfile.TemporaryDirectory() as tmpdirname:
						__SCREAMING_SNAKE_CASE            = os.path.join(__UpperCAmelCase							,  """feat_extract.json""")
						feat_extract_first.to_json_file(__UpperCAmelCase)
						__SCREAMING_SNAKE_CASE            = self.feature_extraction_class.from_json_file(__UpperCAmelCase)

				self.assertEqual(feat_extract_second.to_dict()							,  feat_extract_first.to_dict())




		def 	snake_case_     (     self):
				__SCREAMING_SNAKE_CASE            = self.feature_extraction_class(**self.feat_extract_dict)

				with tempfile.TemporaryDirectory() as tmpdirname:
						__SCREAMING_SNAKE_CASE            = feat_extract_first.save_pretrained(__UpperCAmelCase)[0]
						check_json_file_has_correct_format(__UpperCAmelCase)
						__SCREAMING_SNAKE_CASE            = self.feature_extraction_class.from_pretrained(__UpperCAmelCase)

				self.assertEqual(feat_extract_second.to_dict()							,  feat_extract_first.to_dict())




		def 	snake_case_     (     self):
				__SCREAMING_SNAKE_CASE            = self.feature_extraction_class()
				self.assertIsNotNone(__UpperCAmelCase)





"""simple docstring"""




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


__lowerCamelCase							 =     logging.get_logger(__name__)

__lowerCamelCase							 =     {
    "transfo-xl-wt103": "https://huggingface.co/transfo-xl-wt103/resolve/main/config.json",
}
class 			UpperCamelCase__(	__A       ):
						lowerCAmelCase__     :  Union[str, Any]  							=						'transfo-xl'
						lowerCAmelCase__     :  Any  							=						['mems']
						lowerCAmelCase__     :  Tuple  							=						{
						    'n_token': 'vocab_size',
						    'hidden_size': 'd_model',
						    'num_attention_heads': 'n_head',
						    'num_hidden_layers': 'n_layer',
						}





						def __init__(				self						,__UpperCAmelCase=26_77_35						,__UpperCAmelCase=[2_00_00, 4_00_00, 20_00_00]						,__UpperCAmelCase=10_24						,__UpperCAmelCase=10_24						,__UpperCAmelCase=16						,__UpperCAmelCase=64						,__UpperCAmelCase=40_96						,__UpperCAmelCase=4						,__UpperCAmelCase=False						,__UpperCAmelCase=18						,__UpperCAmelCase=16_00						,__UpperCAmelCase=10_00						,__UpperCAmelCase=True						,__UpperCAmelCase=True						,__UpperCAmelCase=0						,__UpperCAmelCase=-1						,__UpperCAmelCase=True						,__UpperCAmelCase=0.1						,__UpperCAmelCase=0.0						,__UpperCAmelCase=True						,__UpperCAmelCase="normal"						,__UpperCAmelCase=0.0_1						,__UpperCAmelCase=0.0_1						,__UpperCAmelCase=0.0_2						,__UpperCAmelCase=1e-5						,__UpperCAmelCase=0						,**__UpperCAmelCase						,)    -> Tuple:
													A__		   =							vocab_size
													A__		   =							[]
													self.cutoffs.extend(__UpperCAmelCase   )
													if proj_share_all_but_first:
																				A__		   =							[False] + [True] * len(self.cutoffs   )
													else:
																				A__		   =							[False] + [False] * len(self.cutoffs   )
													A__		   =							d_model
													A__		   =							d_embed
													A__		   =							d_head
													A__		   =							d_inner
													A__		   =							div_val
													A__		   =							pre_lnorm
													A__		   =							n_layer
													A__		   =							n_head
													A__		   =							mem_len
													A__		   =							same_length
													A__		   =							attn_type
													A__		   =							clamp_len
													A__		   =							sample_softmax
													A__		   =							adaptive
													A__		   =							dropout
													A__		   =							dropatt
													A__		   =							untie_r
													A__		   =							init
													A__		   =							init_range
													A__		   =							proj_init_std
													A__		   =							init_std
													A__		   =							layer_norm_epsilon
													super().__init__(eos_token_id=__UpperCAmelCase						,**__UpperCAmelCase   )





						@property
						def  snake_case__		(				self   )    -> Optional[Any]:
													# Message copied from Transformer-XL documentation
													logger.info(f'''The model {self.model_type} is one of the few models that has no sequence length limit.'''   )
													return -1





						@max_position_embeddings.setter
						def  snake_case__		(				self						,__UpperCAmelCase   )    -> int:
													# Message copied from Transformer-XL documentation
													raise NotImplementedError(
													    f'''The model {self.model_type} is one of the few models that has no sequence length limit.'''   )





