

'''simple docstring'''


import json
import os
import tempfile

from transformers.testing_utils import check_json_file_has_correct_format




class     a			:






						"""simple docstring"""




						__UpperCAmelCase			     =    None







						def       __magic_name__							(							self					:      Tuple  ):



								'''simple docstring'''



								snake_case__						:       int       						=  self.feature_extraction_class(**self.feat_extract_dict  )
								snake_case__						:       Any       						=  json.loads(feat_extract.to_json_string()  )
								for key, value in self.feat_extract_dict.items():
										self.assertEqual(obj[key]			,			__UpperCamelCase  )







						def       __magic_name__							(							self					:      Optional[Any]  ):



								'''simple docstring'''



								snake_case__						:       Tuple       						=  self.feature_extraction_class(**self.feat_extract_dict  )

								with tempfile.TemporaryDirectory() as tmpdirname:
										snake_case__						:       Union[str, Any]       						=  os.path.join(__UpperCamelCase			,			'''feat_extract.json'''  )
										feat_extract_first.to_json_file(__UpperCamelCase  )
										snake_case__						:       Optional[int]       						=  self.feature_extraction_class.from_json_file(__UpperCamelCase  )

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







						def       __magic_name__							(							self					:      List[Any]  ):



								'''simple docstring'''



								snake_case__						:       str       						=  self.feature_extraction_class(**self.feat_extract_dict  )

								with tempfile.TemporaryDirectory() as tmpdirname:
										snake_case__						:       Dict       						=  feat_extract_first.save_pretrained(__UpperCamelCase  )[0]
										check_json_file_has_correct_format(__UpperCamelCase  )
										snake_case__						:       str       						=  self.feature_extraction_class.from_pretrained(__UpperCamelCase  )

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







						def       __magic_name__							(							self					:      Union[str, Any]  ):



								'''simple docstring'''



								snake_case__						:       Tuple       						=  self.feature_extraction_class()
								self.assertIsNotNone(__UpperCamelCase  )






'''simple docstring'''


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


lowerCAmelCase__						:       Dict										=						logging.get_logger(__name__)

lowerCAmelCase__						:       Tuple										=						{"""ctrl""": """https://huggingface.co/ctrl/resolve/main/config.json"""}




class     a			(				SCREAMING_SNAKE_CASE       ):






						"""simple docstring"""




						__UpperCAmelCase			     =    """ctrl"""
						__UpperCAmelCase			     =    ["""past_key_values"""]
						__UpperCAmelCase			     =    {
						    """max_position_embeddings""": """n_positions""",
						    """hidden_size""": """n_embd""",
						    """num_attention_heads""": """n_head""",
						    """num_hidden_layers""": """n_layer""",
						}







						def __init__(							self					:      Tuple			,			snake_case_					:      Dict=2_4_6_5_3_4			,			snake_case_					:      Optional[int]=2_5_6			,			snake_case_					:      Dict=1_2_8_0			,			snake_case_					:      Union[str, Any]=8_1_9_2			,			snake_case_					:      Any=4_8			,			snake_case_					:      List[Any]=1_6			,			snake_case_					:      Optional[Any]=0.1			,			snake_case_					:      Union[str, Any]=0.1			,			snake_case_					:      Optional[Any]=1e-6			,			snake_case_					:      List[Any]=0.0_2			,			snake_case_					:      Dict=True			,			**snake_case_					:      List[Any]			,			):



								'''simple docstring'''



								snake_case__						:       Any       						=  vocab_size
								snake_case__						:       int       						=  n_positions
								snake_case__						:       Optional[int]       						=  n_embd
								snake_case__						:       str       						=  n_layer
								snake_case__						:       Any       						=  n_head
								snake_case__						:       str       						=  dff
								snake_case__						:       Any       						=  resid_pdrop
								snake_case__						:       Tuple       						=  embd_pdrop
								snake_case__						:       List[str]       						=  layer_norm_epsilon
								snake_case__						:       int       						=  initializer_range

								snake_case__						:       Optional[int]       						=  use_cache

								super().__init__(**snake_case_  )



