



'''simple docstring'''






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


lowerCAmelCase:      Tuple		 =		logging.get_logger(__name__)

lowerCAmelCase:      Union[str, Any]		 =		{
    'microsoft/cvt-13': 'https://huggingface.co/microsoft/cvt-13/resolve/main/config.json',
    # See all Cvt models at https://huggingface.co/models?filter=cvt
}

class 							a__(   _A			):
    lowercase__				=					"""cvt"""







    def __init__(   self				:						Dict		,    __snake_case				:						Optional[int]=3		,    __snake_case				:						List[Any]=[7, 3, 3]		,    __snake_case				:						Any=[4, 2, 2]		,    __snake_case				:						Optional[Any]=[2, 1, 1]		,    __snake_case				:						Union[str, Any]=[64, 1_92, 3_84]		,    __snake_case				:						Dict=[1, 3, 6]		,    __snake_case				:						Any=[1, 2, 10]		,    __snake_case				:						List[str]=[4.0, 4.0, 4.0]		,    __snake_case				:						Dict=[0.0, 0.0, 0.0]		,    __snake_case				:						Tuple=[0.0, 0.0, 0.0]		,    __snake_case				:						Optional[Any]=[0.0, 0.0, 0.1]		,    __snake_case				:						str=[True, True, True]		,    __snake_case				:						Optional[Any]=[False, False, True]		,    __snake_case				:						Union[str, Any]=["dw_bn", "dw_bn", "dw_bn"]		,    __snake_case				:						List[Any]=[3, 3, 3]		,    __snake_case				:						Any=[1, 1, 1]		,    __snake_case				:						Optional[int]=[2, 2, 2]		,    __snake_case				:						Any=[1, 1, 1]		,    __snake_case				:						List[str]=[1, 1, 1]		,    __snake_case				:						int=0.02		,    __snake_case				:						int=1e-1_2		,    **__snake_case				:						int		,    ):
      super().__init__(**UpperCamelCase__			)
      a		:      Union[str, Any]       =  num_channels
      a		:      Tuple       =  patch_sizes
      a		:      List[Any]       =  patch_stride
      a		:      Tuple       =  patch_padding
      a		:      List[str]       =  embed_dim
      a		:      Any       =  num_heads
      a		:      Any       =  depth
      a		:      Optional[Any]       =  mlp_ratio
      a		:      Union[str, Any]       =  attention_drop_rate
      a		:      int       =  drop_rate
      a		:      Optional[Any]       =  drop_path_rate
      a		:      int       =  qkv_bias
      a		:      Optional[int]       =  cls_token
      a		:      str       =  qkv_projection_method
      a		:      List[str]       =  kernel_qkv
      a		:      List[Any]       =  padding_kv
      a		:      Union[str, Any]       =  stride_kv
      a		:      Union[str, Any]       =  padding_q
      a		:      int       =  stride_q
      a		:      int       =  initializer_range
      a		:      Optional[int]       =  layer_norm_eps




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