


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

a__							:				Optional[int]          =	logging.get_logger(__name__)

a__							:				Any          =	{
    '''openai/imagegpt-small''': '''''',
    '''openai/imagegpt-medium''': '''''',
    '''openai/imagegpt-large''': '''''',
}




class 					UpperCamelCase_      (					_a):

	"""simple docstring"""





	snake_case__							:    Any          =     """imagegpt"""
	snake_case__							:    List[str]          =     ["""past_key_values"""]
	snake_case__							:    Any          =     {
	    """hidden_size""": """n_embd""",
	    """max_position_embeddings""": """n_positions""",
	    """num_attention_heads""": """n_head""",
	    """num_hidden_layers""": """n_layer""",
	}




	def __init__(					self     :							List[str]     ,     UpperCAmelCase__     :							Tuple=5_1_2 + 1     ,     UpperCAmelCase__     :							Union[str, Any]=3_2 * 3_2     ,     UpperCAmelCase__     :							Any=5_1_2     ,     UpperCAmelCase__     :							List[str]=2_4     ,     UpperCAmelCase__     :							Optional[Any]=8     ,     UpperCAmelCase__     :							Tuple=None     ,     UpperCAmelCase__     :							int="quick_gelu"     ,     UpperCAmelCase__     :							List[str]=0.1     ,     UpperCAmelCase__     :							List[str]=0.1     ,     UpperCAmelCase__     :							Dict=0.1     ,     UpperCAmelCase__     :							Optional[int]=1E-5     ,     UpperCAmelCase__     :							Dict=0.02     ,     UpperCAmelCase__     :							Optional[int]=True     ,     UpperCAmelCase__     :							List[str]=True     ,     UpperCAmelCase__     :							Optional[Any]=False     ,     UpperCAmelCase__     :							str=False     ,     UpperCAmelCase__     :							int=False     ,     **UpperCAmelCase__     :							Dict     ,     )			->      Optional[Any]:
						__SCREAMING_SNAKE_CASE		  =							vocab_size
						__SCREAMING_SNAKE_CASE		  =							n_positions
						__SCREAMING_SNAKE_CASE		  =							n_embd
						__SCREAMING_SNAKE_CASE		  =							n_layer
						__SCREAMING_SNAKE_CASE		  =							n_head
						__SCREAMING_SNAKE_CASE		  =							n_inner
						__SCREAMING_SNAKE_CASE		  =							activation_function
						__SCREAMING_SNAKE_CASE		  =							resid_pdrop
						__SCREAMING_SNAKE_CASE		  =							embd_pdrop
						__SCREAMING_SNAKE_CASE		  =							attn_pdrop
						__SCREAMING_SNAKE_CASE		  =							layer_norm_epsilon
						__SCREAMING_SNAKE_CASE		  =							initializer_range
						__SCREAMING_SNAKE_CASE		  =							scale_attn_weights
						__SCREAMING_SNAKE_CASE		  =							use_cache
						__SCREAMING_SNAKE_CASE		  =							scale_attn_by_inverse_layer_idx
						__SCREAMING_SNAKE_CASE		  =							reorder_and_upcast_attn
						__SCREAMING_SNAKE_CASE		  =							tie_word_embeddings

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




class 					UpperCamelCase_      (					_a):

	"""simple docstring"""





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




	def     UpperCAmelCase_ (					self     :							Optional[int]     ,     UpperCAmelCase__     :							"FeatureExtractionMixin"     ,     UpperCAmelCase__     :							int = 1     ,     UpperCAmelCase__     :							int = -1     ,     UpperCAmelCase__     :							bool = False     ,     UpperCAmelCase__     :							Optional["TensorType"] = None     ,     UpperCAmelCase__     :							int = 3     ,     UpperCAmelCase__     :							int = 3_2     ,     UpperCAmelCase__     :							int = 3_2     ,     )			->      Optional[int]:
						__SCREAMING_SNAKE_CASE		  =							self._generate_dummy_images(A_     ,     A_     ,     A_     ,     A_  )
						__SCREAMING_SNAKE_CASE		  =							dict(preprocessor(images=A_     ,     return_tensors=A_  )  )

						return inputs




"""simple docstring"""

from typing import Optional
from urllib.parse import quote

import huggingface_hub as hfh
from packaging import version


def lowerCAmelCase_   (					UpperCamelCase__						:			str					, UpperCamelCase__						:			str					, UpperCamelCase__						:			Optional[str] = None			):






 """simple docstring"""







 if version.parse(hfh.__version__			).release < version.parse("""0.11.0"""			).release:
  # old versions of hfh don't url-encode the file path
  __lowercase						=						quote(UpperCamelCase__			)
 return hfh.hf_hub_url(UpperCamelCase__					, UpperCamelCase__					, repo_type="""dataset"""					, revision=UpperCamelCase__			)
