






'''simple docstring'''







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


_A	:			Tuple         =logging.get_logger(__name__)

_A	:			Optional[int]         ={
    '''bigcode/gpt_bigcode-santacoder''': '''https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json''',
}

class _lowercase	(				_lowercase		):
							a				      =       """gpt_bigcode"""
							a				      =       ["""past_key_values"""]
							a				      =       {
							    """hidden_size""": """n_embd""",
							    """max_position_embeddings""": """n_positions""",
							    """num_attention_heads""": """n_head""",
							    """num_hidden_layers""": """n_layer""",
							}




							def __init__(							self:				Dict			,							UpperCamelCase__:				Optional[Any]=50_257			,							UpperCamelCase__:				Union[str, Any]=1_024			,							UpperCamelCase__:				List[str]=768			,							UpperCamelCase__:				Tuple=12			,							UpperCamelCase__:				Any=12			,							UpperCamelCase__:				Dict=None			,							UpperCamelCase__:				Optional[int]="gelu_pytorch_tanh"			,							UpperCamelCase__:				Any=0.1			,							UpperCamelCase__:				Optional[Any]=0.1			,							UpperCamelCase__:				Union[str, Any]=0.1			,							UpperCamelCase__:				List[Any]=1e-5			,							UpperCamelCase__:				str=0.02			,							UpperCamelCase__:				Union[str, Any]=True			,							UpperCamelCase__:				Optional[Any]=True			,							UpperCamelCase__:				Dict=50_256			,							UpperCamelCase__:				Tuple=50_256			,							UpperCamelCase__:				Optional[int]=True			,							UpperCamelCase__:				Any=True			,							UpperCamelCase__:				int=True			,							**UpperCamelCase__:				Tuple			,							):
														lowerCamelCase__					:	str         =       vocab_size
														lowerCamelCase__					:	str         =       n_positions
														lowerCamelCase__					:	Union[str, Any]         =       n_embd
														lowerCamelCase__					:	Optional[Any]         =       n_layer
														lowerCamelCase__					:	int         =       n_head
														lowerCamelCase__					:	List[str]         =       n_inner
														lowerCamelCase__					:	Optional[Any]         =       activation_function
														lowerCamelCase__					:	int         =       resid_pdrop
														lowerCamelCase__					:	List[str]         =       embd_pdrop
														lowerCamelCase__					:	Union[str, Any]         =       attn_pdrop
														lowerCamelCase__					:	Optional[int]         =       layer_norm_epsilon
														lowerCamelCase__					:	Any         =       initializer_range
														lowerCamelCase__					:	List[Any]         =       scale_attn_weights
														lowerCamelCase__					:	Any         =       use_cache
														lowerCamelCase__					:	Union[str, Any]         =       attention_softmax_in_fpaa
														lowerCamelCase__					:	str         =       scale_attention_softmax_in_fpaa
														lowerCamelCase__					:	List[str]         =       multi_query

														lowerCamelCase__					:	List[str]         =       bos_token_id
														lowerCamelCase__					:	Union[str, Any]         =       eos_token_id

														super().__init__(bos_token_id=UpperCamelCase__			,							eos_token_id=UpperCamelCase__			,							**UpperCamelCase__     )




import warnings

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

class 				UpperCAmelCase_		(			__lowercase   ):
							"""simple docstring"""







							UpperCAmelCase__       :						Union[str, Any]	    =    ["image_processor", "tokenizer"]
							UpperCAmelCase__       :						Dict	    =    "ChineseCLIPImageProcessor"
							UpperCAmelCase__       :						List[str]	    =    ("BertTokenizer", "BertTokenizerFast")


							def __init__(			self       ,							_a=None       ,							_a=None       ,							**_a       )    ->    Any:
												_a	:    Optional[Any]         =		None
												if "feature_extractor" in kwargs:
																	warnings.warn(
																	    '''The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`'''
																	    ''' instead.'''       ,							_a       ,							)
																	_a	:    Tuple         =		kwargs.pop('''feature_extractor'''       )

												_a	:    Tuple         =		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__(_a       ,							_a       )
												_a	:    List[str]         =		self.image_processor


							def __call__(			self       ,							_a=None       ,							_a=None       ,							_a=None       ,							**_a       )    ->    int:

												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:
																	_a	:    List[str]         =		self.tokenizer(_a       ,							return_tensors=_a       ,							**_a       )

												if images is not None:
																	_a	:    Optional[Any]         =		self.image_processor(_a       ,							return_tensors=_a       ,							**_a       )

												if text is not None and images is not None:
																	_a	:    Union[str, Any]         =		image_features.pixel_values
																	return encoding
												elif text is not None:
																	return encoding
												else:
																	return BatchEncoding(data=dict(**_a       )       ,							tensor_type=_a       )


							def 				__lowercase				(			self       ,							*_a       ,							**_a       )    ->    Union[str, Any]:
												return self.tokenizer.batch_decode(*_a       ,							**_a       )


							def 				__lowercase				(			self       ,							*_a       ,							**_a       )    ->    Any:
												return self.tokenizer.decode(*_a       ,							**_a       )


							@property
							def 				__lowercase				(			self       )    ->    Optional[Any]:
												_a	:    Any         =		self.tokenizer.model_input_names
												_a	:    Dict         =		self.image_processor.model_input_names
												return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names       )       )




							@property
							def 				__lowercase				(			self       )    ->    Dict:
												warnings.warn(
												    '''`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead.'''       ,							_a       ,							)
												return self.image_processor_class



