





'''simple docstring'''






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


A_		:  Union[str, Any]		 =						logging.getLogger()
@unittest.skip('''Temporarily disable the doc tests.'''							)
@require_torch
@require_tf
@slow
class 					__snake_case  (					unittest.TestCase							):






   '''simple docstring'''





   def 		__UpperCamelCase						(							self	,		__SCREAMING_SNAKE_CASE	,		__SCREAMING_SNAKE_CASE = None	,		__SCREAMING_SNAKE_CASE = None	,		__SCREAMING_SNAKE_CASE = None	,		__SCREAMING_SNAKE_CASE = True	,		):
    snake_case__     :					str    =  [file for file in os.listdir(__SCREAMING_SNAKE_CASE       ) if os.path.isfile(os.path.join(__SCREAMING_SNAKE_CASE	,		__SCREAMING_SNAKE_CASE       )       )]

    if identifier is not None:
     snake_case__     :					Optional[Any]    =  [file for file in files if identifier in file]

    if n_identifier is not None:
     if isinstance(__SCREAMING_SNAKE_CASE	,		__SCREAMING_SNAKE_CASE       ):
      for n_ in n_identifier:
       snake_case__     :					Any    =  [file for file in files if n_ not in file]
     else:
      snake_case__     :					int    =  [file for file in files if n_identifier not in file]

    snake_case__     :					Dict    =  ignore_files or []
    ignore_files.append("""__init__.py"""       )
    snake_case__     :					str    =  [file for file in files if file not in ignore_files]

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

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

   def 		__UpperCamelCase						(							self       ):
    snake_case__     :					Any    =  Path("""src/transformers"""       )
    snake_case__     :					Any    =  """modeling"""
    snake_case__     :					Optional[int]    =  [
        """modeling_ctrl.py""",
        """modeling_tf_ctrl.py""",
    ]
    self.analyze_directory(__SCREAMING_SNAKE_CASE	,		identifier=__SCREAMING_SNAKE_CASE	,		ignore_files=__SCREAMING_SNAKE_CASE       )

   def 		__UpperCamelCase						(							self       ):
    snake_case__     :					Optional[int]    =  Path("""src/transformers"""       )
    snake_case__     :					Optional[Any]    =  """tokenization"""
    self.analyze_directory(__SCREAMING_SNAKE_CASE	,		identifier=__SCREAMING_SNAKE_CASE       )

   def 		__UpperCamelCase						(							self       ):
    snake_case__     :					Dict    =  Path("""src/transformers"""       )
    snake_case__     :					Dict    =  """configuration"""
    self.analyze_directory(__SCREAMING_SNAKE_CASE	,		identifier=__SCREAMING_SNAKE_CASE       )

   def 		__UpperCamelCase						(							self       ):
    snake_case__     :					str    =  Path("""src/transformers"""       )
    snake_case__     :					Optional[int]    =  ["""configuration""", """modeling""", """tokenization"""]
    self.analyze_directory(__SCREAMING_SNAKE_CASE	,		n_identifier=__SCREAMING_SNAKE_CASE       )


   def 		__UpperCamelCase						(							self       ):
    snake_case__     :					Optional[Any]    =  Path("""docs/source"""       )
    snake_case__     :					Dict    =  ["""favicon.ico"""]
    self.analyze_directory(__SCREAMING_SNAKE_CASE	,		ignore_files=__SCREAMING_SNAKE_CASE	,		only_modules=__SCREAMING_SNAKE_CASE       )










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


_SCREAMING_SNAKE_CASE			=						logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE			=						{"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/config.json"}
class   __UpperCAmelCase				(     lowerCAmelCase				):



					'''simple docstring'''





					_UpperCamelCase							=		"""openai-gpt"""
					_UpperCamelCase							=		{
					    """max_position_embeddings""": """n_positions""",
					    """hidden_size""": """n_embd""",
					    """num_attention_heads""": """n_head""",
					    """num_hidden_layers""": """n_layer""",
					}



					def __init__(	self     :						Any      ,       _lowercase     :						List[Any]=40_478      ,       _lowercase     :						Tuple=512      ,       _lowercase     :						Dict=768      ,       _lowercase     :						List[str]=12      ,       _lowercase     :						Optional[int]=12      ,       _lowercase     :						Tuple="gelu"      ,       _lowercase     :						int=0.1      ,       _lowercase     :						Tuple=0.1      ,       _lowercase     :						Any=0.1      ,       _lowercase     :						List[str]=1E-5      ,       _lowercase     :						str=0.02      ,       _lowercase     :						Optional[Any]="cls_index"      ,       _lowercase     :						int=True      ,       _lowercase     :						str=None      ,       _lowercase     :						Tuple=True      ,       _lowercase     :						List[Any]=0.1      ,       **_lowercase     :						int      ,       )    ->							Optional[int]:
								A_									= vocab_size
								A_									= n_positions
								A_									= n_embd
								A_									= n_layer
								A_									= n_head
								A_									= afn
								A_									= resid_pdrop
								A_									= embd_pdrop
								A_									= attn_pdrop
								A_									= layer_norm_epsilon
								A_									= initializer_range
								A_									= summary_type
								A_									= summary_use_proj
								A_									= summary_activation
								A_									= summary_first_dropout
								A_									= summary_proj_to_labels
								super().__init__(**_lowercase)




