





'''simple docstring'''






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


A__							:  Union[str, Any]    ={
    '''configuration_poolformer''': [
        '''POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''PoolFormerConfig''',
        '''PoolFormerOnnxConfig''',
    ]
}

try:
      if not is_vision_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      A__							:  Any    =['''PoolFormerFeatureExtractor''']
      A__							:  Dict    =['''PoolFormerImageProcessor''']

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      A__							:  int    =[
          '''POOLFORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
          '''PoolFormerForImageClassification''',
          '''PoolFormerModel''',
          '''PoolFormerPreTrainedModel''',
      ]


if TYPE_CHECKING:
      from .configuration_poolformer import (
          POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
          PoolFormerConfig,
          PoolFormerOnnxConfig,
      )

      try:
            if not is_vision_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .feature_extraction_poolformer import PoolFormerFeatureExtractor
            from .image_processing_poolformer import PoolFormerImageProcessor

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_poolformer import (
                POOLFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
                PoolFormerForImageClassification,
                PoolFormerModel,
                PoolFormerPreTrainedModel,
            )


else:
      import sys

      A__							:  Optional[Any]    =_LazyModule(__name__, globals()['''__file__'''], _import_structure)













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

A__							:  Tuple    =logging.get_logger(__name__)

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




class 					UpperCAmelCase	(     snake_case_  ):
      _lowercase:     Tuple			=  '''imagegpt'''
      _lowercase:     Optional[int]			=  ['''past_key_values''']
      _lowercase:     str			=  {
          '''hidden_size''': '''n_embd''',
          '''max_position_embeddings''': '''n_positions''',
          '''num_attention_heads''': '''n_head''',
          '''num_hidden_layers''': '''n_layer''',
      }




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

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




class 					UpperCAmelCase	(     snake_case_  ):




      @property
      def 							lowercase__       (     self     :					Optional[Any]    )							-> Mapping[str, Mapping[int, str]]:
            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     ,     )							-> Mapping[str, Any]:
            _lowerCAmelCase					=				self._generate_dummy_images(__snake_case     ,     __snake_case     ,     __snake_case     ,     __snake_case    )
            _lowerCAmelCase					=				dict(preprocessor(images=__snake_case     ,     return_tensors=__snake_case    )    )

            return inputs






