






'''simple docstring'''



from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Mapping, Optional

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


if TYPE_CHECKING:
      from ... import FeatureExtractionMixin, TensorType

SCREAMING_SNAKE_CASE						=	logging.get_logger(__name__)

SCREAMING_SNAKE_CASE						=	{
    'openai/imagegpt-small': '',
    'openai/imagegpt-medium': '',
    'openai/imagegpt-large': '',
}
class UpperCAmelCase_					(    __A				):




     """simple docstring"""




     UpperCamelCase_								=			'''imagegpt'''
     UpperCamelCase_								=			['''past_key_values''']
     UpperCamelCase_								=			{
         '''hidden_size''': '''n_embd''',
         '''max_position_embeddings''': '''n_positions''',
         '''num_attention_heads''': '''n_head''',
         '''num_hidden_layers''': '''n_layer''',
     }






     def __init__( self			:		List[str]     ,      UpperCAmelCase			:		Union[str, Any]=512 + 1     ,      UpperCAmelCase			:		str=32 * 32     ,      UpperCAmelCase			:		Union[str, Any]=512     ,      UpperCAmelCase			:		Optional[int]=24     ,      UpperCAmelCase			:		List[str]=8     ,      UpperCAmelCase			:		Dict=None     ,      UpperCAmelCase			:		Dict="quick_gelu"     ,      UpperCAmelCase			:		List[Any]=0.1     ,      UpperCAmelCase			:		Tuple=0.1     ,      UpperCAmelCase			:		Any=0.1     ,      UpperCAmelCase			:		Union[str, Any]=1e-5     ,      UpperCAmelCase			:		Tuple=0.0_2     ,      UpperCAmelCase			:		Optional[Any]=True     ,      UpperCAmelCase			:		Union[str, Any]=True     ,      UpperCAmelCase			:		int=False     ,      UpperCAmelCase			:		Any=False     ,      UpperCAmelCase			:		Any=False     ,      **UpperCAmelCase			:		int     ,      )  ->  Any:


      '''simple docstring'''

      lowercase					:   Optional[Any]				  =vocab_size
      lowercase					:   str				  =n_positions
      lowercase					:   Dict				  =n_embd
      lowercase					:   Optional[Any]				  =n_layer
      lowercase					:   Union[str, Any]				  =n_head
      lowercase					:   List[str]				  =n_inner
      lowercase					:   Dict				  =activation_function
      lowercase					:   List[Any]				  =resid_pdrop
      lowercase					:   Optional[Any]				  =embd_pdrop
      lowercase					:   Optional[Any]				  =attn_pdrop
      lowercase					:   Any				  =layer_norm_epsilon
      lowercase					:   List[str]				  =initializer_range
      lowercase					:   int				  =scale_attn_weights
      lowercase					:   Optional[int]				  =use_cache
      lowercase					:   Optional[Any]				  =scale_attn_by_inverse_layer_idx
      lowercase					:   List[str]				  =reorder_and_upcast_attn
      lowercase					:   Optional[int]				  =tie_word_embeddings

      super().__init__(tie_word_embeddings=UpperCAmelCase     ,      **UpperCAmelCase		)





class UpperCAmelCase_					(    __A				):




     """simple docstring"""




     @property
     def 				A__      ( self			:		Any		)  ->  Mapping[str, Mapping[int, str]]:


      '''simple docstring'''

      return OrderedDict(
          [
              ('''input_ids''', {0: '''batch''', 1: '''sequence'''}),
          ]		)






     def 				A__      ( self			:		Union[str, Any]     ,      UpperCAmelCase			:		"FeatureExtractionMixin"     ,      UpperCAmelCase			:		int = 1     ,      UpperCAmelCase			:		int = -1     ,      UpperCAmelCase			:		bool = False     ,      UpperCAmelCase			:		Optional["TensorType"] = None     ,      UpperCAmelCase			:		int = 3     ,      UpperCAmelCase			:		int = 32     ,      UpperCAmelCase			:		int = 32     ,      )  ->  Mapping[str, Any]:


      '''simple docstring'''

      lowercase					:   Union[str, Any]				  =self._generate_dummy_images(UpperCAmelCase     ,      UpperCAmelCase     ,      UpperCAmelCase     ,      UpperCAmelCase		)
      lowercase					:   List[Any]				  =dict(preprocessor(images=UpperCAmelCase     ,      return_tensors=UpperCAmelCase		)		)

      return inputs











'''simple docstring'''



from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


SCREAMING_SNAKE_CASE						=	{
    'configuration_mega': ['MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MegaConfig', 'MegaOnnxConfig'],
}

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      SCREAMING_SNAKE_CASE						=	[
          'MEGA_PRETRAINED_MODEL_ARCHIVE_LIST',
          'MegaForCausalLM',
          'MegaForMaskedLM',
          'MegaForMultipleChoice',
          'MegaForQuestionAnswering',
          'MegaForSequenceClassification',
          'MegaForTokenClassification',
          'MegaModel',
          'MegaPreTrainedModel',
      ]

if TYPE_CHECKING:
      from .configuration_mega import MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP, MegaConfig, MegaOnnxConfig

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_mega import (
                MEGA_PRETRAINED_MODEL_ARCHIVE_LIST,
                MegaForCausalLM,
                MegaForMaskedLM,
                MegaForMultipleChoice,
                MegaForQuestionAnswering,
                MegaForSequenceClassification,
                MegaForTokenClassification,
                MegaModel,
                MegaPreTrainedModel,
            )

else:
      import sys

      SCREAMING_SNAKE_CASE						=	_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)



