


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:						List[str]   				=       logging.getLogger()




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





				def 						__UpperCamelCase    (				self       ,  lowercase_       ,  lowercase_ = None       ,  lowercase_ = None       ,  lowercase_ = None       ,  lowercase_ = True       ,  )  -> str:
											a__      =[file for file in os.listdir(lowercase_) if os.path.isfile(os.path.join(lowercase_       ,  lowercase_))]

											if identifier is not None:
																		a__      =[file for file in files if identifier in file]

											if n_identifier is not None:
																		if isinstance(lowercase_       ,  lowercase_):
																									for n_ in n_identifier:
																																a__      =[file for file in files if n_ not in file]
																		else:
																									a__      =[file for file in files if n_identifier not in file]

											a__      =ignore_files or []
											ignore_files.append('__init__.py')
											a__      =[file for file in files if file not in ignore_files]

											for file in files:
																		# Open all files
																		print('Testing'       ,  lowercase_)

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





				def 						__UpperCamelCase    (				self)  -> Union[str, Any]:
											a__      =Path('src/transformers')
											a__      ='modeling'
											a__      =[
											    'modeling_ctrl.py',
											    'modeling_tf_ctrl.py',
											]
											self.analyze_directory(lowercase_       ,  identifier=lowercase_       ,  ignore_files=lowercase_)





				def 						__UpperCamelCase    (				self)  -> Union[str, Any]:
											a__      =Path('src/transformers')
											a__      ='tokenization'
											self.analyze_directory(lowercase_       ,  identifier=lowercase_)





				def 						__UpperCamelCase    (				self)  -> int:
											a__      =Path('src/transformers')
											a__      ='configuration'
											self.analyze_directory(lowercase_       ,  identifier=lowercase_)





				def 						__UpperCamelCase    (				self)  -> Tuple:
											a__      =Path('src/transformers')
											a__      =['configuration', 'modeling', 'tokenization']
											self.analyze_directory(lowercase_       ,  n_identifier=lowercase_)





				def 						__UpperCamelCase    (				self)  -> Union[str, Any]:
											a__      =Path('docs/source')
											a__      =['favicon.ico']
											self.analyze_directory(lowercase_       ,  ignore_files=lowercase_       ,  only_modules=lowercase_)



"""simple docstring"""



from ...configuration_utils import PretrainedConfig





class 				a			(					lowercase      ):
      UpperCamelCase							:   Union[str, Any]           =     """bert-generation"""



      def __init__(   self     ,	UpperCamelCase_=50_358     ,	UpperCamelCase_=1_024     ,	UpperCamelCase_=24     ,	UpperCamelCase_=16     ,	UpperCamelCase_=4_096     ,	UpperCamelCase_="gelu"     ,	UpperCamelCase_=0.1     ,	UpperCamelCase_=0.1     ,	UpperCamelCase_=512     ,	UpperCamelCase_=0.02     ,	UpperCamelCase_=1E-12     ,	UpperCamelCase_=0     ,	UpperCamelCase_=2     ,	UpperCamelCase_=1     ,	UpperCamelCase_="absolute"     ,	UpperCamelCase_=True     ,	**UpperCamelCase_     ,	):
          super().__init__(pad_token_id=UpperCamelCase_     ,	bos_token_id=UpperCamelCase_     ,	eos_token_id=UpperCamelCase_     ,	**UpperCamelCase_      )

          UpperCAmelCase__	:      Optional[Any]     							=					vocab_size
          UpperCAmelCase__	:      Union[str, Any]     							=					hidden_size
          UpperCAmelCase__	:      Optional[Any]     							=					num_hidden_layers
          UpperCAmelCase__	:      Dict     							=					num_attention_heads
          UpperCAmelCase__	:      Dict     							=					hidden_act
          UpperCAmelCase__	:      Optional[Any]     							=					intermediate_size
          UpperCAmelCase__	:      Optional[int]     							=					hidden_dropout_prob
          UpperCAmelCase__	:      Tuple     							=					attention_probs_dropout_prob
          UpperCAmelCase__	:      List[Any]     							=					max_position_embeddings
          UpperCAmelCase__	:      Optional[int]     							=					initializer_range
          UpperCAmelCase__	:      Optional[int]     							=					layer_norm_eps
          UpperCAmelCase__	:      Union[str, Any]     							=					position_embedding_type
          UpperCAmelCase__	:      Dict     							=					use_cache

