



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

lowercase_						=       logging.get_logger(__name__)

lowercase_						=       {
    """openai/imagegpt-small""": """""",
    """openai/imagegpt-medium""": """""",
    """openai/imagegpt-large""": """""",
}
class 			_snake_case     (   lowercase__):
				UpperCamelCase__			:   List[Any]       						="""imagegpt"""
				UpperCamelCase__			:   List[str]       						=["""past_key_values"""]
				UpperCamelCase__			:   str       						={
				    """hidden_size""": """n_embd""",
				    """max_position_embeddings""": """n_positions""",
				    """num_attention_heads""": """n_head""",
				    """num_hidden_layers""": """n_layer""",
				}




				def __init__(  self   :  Union[str, Any],   __lowercase   :  List[str]=512 + 1,   __lowercase   :  Optional[Any]=32 * 32,   __lowercase   :  str=512,   __lowercase   :  List[str]=24,   __lowercase   :  int=8,   __lowercase   :  List[Any]=None,   __lowercase   :  int="quick_gelu",   __lowercase   :  Dict=0.1,   __lowercase   :  Dict=0.1,   __lowercase   :  Optional[Any]=0.1,   __lowercase   :  Union[str, Any]=1e-5,   __lowercase   :  Any=0.02,   __lowercase   :  Union[str, Any]=True,   __lowercase   :  Dict=True,   __lowercase   :  int=False,   __lowercase   :  int=False,   __lowercase   :  Any=False,   **__lowercase   :  Tuple,   ):
							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=__lowercase,   **__lowercase  )
class 			_snake_case     (   lowercase__):




				@property
				def 							A__ (  self   :  Union[str, Any]  ):
							return OrderedDict(
							    [
							        ("input_ids", {0: "batch", 1: "sequence"}),
							    ]  )




				def 							A__ (  self   :  Tuple,   __lowercase   :  "FeatureExtractionMixin",   __lowercase   :  int = 1,   __lowercase   :  int = -1,   __lowercase   :  bool = False,   __lowercase   :  Optional["TensorType"] = None,   __lowercase   :  int = 3,   __lowercase   :  int = 32,   __lowercase   :  int = 32,   ):
							lowercase__   					=			self._generate_dummy_images(__lowercase,   __lowercase,   __lowercase,   __lowercase  )
							lowercase__   					=			dict(preprocessor(images=__lowercase,   return_tensors=__lowercase  )  )

							return inputs









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


lowercase_						=       logging.get_logger(__name__)

lowercase_						=       {
    """transfo-xl-wt103""": """https://huggingface.co/transfo-xl-wt103/resolve/main/config.json""",
}
class 			_snake_case     (   lowercase__):
				UpperCamelCase__			:   Optional[Any]       						="""transfo-xl"""
				UpperCamelCase__			:   Dict       						=["""mems"""]
				UpperCamelCase__			:   Optional[int]       						={
				    """n_token""": """vocab_size""",
				    """hidden_size""": """d_model""",
				    """num_attention_heads""": """n_head""",
				    """num_hidden_layers""": """n_layer""",
				}




				def __init__(  self   :  Optional[Any],   __lowercase   :  Optional[Any]=26_7735,   __lowercase   :  int=[2_0000, 4_0000, 20_0000],   __lowercase   :  Union[str, Any]=1024,   __lowercase   :  Tuple=1024,   __lowercase   :  Tuple=16,   __lowercase   :  Optional[Any]=64,   __lowercase   :  str=4096,   __lowercase   :  Optional[int]=4,   __lowercase   :  Union[str, Any]=False,   __lowercase   :  Union[str, Any]=18,   __lowercase   :  List[str]=1600,   __lowercase   :  List[Any]=1000,   __lowercase   :  Union[str, Any]=True,   __lowercase   :  Tuple=True,   __lowercase   :  Optional[Any]=0,   __lowercase   :  List[str]=-1,   __lowercase   :  int=True,   __lowercase   :  Dict=0.1,   __lowercase   :  Union[str, Any]=0.0,   __lowercase   :  str=True,   __lowercase   :  Optional[Any]="normal",   __lowercase   :  str=0.01,   __lowercase   :  Tuple=0.01,   __lowercase   :  List[Any]=0.02,   __lowercase   :  Any=1e-5,   __lowercase   :  Union[str, Any]=0,   **__lowercase   :  Union[str, Any],   ):
							lowercase__   					=			vocab_size
							lowercase__   					=			[]
							self.cutoffs.extend(__lowercase  )
							if proj_share_all_but_first:
										lowercase__   					=			[False] + [True] * len(self.cutoffs  )
							else:
										lowercase__   					=			[False] + [False] * len(self.cutoffs  )
							lowercase__   					=			d_model
							lowercase__   					=			d_embed
							lowercase__   					=			d_head
							lowercase__   					=			d_inner
							lowercase__   					=			div_val
							lowercase__   					=			pre_lnorm
							lowercase__   					=			n_layer
							lowercase__   					=			n_head
							lowercase__   					=			mem_len
							lowercase__   					=			same_length
							lowercase__   					=			attn_type
							lowercase__   					=			clamp_len
							lowercase__   					=			sample_softmax
							lowercase__   					=			adaptive
							lowercase__   					=			dropout
							lowercase__   					=			dropatt
							lowercase__   					=			untie_r
							lowercase__   					=			init
							lowercase__   					=			init_range
							lowercase__   					=			proj_init_std
							lowercase__   					=			init_std
							lowercase__   					=			layer_norm_epsilon
							super().__init__(eos_token_id=__lowercase,   **__lowercase  )




				@property
				def 							A__ (  self   :  Optional[Any]  ):
							# Message copied from Transformer-XL documentation
							logger.info(F'''The model {self.model_type} is one of the few models that has no sequence length limit.'''  )
							return -1




				@max_position_embeddings.setter
				def 							A__ (  self   :  List[str],   __lowercase   :  Union[str, Any]  ):
							# Message copied from Transformer-XL documentation
							raise NotImplementedError(
							    F'''The model {self.model_type} is one of the few models that has no sequence length limit.'''  )




