
import doctest
import logging
import os
import unittest
from pathlib import Path
from typing import List, Union

import transformers
from transformers.testing_utils import require_tf, require_torch, slow


lowerCamelCase_  :	Optional[Any] 				=					logging.getLogger()

@unittest.skip("""Temporarily disable the doc tests."""					)
@require_torch
@require_tf
@slow
class     _UpperCamelCase			(   unittest.TestCase					):






			'''simple docstring'''

			def  lowerCAmelCase__		(    self	:    List[Any]  ,		snake_case_	:    Path  ,		snake_case_	:    Union[str, None] = None  ,		snake_case_	:    Union[List[str], None] = None  ,		snake_case_	:    Union[str, List[str], None] = None  ,		snake_case_	:    bool = True  ,		):
							UpperCamelCase_:							List[Any]		=  [file for file in os.listdir(UpperCamelCase__ ) if os.path.isfile(os.path.join(UpperCamelCase__  ,		UpperCamelCase__ ) )]

							if identifier is not None:
											UpperCamelCase_:							List[Any]		=  [file for file in files if identifier in file]

							if n_identifier is not None:
											if isinstance(UpperCamelCase__  ,		UpperCamelCase__ ):
															for n_ in n_identifier:
																			UpperCamelCase_:							Any		=  [file for file in files if n_ not in file]
											else:
															UpperCamelCase_:							List[Any]		=  [file for file in files if n_identifier not in file]

							UpperCamelCase_:							Tuple		=  ignore_files or []
							ignore_files.append("""__init__.py""" )
							UpperCamelCase_:							Tuple		=  [file for file in files if file not in ignore_files]

							for file in files:
											# Open all files
											print("""Testing"""  ,		UpperCamelCase__ )

											if only_modules:
															UpperCamelCase_:							Optional[Any]		=  file.split(""".""" )[0]
															try:
																			UpperCamelCase_:							Optional[Any]		=  getattr(UpperCamelCase__  ,		UpperCamelCase__ )
																			UpperCamelCase_:							List[Any]		=  doctest.DocTestSuite(UpperCamelCase__ )
																			UpperCamelCase_:							List[str]		=  unittest.TextTestRunner().run(UpperCamelCase__ )
																			self.assertIs(len(result.failures )  ,		0 )
															except AttributeError:
																			logger.info(f'''{module_identifier} is not a module.''' )
											else:
															UpperCamelCase_:							str		=  doctest.testfile(str("""..""" / directory / file )  ,		optionflags=doctest.ELLIPSIS )
															self.assertIs(result.failed  ,		0 )

			def  lowerCAmelCase__		(    self	:    str ):
							UpperCamelCase_:							List[Any]		=  Path("""src/transformers""" )
							UpperCamelCase_:							List[str]		=  "modeling"
							UpperCamelCase_:							List[Any]		=  [
							    "modeling_ctrl.py",
							    "modeling_tf_ctrl.py",
							]
							self.analyze_directory(UpperCamelCase__  ,		identifier=UpperCamelCase__  ,		ignore_files=UpperCamelCase__ )

			def  lowerCAmelCase__		(    self	:    Optional[Any] ):
							UpperCamelCase_:							Union[str, Any]		=  Path("""src/transformers""" )
							UpperCamelCase_:							Dict		=  "tokenization"
							self.analyze_directory(UpperCamelCase__  ,		identifier=UpperCamelCase__ )

			def  lowerCAmelCase__		(    self	:    Any ):
							UpperCamelCase_:							Optional[Any]		=  Path("""src/transformers""" )
							UpperCamelCase_:							Any		=  "configuration"
							self.analyze_directory(UpperCamelCase__  ,		identifier=UpperCamelCase__ )

			def  lowerCAmelCase__		(    self	:    Optional[Any] ):
							UpperCamelCase_:							Tuple		=  Path("""src/transformers""" )
							UpperCamelCase_:							Tuple		=  ["configuration", "modeling", "tokenization"]
							self.analyze_directory(UpperCamelCase__  ,		n_identifier=UpperCamelCase__ )




			def  lowerCAmelCase__		(    self	:    Optional[int] ):
							UpperCamelCase_:							str		=  Path("""docs/source""" )
							UpperCamelCase_:							Any		=  ["favicon.ico"]
							self.analyze_directory(UpperCamelCase__  ,		ignore_files=UpperCamelCase__  ,		only_modules=UpperCamelCase__ )








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


lowerCamelCase_  :	Optional[int] 				=					logging.get_logger(__name__)

lowerCamelCase_  :	Dict 				=					{
    """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					):






			'''simple docstring'''

			__UpperCamelCase :  Optional[int]    =	"""luke"""

			def __init__(    self	:    Tuple  ,		snake_case_	:    List[Any]=5_0267  ,		snake_case_	:    Any=50_0000  ,		snake_case_	:    str=768  ,		snake_case_	:    int=256  ,		snake_case_	:    str=12  ,		snake_case_	:    int=12  ,		snake_case_	:    Dict=3072  ,		snake_case_	:    Optional[Any]="gelu"  ,		snake_case_	:    Dict=0.1  ,		snake_case_	:    List[str]=0.1  ,		snake_case_	:    int=512  ,		snake_case_	:    Dict=2  ,		snake_case_	:    List[Any]=0.02  ,		snake_case_	:    int=1e-12  ,		snake_case_	:    Union[str, Any]=True  ,		snake_case_	:    Union[str, Any]=None  ,		snake_case_	:    Dict=1  ,		snake_case_	:    Optional[int]=0  ,		snake_case_	:    List[str]=2  ,		**snake_case_	:    Union[str, Any]  ,		):
							super().__init__(pad_token_id=snake_case_  ,		bos_token_id=snake_case_  ,		eos_token_id=snake_case_  ,		**snake_case_ )

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






