




"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCamelCase_       			=   logging.get_logger(__name__)

lowerCamelCase_       			=   {
    '''studio-ousia/luke-base''': '''https://huggingface.co/studio-ousia/luke-base/resolve/main/config.json''',
    '''studio-ousia/luke-large''': '''https://huggingface.co/studio-ousia/luke-large/resolve/main/config.json''',
}







class     UpperCamelCase_ (__A  ):
	__magic_name__			   =       '''luke'''





	def __init__(   self      :				List[str]			,			lowerCAmelCase_      :				Tuple=50_267			,			lowerCAmelCase_      :				Dict=500_000			,			lowerCAmelCase_      :				int=768			,			lowerCAmelCase_      :				Optional[int]=256			,			lowerCAmelCase_      :				int=12			,			lowerCAmelCase_      :				Optional[Any]=12			,			lowerCAmelCase_      :				Optional[int]=3_072			,			lowerCAmelCase_      :				List[Any]="gelu"			,			lowerCAmelCase_      :				Optional[int]=0.1			,			lowerCAmelCase_      :				Tuple=0.1			,			lowerCAmelCase_      :				List[str]=512			,			lowerCAmelCase_      :				str=2			,			lowerCAmelCase_      :				List[Any]=0.0_2			,			lowerCAmelCase_      :				List[str]=1e-12			,			lowerCAmelCase_      :				Any=True			,			lowerCAmelCase_      :				Optional[Any]=None			,			lowerCAmelCase_      :				Tuple=1			,			lowerCAmelCase_      :				str=0			,			lowerCAmelCase_      :				Any=2			,			**lowerCAmelCase_      :				Dict			,			)		->    Optional[Any]:
				super().__init__(pad_token_id=lowerCAmelCase_			,			bos_token_id=lowerCAmelCase_			,			eos_token_id=lowerCAmelCase_			,			**lowerCAmelCase_		)

				UpperCAmelCase_  :				Tuple      =      vocab_size
				UpperCAmelCase_  :				str      =      entity_vocab_size
				UpperCAmelCase_  :				str      =      hidden_size
				UpperCAmelCase_  :				Any      =      entity_emb_size
				UpperCAmelCase_  :				Tuple      =      num_hidden_layers
				UpperCAmelCase_  :				Dict      =      num_attention_heads
				UpperCAmelCase_  :				Optional[Any]      =      hidden_act
				UpperCAmelCase_  :				Tuple      =      intermediate_size
				UpperCAmelCase_  :				Optional[int]      =      hidden_dropout_prob
				UpperCAmelCase_  :				Tuple      =      attention_probs_dropout_prob
				UpperCAmelCase_  :				Union[str, Any]      =      max_position_embeddings
				UpperCAmelCase_  :				Dict      =      type_vocab_size
				UpperCAmelCase_  :				str      =      initializer_range
				UpperCAmelCase_  :				Tuple      =      layer_norm_eps
				UpperCAmelCase_  :				Optional[Any]      =      use_entity_aware_attention
				UpperCAmelCase_  :				Optional[Any]      =      classifier_dropout











"""simple docstring"""
import json
import os
import tempfile

from transformers.testing_utils import check_json_file_has_correct_format







class     UpperCamelCase_ :
	__magic_name__			   =       None





	def   _SCREAMING_SNAKE_CASE   (   self      :				Any		)		->    List[Any]:
				UpperCAmelCase_  :				Tuple      =      self.feature_extraction_class(**self.feat_extract_dict		)
				UpperCAmelCase_  :				Union[str, Any]      =      json.loads(feat_extract.to_json_string()		)
				for key, value in self.feat_extract_dict.items():
							self.assertEqual(obj[key]			,			lowerCAmelCase_		)





	def   _SCREAMING_SNAKE_CASE   (   self      :				str		)		->    int:
				UpperCAmelCase_  :				Dict      =      self.feature_extraction_class(**self.feat_extract_dict		)

				with tempfile.TemporaryDirectory() as tmpdirname:
							UpperCAmelCase_  :				List[Any]      =      os.path.join(lowerCAmelCase_			,			"feat_extract.json"		)
							feat_extract_first.to_json_file(lowerCAmelCase_		)
							UpperCAmelCase_  :				Any      =      self.feature_extraction_class.from_json_file(lowerCAmelCase_		)

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





	def   _SCREAMING_SNAKE_CASE   (   self      :				int		)		->    Dict:
				UpperCAmelCase_  :				Optional[Any]      =      self.feature_extraction_class(**self.feat_extract_dict		)

				with tempfile.TemporaryDirectory() as tmpdirname:
							UpperCAmelCase_  :				Optional[Any]      =      feat_extract_first.save_pretrained(lowerCAmelCase_		)[0]
							check_json_file_has_correct_format(lowerCAmelCase_		)
							UpperCAmelCase_  :				Any      =      self.feature_extraction_class.from_pretrained(lowerCAmelCase_		)

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





	def   _SCREAMING_SNAKE_CASE   (   self      :				Any		)		->    Optional[Any]:
				UpperCAmelCase_  :				Optional[int]      =      self.feature_extraction_class()
				self.assertIsNotNone(lowerCAmelCase_		)



