






'''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__          =						logging.get_logger(__name__)

lowerCAmelCase__          =						{
    'openai/imagegpt-small': '',
    'openai/imagegpt-medium': '',
    'openai/imagegpt-large': '',
}







class       __lowercase					(__lowerCamelCase    ):
 _lowerCamelCase              =  '''imagegpt'''
 _lowerCamelCase              =  ['''past_key_values''']
 _lowerCamelCase              =  {
     '''hidden_size''': '''n_embd''',
     '''max_position_embeddings''': '''n_positions''',
     '''num_attention_heads''': '''n_head''',
     '''num_hidden_layers''': '''n_layer''',
 }

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

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







class       __lowercase					(__lowerCamelCase    ):

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





 def      __UpperCamelCase							(      self   :						List[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  ,					):
   UpperCamelCase__				:					str					=					self._generate_dummy_images(UpperCAmelCase_  ,					UpperCAmelCase_  ,					UpperCAmelCase_  ,					UpperCAmelCase_)
   UpperCamelCase__				:					List[str]					=					dict(preprocessor(images=UpperCAmelCase_  ,					return_tensors=UpperCAmelCase_))

   return inputs












'''simple docstring'''




from ..utils import DummyObject, requires_backends







class       __lowercase					(metaclass=__lowerCamelCase    ):
	_lowerCamelCase              =  ['''torch''', '''scipy''']

	def __init__(      self   :						List[Any]  ,					*UpperCAmelCase_   :						Any  ,					**UpperCAmelCase_   :						int):
			requires_backends(self  ,					['torch', 'scipy'])

	@classmethod
	def      __UpperCamelCase							(      cls   :						Union[str, Any]  ,					*UpperCAmelCase_   :						Any  ,					**UpperCAmelCase_   :						List[Any]):
			requires_backends(cls  ,					['torch', 'scipy'])





	@classmethod
	def      __UpperCamelCase							(      cls   :						Union[str, Any]  ,					*UpperCAmelCase_   :						Optional[Any]  ,					**UpperCAmelCase_   :						Any):
			requires_backends(cls  ,					['torch', 'scipy'])




