



'''simple docstring'''






from ..utils import DummyObject, requires_backends

class 							a__(      metaclass=lowerCamelCase__			):
    lowercase__				=					["""keras_nlp"""]







    def __init__(   self				:						List[str]		,    *__snake_case				:						Optional[int]		,    **__snake_case				:						Any			):
      requires_backends(self		,    ['keras_nlp']			)




'''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

lowerCAmelCase:      List[Any]		 =		logging.get_logger(__name__)

lowerCAmelCase:      List[str]		 =		{
    'openai/imagegpt-small': '',
    'openai/imagegpt-medium': '',
    'openai/imagegpt-large': '',
}

class 							a__(      lowerCamelCase__			):
    lowercase__				=					"""imagegpt"""
    lowercase__				=					["""past_key_values"""]
    lowercase__				=					{
        """hidden_size""": """n_embd""",
        """max_position_embeddings""": """n_positions""",
        """num_attention_heads""": """n_head""",
        """num_hidden_layers""": """n_layer""",
    }







    def __init__(   self				:						List[str]		,    __snake_case				:						int=5_12 + 1		,    __snake_case				:						Optional[Any]=32 * 32		,    __snake_case				:						Optional[Any]=5_12		,    __snake_case				:						List[str]=24		,    __snake_case				:						Tuple=8		,    __snake_case				:						Optional[int]=None		,    __snake_case				:						Dict="quick_gelu"		,    __snake_case				:						Dict=0.1		,    __snake_case				:						List[str]=0.1		,    __snake_case				:						Optional[Any]=0.1		,    __snake_case				:						Tuple=1e-5		,    __snake_case				:						Union[str, Any]=0.02		,    __snake_case				:						Optional[int]=True		,    __snake_case				:						Dict=True		,    __snake_case				:						str=False		,    __snake_case				:						Any=False		,    __snake_case				:						List[Any]=False		,    **__snake_case				:						List[str]		,    ):
      a		:      Optional[Any]       =  vocab_size
      a		:      Union[str, Any]       =  n_positions
      a		:      int       =  n_embd
      a		:      int       =  n_layer
      a		:      str       =  n_head
      a		:      int       =  n_inner
      a		:      int       =  activation_function
      a		:      Any       =  resid_pdrop
      a		:      Tuple       =  embd_pdrop
      a		:      List[Any]       =  attn_pdrop
      a		:      Tuple       =  layer_norm_epsilon
      a		:      Any       =  initializer_range
      a		:      str       =  scale_attn_weights
      a		:      List[Any]       =  use_cache
      a		:      Any       =  scale_attn_by_inverse_layer_idx
      a		:      Optional[Any]       =  reorder_and_upcast_attn
      a		:      str       =  tie_word_embeddings

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

class 							a__(      lowerCamelCase__			):







    @property
    def     lowercase_ (   self				:						Union[str, Any]			):
      return OrderedDict(
          [
              ('input_ids', {0: 'batch', 1: 'sequence'}),
          ]			)







    def     lowercase_ (   self				:						Union[str, Any]		,    __snake_case				:						"FeatureExtractionMixin"		,    __snake_case				:						int = 1		,    __snake_case				:						int = -1		,    __snake_case				:						bool = False		,    __snake_case				:						Optional["TensorType"] = None		,    __snake_case				:						int = 3		,    __snake_case				:						int = 32		,    __snake_case				:						int = 32		,    ):
      a		:      Dict       =  self._generate_dummy_images(__snake_case		,    __snake_case		,    __snake_case		,    __snake_case			)
      a		:      Union[str, Any]       =  dict(preprocessor(images=__snake_case		,    return_tensors=__snake_case			)			)

      return inputs