






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

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


class 							__a							(  __A						):





		'''simple docstring'''



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


		def __init__(						self ,    UpperCamelCase__=512 + 1 ,    UpperCamelCase__=32 * 32 ,    UpperCamelCase__=512 ,    UpperCamelCase__=24 ,    UpperCamelCase__=8 ,    UpperCamelCase__=None ,    UpperCamelCase__="quick_gelu" ,    UpperCamelCase__=0.1 ,    UpperCamelCase__=0.1 ,    UpperCamelCase__=0.1 ,    UpperCamelCase__=1E-5 ,    UpperCamelCase__=0.02 ,    UpperCamelCase__=True ,    UpperCamelCase__=True ,    UpperCamelCase__=False ,    UpperCamelCase__=False ,    UpperCamelCase__=False ,    **UpperCamelCase__ ,    ):
						SCREAMING_SNAKE_CASE_   :	Union[str, Any]													=   vocab_size
						SCREAMING_SNAKE_CASE_   :	str													=   n_positions
						SCREAMING_SNAKE_CASE_   :	Dict													=   n_embd
						SCREAMING_SNAKE_CASE_   :	Tuple													=   n_layer
						SCREAMING_SNAKE_CASE_   :	List[str]													=   n_head
						SCREAMING_SNAKE_CASE_   :	List[Any]													=   n_inner
						SCREAMING_SNAKE_CASE_   :	Union[str, Any]													=   activation_function
						SCREAMING_SNAKE_CASE_   :	List[str]													=   resid_pdrop
						SCREAMING_SNAKE_CASE_   :	Optional[Any]													=   embd_pdrop
						SCREAMING_SNAKE_CASE_   :	Any													=   attn_pdrop
						SCREAMING_SNAKE_CASE_   :	Tuple													=   layer_norm_epsilon
						SCREAMING_SNAKE_CASE_   :	Optional[Any]													=   initializer_range
						SCREAMING_SNAKE_CASE_   :	Union[str, Any]													=   scale_attn_weights
						SCREAMING_SNAKE_CASE_   :	Dict													=   use_cache
						SCREAMING_SNAKE_CASE_   :	Dict													=   scale_attn_by_inverse_layer_idx
						SCREAMING_SNAKE_CASE_   :	Union[str, Any]													=   reorder_and_upcast_attn
						SCREAMING_SNAKE_CASE_   :	List[Any]													=   tie_word_embeddings

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






class 							__a							(  __A						):





		'''simple docstring'''



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






		def   __snake_case			(						self ,    UpperCamelCase__ ,    UpperCamelCase__ = 1 ,    UpperCamelCase__ = -1 ,    UpperCamelCase__ = False ,    UpperCamelCase__ = None ,    UpperCamelCase__ = 3 ,    UpperCamelCase__ = 32 ,    UpperCamelCase__ = 32 ,    ):
						SCREAMING_SNAKE_CASE_   :	Dict													=   self._generate_dummy_images(UpperCamelCase__ ,    UpperCamelCase__ ,    UpperCamelCase__ ,    UpperCamelCase__       )
						SCREAMING_SNAKE_CASE_   :	List[Any]													=   dict(preprocessor(images=UpperCamelCase__ ,    return_tensors=UpperCamelCase__       )       )

						return inputs







from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union

import pyarrow as pa


if TYPE_CHECKING:
				from .features import FeatureType


@dataclass
class 							__a							:





		'''simple docstring'''



		UpperCAmelCase__      :				List[str]
		UpperCAmelCase__      :				Optional[str]				    =						None
		# Automatically constructed
		UpperCAmelCase__      :				ClassVar[str]				    =						"dict"
		UpperCAmelCase__      :				ClassVar[Any]				    =						None
		UpperCAmelCase__      :				str				    =						field(default="""Translation""" ,	init=__A ,	repr=__A						)


		def __call__(						self       ):
						return pa.struct({lang: pa.string() for lang in sorted(self.languages       )}       )






		def   __snake_case			(						self       ):
						from .features import Value

						return {k: Value('string'       ) for k in sorted(self.languages       )}






@dataclass
class 							__a							:





		'''simple docstring'''



		UpperCAmelCase__      :				Optional[List]				    =						None
		UpperCAmelCase__      :				Optional[int]				    =						None
		UpperCAmelCase__      :				Optional[str]				    =						None
		# Automatically constructed
		UpperCAmelCase__      :				ClassVar[str]				    =						"dict"
		UpperCAmelCase__      :				ClassVar[Any]				    =						None
		UpperCAmelCase__      :				str				    =						field(default="""TranslationVariableLanguages""" ,	init=__A ,	repr=__A						)


		def   __snake_case			(						self       ):
						SCREAMING_SNAKE_CASE_   :	Any													=   sorted(set(self.languages       )       ) if self.languages else None
						SCREAMING_SNAKE_CASE_   :	Dict													=   len(self.languages       ) if self.languages else None


		def __call__(						self       ):
						return pa.struct({'language': pa.list_(pa.string()       ), 'translation': pa.list_(pa.string()       )}       )


		def   __snake_case			(						self ,    UpperCamelCase__       ):
						SCREAMING_SNAKE_CASE_   :	Union[str, Any]													=   set(self.languages       )
						if self.languages and set(UpperCamelCase__       ) - lang_set:
										raise ValueError(
										    F'''Some languages in example ({', '.join(sorted(set(UpperCamelCase__       ) - lang_set       )       )}) are not in valid set ({', '.join(UpperCamelCase__       )}).'''       )

						# Convert dictionary into tuples, splitting out cases where there are
						# multiple translations for a single language.
						SCREAMING_SNAKE_CASE_   :	List[str]													=   []
						for lang, text in translation_dict.items():
										if isinstance(UpperCamelCase__ ,    UpperCamelCase__       ):
														translation_tuples.append((lang, text)       )
										else:
														translation_tuples.extend([(lang, el) for el in text]       )

        # Ensure translations are in ascending order by language code.
						SCREAMING_SNAKE_CASE_							,       SCREAMING_SNAKE_CASE_   :	Dict													=   zip(*sorted(UpperCamelCase__       )       )

						return {"language": languages, "translation": translations}






		def   __snake_case			(						self       ):
						from .features import Sequence, Value

						return {
						    "language": Sequence(Value('string'       )       ),
						    "translation": Sequence(Value('string'       )       ),
						}