






"""simple docstring"""






# Lint as: python3
import dataclasses
import re
from dataclasses import dataclass
from functools import total_ordering
from typing import Optional, Union


UpperCAmelCase_   : List[str]   			= re.compile(r"""^(?P<major>\d+)""" r"""\.(?P<minor>\d+)""" r"""\.(?P<patch>\d+)$""")




@total_ordering
@dataclass
class 							lowerCAmelCase__				:






      '''simple docstring'''

      __UpperCamelCase	 =  42
      __UpperCamelCase	 =  None
      __UpperCamelCase	 =  None
      __UpperCamelCase	 =  None
      __UpperCamelCase	 =  None
      def _SCREAMING_SNAKE_CASE (						self     :  Optional[int]):




          '''simple docstring'''


          SCREAMING_SNAKE_CASE_						,			SCREAMING_SNAKE_CASE_						,			SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		_str_to_version_tuple(self.version_str)
      def __repr__(						self     :  Optional[Any]):




          '''simple docstring'''


          return F'{self.tuple[0]}.{self.tuple[1]}.{self.tuple[2]}'
      @property
      def _SCREAMING_SNAKE_CASE (						self     :  Tuple):




          '''simple docstring'''


          return self.major, self.minor, self.patch
      def _SCREAMING_SNAKE_CASE (						self     :  Tuple						,	lowercase_     :  List[Any]):




          '''simple docstring'''


          if isinstance(lowercase_						,	lowercase_):
              return Version(lowercase_)
          elif isinstance(lowercase_						,	lowercase_):
              return other
          raise TypeError(F'{other} (type {type(lowercase_)}) cannot be compared to version.')
      def __eq__(						self     :  str						,	lowercase_     :  Optional[Any]):




          '''simple docstring'''


          try:
              SCREAMING_SNAKE_CASE_      :  List[str]    						=		self._validate_operand(lowercase_)
          except (TypeError, ValueError):
              return False
          else:
              return self.tuple == other.tuple
      def __lt__(						self     :  Dict						,	lowercase_     :  List[Any]):




          '''simple docstring'''


          SCREAMING_SNAKE_CASE_      :  str    						=		self._validate_operand(lowercase_)
          return self.tuple < other.tuple
      def __hash__(						self     :  List[Any]):




          '''simple docstring'''


          return hash(_version_tuple_to_str(self.tuple))
      @classmethod
      def _SCREAMING_SNAKE_CASE (						cls     :  Tuple						,	lowercase_     :  List[str]):




          '''simple docstring'''


          SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		{f.name for f in dataclasses.fields(cls)}
          return cls(**{k: v for k, v in dic.items() if k in field_names})



      def _SCREAMING_SNAKE_CASE (						self     :  List[Any]):




          '''simple docstring'''


          return self.version_str



def 					_A			(__a							) ->       List[Any]:
    """simple docstring"""






    SCREAMING_SNAKE_CASE_      :  str    						=		_VERSION_REG.match(__a							)
    if not res:
        raise ValueError(f'Invalid version \'{version_str}\'. Format should be x.y.z with {{x,y,z}} being digits.'							)
    return tuple(int(__a							) for v in [res.group('''major'''							), res.group('''minor'''							), res.group('''patch'''							)]							)





def 					_A			(__a							) ->       List[str]:
    """simple docstring"""






    return ".".join(str(__a							) for v in version_tuple							)










"""simple docstring"""






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


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

UpperCAmelCase_   : Any   			= {"""openai-gpt""": """https://huggingface.co/openai-gpt/resolve/main/config.json"""}




class 							lowerCAmelCase__				(			UpperCAmelCase__ ):






      '''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     :  List[str]						,	lowercase_     :  List[str]=40478						,	lowercase_     :  List[str]=512						,	lowercase_     :  Optional[Any]=768						,	lowercase_     :  Tuple=12						,	lowercase_     :  Tuple=12						,	lowercase_     :  Union[str, Any]="gelu"						,	lowercase_     :  List[Any]=0.1						,	lowercase_     :  Tuple=0.1						,	lowercase_     :  List[Any]=0.1						,	lowercase_     :  List[Any]=1e-5						,	lowercase_     :  int=0.02						,	lowercase_     :  Optional[int]="cls_index"						,	lowercase_     :  Any=True						,	lowercase_     :  List[Any]=None						,	lowercase_     :  List[str]=True						,	lowercase_     :  Optional[Any]=0.1						,	**lowercase_     :  List[str]						,	):




          '''simple docstring'''


          SCREAMING_SNAKE_CASE_      :  Optional[int]    						=		vocab_size
          SCREAMING_SNAKE_CASE_      :  Tuple    						=		n_positions
          SCREAMING_SNAKE_CASE_      :  Optional[int]    						=		n_embd
          SCREAMING_SNAKE_CASE_      :  Dict    						=		n_layer
          SCREAMING_SNAKE_CASE_      :  Any    						=		n_head
          SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		afn
          SCREAMING_SNAKE_CASE_      :  int    						=		resid_pdrop
          SCREAMING_SNAKE_CASE_      :  List[str]    						=		embd_pdrop
          SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		attn_pdrop
          SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		layer_norm_epsilon
          SCREAMING_SNAKE_CASE_      :  List[Any]    						=		initializer_range
          SCREAMING_SNAKE_CASE_      :  List[str]    						=		summary_type
          SCREAMING_SNAKE_CASE_      :  Tuple    						=		summary_use_proj
          SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		summary_activation
          SCREAMING_SNAKE_CASE_      :  Any    						=		summary_first_dropout
          SCREAMING_SNAKE_CASE_      :  List[str]    						=		summary_proj_to_labels
          super().__init__(**lowercase_)


