

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

_UpperCAmelCase  :		str  =		logging.get_logger(__name__)

_UpperCAmelCase  :		Optional[int]  =		{
    '''openai/imagegpt-small''': '''''',
    '''openai/imagegpt-medium''': '''''',
    '''openai/imagegpt-large''': '''''',
}

class 						__magic_name__   (							__SCREAMING_SNAKE_CASE ):
 UpperCamelCase__     =       'imagegpt'
 UpperCamelCase__     =       ['past_key_values']
 UpperCamelCase__     =       {
     'hidden_size': 'n_embd',
     'max_position_embeddings': 'n_positions',
     'num_attention_heads': 'n_head',
     'num_hidden_layers': 'n_layer',
 }







 def __init__(       self  , snake_case_=5_12 + 1  , snake_case_=32 * 32  , snake_case_=5_12  , snake_case_=24  , snake_case_=8  , snake_case_=None  , snake_case_="quick_gelu"  , snake_case_=0.1  , snake_case_=0.1  , snake_case_=0.1  , snake_case_=1E-5  , snake_case_=0.02  , snake_case_=True  , snake_case_=True  , snake_case_=False  , snake_case_=False  , snake_case_=False  , **snake_case_  , ):
   lowercase									=vocab_size
   lowercase									=n_positions
   lowercase									=n_embd
   lowercase									=n_layer
   lowercase									=n_head
   lowercase									=n_inner
   lowercase									=activation_function
   lowercase									=resid_pdrop
   lowercase									=embd_pdrop
   lowercase									=attn_pdrop
   lowercase									=layer_norm_epsilon
   lowercase									=initializer_range
   lowercase									=scale_attn_weights
   lowercase									=use_cache
   lowercase									=scale_attn_by_inverse_layer_idx
   lowercase									=reorder_and_upcast_attn
   lowercase									=tie_word_embeddings

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

class 						__magic_name__   (							__SCREAMING_SNAKE_CASE ):







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







 def 						_A(       self  , snake_case_  , snake_case_ = 1  , snake_case_ = -1  , snake_case_ = False  , snake_case_ = None  , snake_case_ = 3  , snake_case_ = 32  , snake_case_ = 32  , ):
   lowercase									=self._generate_dummy_images(snake_case_  , snake_case_  , snake_case_  , snake_case_   )
   lowercase									=dict(preprocessor(images=snake_case_  , return_tensors=snake_case_   )   )

   return inputs


"""simple docstring"""



from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


UpperCamelCase__          =	{
    'configuration_mega': ['MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MegaConfig', 'MegaOnnxConfig'],
}

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    UpperCamelCase__          =	[
        'MEGA_PRETRAINED_MODEL_ARCHIVE_LIST',
        'MegaForCausalLM',
        'MegaForMaskedLM',
        'MegaForMultipleChoice',
        'MegaForQuestionAnswering',
        'MegaForSequenceClassification',
        'MegaForTokenClassification',
        'MegaModel',
        'MegaPreTrainedModel',
    ]

if TYPE_CHECKING:
    from .configuration_mega import MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP, MegaConfig, MegaOnnxConfig

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_mega import (
            MEGA_PRETRAINED_MODEL_ARCHIVE_LIST,
            MegaForCausalLM,
            MegaForMaskedLM,
            MegaForMultipleChoice,
            MegaForQuestionAnswering,
            MegaForSequenceClassification,
            MegaForTokenClassification,
            MegaModel,
            MegaPreTrainedModel,
        )

else:
    import sys

    UpperCamelCase__          =	_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)

