
"""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        =				logging.get_logger(__name__)

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



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





				"""simple docstring"""


				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=SCREAMING_SNAKE_CASE_      ,**SCREAMING_SNAKE_CASE_			)





class 			lowercase					( lowercase__		):






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





				"""simple docstring"""


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






			def 					UpperCAmelCase							(self  :	Optional[Any]      ,SCREAMING_SNAKE_CASE_  :	"FeatureExtractionMixin"      ,SCREAMING_SNAKE_CASE_  :	int = 1      ,SCREAMING_SNAKE_CASE_  :	int = -1      ,SCREAMING_SNAKE_CASE_  :	bool = False      ,SCREAMING_SNAKE_CASE_  :	Optional["TensorType"] = None      ,SCREAMING_SNAKE_CASE_  :	int = 3      ,SCREAMING_SNAKE_CASE_  :	int = 32      ,SCREAMING_SNAKE_CASE_  :	int = 32      ,)       ->	Mapping[str, Any]:





				"""simple docstring"""


				lowerCAmelCase												=  self._generate_dummy_images(SCREAMING_SNAKE_CASE_      ,SCREAMING_SNAKE_CASE_      ,SCREAMING_SNAKE_CASE_      ,SCREAMING_SNAKE_CASE_			)
				lowerCAmelCase												=  dict(preprocessor(images=SCREAMING_SNAKE_CASE_      ,return_tensors=SCREAMING_SNAKE_CASE_			)			)

				return inputs




"""simple docstring"""






def __magic_name__	(				_lowerCamelCase:		Tuple,					_lowerCamelCase:		Any			)					->						Optional[Any]:

	'''simple docstring'''




	lowerCAmelCase												=  [1]
	for i in range(2,					_lowerCamelCase			):
		factorials.append(factorials[-1] * i			)
	assert 0 <= k < factorials[-1] * n, "k out of bounds"

	lowerCAmelCase												=  []
	lowerCAmelCase												=  list(range(_lowerCamelCase			)			)

	# Find permutation
	while factorials:
		lowerCAmelCase												=  factorials.pop()
		lowerCAmelCase							,       lowerCAmelCase												=  divmod(_lowerCamelCase,					_lowerCamelCase			)
		permutation.append(elements[number]			)
		elements.remove(elements[number]			)
	permutation.append(elements[0]			)

	return permutation


if __name__ == "__main__":
					import doctest

					doctest.testmod()


