


'''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_						:  Optional[int]				  =						logging.get_logger(__name__)

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





class        lowercase__    (		_snake_case   ):





							'''simple docstring'''


							A_				: int       =    """imagegpt"""
							A_				: int       =    ["""past_key_values"""]
							A_				: Optional[int]       =    {
							    """hidden_size""": """n_embd""",
							    """max_position_embeddings""": """n_positions""",
							    """num_attention_heads""": """n_head""",
							    """num_hidden_layers""": """n_layer""",
							}






							def __init__(       self       ,   __snake_case=512 + 1       ,   __snake_case=32 * 32       ,   __snake_case=512       ,   __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       ,   ):
											_SCREAMING_SNAKE_CASE					:			Dict							= vocab_size
											_SCREAMING_SNAKE_CASE					:			Tuple							= n_positions
											_SCREAMING_SNAKE_CASE					:			Optional[Any]							= n_embd
											_SCREAMING_SNAKE_CASE					:			Tuple							= n_layer
											_SCREAMING_SNAKE_CASE					:			List[Any]							= n_head
											_SCREAMING_SNAKE_CASE					:			Optional[int]							= n_inner
											_SCREAMING_SNAKE_CASE					:			Tuple							= activation_function
											_SCREAMING_SNAKE_CASE					:			List[str]							= resid_pdrop
											_SCREAMING_SNAKE_CASE					:			int							= embd_pdrop
											_SCREAMING_SNAKE_CASE					:			str							= attn_pdrop
											_SCREAMING_SNAKE_CASE					:			Union[str, Any]							= layer_norm_epsilon
											_SCREAMING_SNAKE_CASE					:			Optional[int]							= initializer_range
											_SCREAMING_SNAKE_CASE					:			str							= scale_attn_weights
											_SCREAMING_SNAKE_CASE					:			List[Any]							= use_cache
											_SCREAMING_SNAKE_CASE					:			Any							= scale_attn_by_inverse_layer_idx
											_SCREAMING_SNAKE_CASE					:			int							= reorder_and_upcast_attn
											_SCREAMING_SNAKE_CASE					:			str							= tie_word_embeddings

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





class        lowercase__    (		_snake_case   ):





							'''simple docstring'''


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






							def UpperCAmelCase_      (       self       ,   __snake_case       ,   __snake_case = 1       ,   __snake_case = -1       ,   __snake_case = False       ,   __snake_case = None       ,   __snake_case = 3       ,   __snake_case = 32       ,   __snake_case = 32       ,   ):
											_SCREAMING_SNAKE_CASE					:			str							= self._generate_dummy_images(__snake_case       ,   __snake_case       ,   __snake_case       ,   __snake_case    )
											_SCREAMING_SNAKE_CASE					:			Optional[int]							= dict(preprocessor(images=__snake_case       ,   return_tensors=__snake_case    )    )

											return inputs








'''simple docstring'''


import math







def      snake_case_  (    SCREAMING_SNAKE_CASE__	):







				"""simple docstring"""





				assert isinstance(SCREAMING_SNAKE_CASE__				, SCREAMING_SNAKE_CASE__	) and (
				    number >= 0
				), "'number' must been an int and positive"

				if 1 < number < 4:
								# 2 and 3 are primes
								return True
				elif number < 2 or not number % 2:
								# Negatives, 0, 1 and all even numbers are not primes
								return False

				_SCREAMING_SNAKE_CASE					:			List[str]							= range(3				, int(math.sqrt(SCREAMING_SNAKE_CASE__	) + 1	)				, 2	)
				return not any(not number % i for i in odd_numbers	)







def      snake_case_  (    SCREAMING_SNAKE_CASE__				, SCREAMING_SNAKE_CASE__=1				, **SCREAMING_SNAKE_CASE__	):







				"""simple docstring"""





				_SCREAMING_SNAKE_CASE					:			Dict							= factor * value
				_SCREAMING_SNAKE_CASE					:			Optional[Any]							= value

				while not is_prime(SCREAMING_SNAKE_CASE__	):
								value += 1 if not ("desc" in kwargs and kwargs["desc"] is True) else -1

				if value == first_value_val:
								return next_prime(value + 1				, **SCREAMING_SNAKE_CASE__	)
				return value




