






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

UpperCAmelCase__							  =						logging.get_logger(__name__)

UpperCAmelCase__							  =						{
    "openai/imagegpt-small": "",
    "openai/imagegpt-medium": "",
    "openai/imagegpt-large": "",
}






class 						lowercase_   (      lowercase  ):






      '''simple docstring'''




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







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




       """simple docstring"""


       a						    = vocab_size
       a						    = n_positions
       a						    = n_embd
       a						    = n_layer
       a						    = n_head
       a						    = n_inner
       a						    = activation_function
       a						    = resid_pdrop
       a						    = embd_pdrop
       a						    = attn_pdrop
       a						    = layer_norm_epsilon
       a						    = initializer_range
       a						    = scale_attn_weights
       a						    = use_cache
       a						    = scale_attn_by_inverse_layer_idx
       a						    = reorder_and_upcast_attn
       a						    = tie_word_embeddings

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






class 						lowercase_   (      lowercase  ):






      '''simple docstring'''




      @property
      def  __lowerCAmelCase   ( self :		Dict    )       ->Mapping[str, Mapping[int, str]]:




       """simple docstring"""


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







      def  __lowerCAmelCase   ( self :		Dict					,   __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"""


       a						    = self._generate_dummy_images(__UpperCAmelCase					,   __UpperCAmelCase					,   __UpperCAmelCase					,   __UpperCAmelCase    )
       a						    = dict(preprocessor(images=__UpperCAmelCase					,   return_tensors=__UpperCAmelCase    )    )

       return inputs










from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_tokenizers_available,
    is_torch_available,
    is_vision_available,
)


UpperCAmelCase__							  =						{"processing_layoutxlm": ["LayoutXLMProcessor"]}

try:
     if not is_sentencepiece_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     UpperCAmelCase__							  =						["LayoutXLMTokenizer"]

try:
     if not is_tokenizers_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     UpperCAmelCase__							  =						["LayoutXLMTokenizerFast"]

if TYPE_CHECKING:
     from .processing_layoutxlm import LayoutXLMProcessor

     try:
          if not is_sentencepiece_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .tokenization_layoutxlm import LayoutXLMTokenizer

     try:
          if not is_tokenizers_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .tokenization_layoutxlm_fast import LayoutXLMTokenizerFast

else:
     import sys

     UpperCAmelCase__							  =						_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)


