
import warnings

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding




class    SCREAMING_SNAKE_CASE__     (	UpperCAmelCase__					):





	'''simple docstring'''



	_UpperCAmelCase       :		List[str]       =					["image_processor", "tokenizer"]
	_UpperCAmelCase       :		Tuple       =					"CLIPImageProcessor"
	_UpperCAmelCase       :		Tuple       =					("CLIPTokenizer", "CLIPTokenizerFast")



	def __init__(  self	:    List[Any]			,  lowercase	:    Dict=None			,  lowercase	:    List[str]=None			,  **lowercase	:    List[str]	):


				'''simple docstring'''


				_snake_case		=			None
				if "feature_extractor" in kwargs:
							warnings.warn(
							    'The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`'
							    ' instead.'			,  lowercase_			,  )
							_snake_case		=			kwargs.pop('feature_extractor'	)

				_snake_case		=			image_processor if image_processor is not None else feature_extractor
				if image_processor is None:
							raise ValueError('You need to specify an `image_processor`.'	)
				if tokenizer is None:
							raise ValueError('You need to specify a `tokenizer`.'	)

				super().__init__(lowercase_			,  lowercase_	)



	def __call__(  self	:    str			,  lowercase	:    int=None			,  lowercase	:    int=None			,  lowercase	:    Dict=None			,  **lowercase	:    Any	):


				'''simple docstring'''


				if text is None and images is None:
							raise ValueError('You have to specify either text or images. Both cannot be none.'	)

				if text is not None:
							_snake_case		=			self.tokenizer(lowercase_			,  return_tensors=lowercase_			,  **lowercase_	)

				if images is not None:
							_snake_case		=			self.image_processor(lowercase_			,  return_tensors=lowercase_			,  **lowercase_	)

				if text is not None and images is not None:
							_snake_case		=			image_features.pixel_values
							return encoding
				elif text is not None:
							return encoding
				else:
							return BatchEncoding(data=dict(**lowercase_	)			,  tensor_type=lowercase_	)



	def  A							(  self	:    str			,  *lowercase	:    int			,  **lowercase	:    Any	):


				'''simple docstring'''


				return self.tokenizer.batch_decode(*lowercase_			,  **lowercase_	)



	def  A							(  self	:    List[str]			,  *lowercase	:    Union[str, Any]			,  **lowercase	:    Optional[int]	):


				'''simple docstring'''


				return self.tokenizer.decode(*lowercase_			,  **lowercase_	)



	@property
	def  A							(  self	:    List[str]	):


				'''simple docstring'''


				_snake_case		=			self.tokenizer.model_input_names
				_snake_case		=			self.image_processor.model_input_names
				return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names	)	)



	@property
	def  A							(  self	:    Optional[int]	):


				'''simple docstring'''


				warnings.warn(
				    '`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead.'			,  lowercase_			,  )
				return self.image_processor_class





	@property
	def  A							(  self	:    List[str]	):


				'''simple docstring'''


				warnings.warn(
				    '`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead.'			,  lowercase_			,  )
				return self.image_processor







"""simple docstring"""






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


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

UpperCAmelCase_   : Any   			= {"""openai-gpt""": """https://huggingface.co/openai-gpt/resolve/main/config.json"""}




class 							lowerCAmelCase__				(			UpperCAmelCase__ ):






      '''simple docstring'''

      __UpperCamelCase	 =  "openai-gpt"
      __UpperCamelCase	 =  {
          "max_position_embeddings": "n_positions",
          "hidden_size": "n_embd",
          "num_attention_heads": "n_head",
          "num_hidden_layers": "n_layer",
      }
      def __init__(						self     :  List[str]						,	lowercase_     :  List[str]=40478						,	lowercase_     :  List[str]=512						,	lowercase_     :  Optional[Any]=768						,	lowercase_     :  Tuple=12						,	lowercase_     :  Tuple=12						,	lowercase_     :  Union[str, Any]="gelu"						,	lowercase_     :  List[Any]=0.1						,	lowercase_     :  Tuple=0.1						,	lowercase_     :  List[Any]=0.1						,	lowercase_     :  List[Any]=1e-5						,	lowercase_     :  int=0.02						,	lowercase_     :  Optional[int]="cls_index"						,	lowercase_     :  Any=True						,	lowercase_     :  List[Any]=None						,	lowercase_     :  List[str]=True						,	lowercase_     :  Optional[Any]=0.1						,	**lowercase_     :  List[str]						,	):




          '''simple docstring'''


          SCREAMING_SNAKE_CASE_      :  Optional[int]    						=		vocab_size
          SCREAMING_SNAKE_CASE_      :  Tuple    						=		n_positions
          SCREAMING_SNAKE_CASE_      :  Optional[int]    						=		n_embd
          SCREAMING_SNAKE_CASE_      :  Dict    						=		n_layer
          SCREAMING_SNAKE_CASE_      :  Any    						=		n_head
          SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		afn
          SCREAMING_SNAKE_CASE_      :  int    						=		resid_pdrop
          SCREAMING_SNAKE_CASE_      :  List[str]    						=		embd_pdrop
          SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		attn_pdrop
          SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		layer_norm_epsilon
          SCREAMING_SNAKE_CASE_      :  List[Any]    						=		initializer_range
          SCREAMING_SNAKE_CASE_      :  List[str]    						=		summary_type
          SCREAMING_SNAKE_CASE_      :  Tuple    						=		summary_use_proj
          SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		summary_activation
          SCREAMING_SNAKE_CASE_      :  Any    						=		summary_first_dropout
          SCREAMING_SNAKE_CASE_      :  List[str]    						=		summary_proj_to_labels
          super().__init__(**lowercase_)


