






import warnings

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




class 					UpperCamelCase_ (     snake_case_							):



	'''simple docstring'''




	lowerCAmelCase						=					['''image_processor''', '''tokenizer''']
	lowerCAmelCase						=					'''ChineseCLIPImageProcessor'''
	lowerCAmelCase						=					('''BertTokenizer''', '''BertTokenizerFast''')




	def __init__(			self			,     a=None			,     a=None			,     **a   )			->       str:
								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.'			,     a			,     )
															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__(a			,     a   )
								snake_case_           =				self.image_processor




	def __call__(			self			,     a=None			,     a=None			,     a=None			,     **a   )			->       Tuple:

								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(a			,     return_tensors=a			,     **a   )

								if images is not None:
															snake_case_           =				self.image_processor(a			,     return_tensors=a			,     **a   )

								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(**a   )			,     tensor_type=a   )




	def 				_UpperCamelCase     (			self			,     *a			,     **a   )			->       Optional[int]:
								return self.tokenizer.batch_decode(*a			,     **a   )




	def 				_UpperCamelCase     (			self			,     *a			,     **a   )			->       Any:
								return self.tokenizer.decode(*a			,     **a   )




	@property
	def 				_UpperCamelCase     (			self   )			->       str:
								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 				_UpperCamelCase     (			self   )			->       Optional[int]:
								warnings.warn(
								    '`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead.'			,     a			,     )
								return self.image_processor_class













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


lowercase    				=   logging.get_logger(__name__)

lowercase    				=   {
    "transfo-xl-wt103": "https://huggingface.co/transfo-xl-wt103/resolve/main/config.json",
}




class 					UpperCamelCase_ (     snake_case_							):



	'''simple docstring'''




	lowerCAmelCase						=					'''transfo-xl'''
	lowerCAmelCase						=					['''mems''']
	lowerCAmelCase						=					{
	    '''n_token''': '''vocab_size''',
	    '''hidden_size''': '''d_model''',
	    '''num_attention_heads''': '''n_head''',
	    '''num_hidden_layers''': '''n_layer''',
	}




	def __init__(			self			,     a=26_77_35			,     a=[2_00_00, 4_00_00, 20_00_00]			,     a=10_24			,     a=10_24			,     a=16			,     a=64			,     a=40_96			,     a=4			,     a=False			,     a=18			,     a=16_00			,     a=10_00			,     a=True			,     a=True			,     a=0			,     a=-1			,     a=True			,     a=0.1			,     a=0.0			,     a=True			,     a="normal"			,     a=0.01			,     a=0.01			,     a=0.02			,     a=1E-5			,     a=0			,     **a			,     )			->       Union[str, Any]:
								snake_case_           =				vocab_size
								snake_case_           =				[]
								self.cutoffs.extend(a   )
								if proj_share_all_but_first:
															snake_case_           =				[False] + [True] * len(self.cutoffs   )
								else:
															snake_case_           =				[False] + [False] * len(self.cutoffs   )
								snake_case_           =				d_model
								snake_case_           =				d_embed
								snake_case_           =				d_head
								snake_case_           =				d_inner
								snake_case_           =				div_val
								snake_case_           =				pre_lnorm
								snake_case_           =				n_layer
								snake_case_           =				n_head
								snake_case_           =				mem_len
								snake_case_           =				same_length
								snake_case_           =				attn_type
								snake_case_           =				clamp_len
								snake_case_           =				sample_softmax
								snake_case_           =				adaptive
								snake_case_           =				dropout
								snake_case_           =				dropatt
								snake_case_           =				untie_r
								snake_case_           =				init
								snake_case_           =				init_range
								snake_case_           =				proj_init_std
								snake_case_           =				init_std
								snake_case_           =				layer_norm_epsilon
								super().__init__(eos_token_id=a			,     **a   )




	@property
	def 				_UpperCamelCase     (			self   )			->       int:
								# Message copied from Transformer-XL documentation
								logger.info(F'''The model {self.model_type} is one of the few models that has no sequence length limit.'''   )
								return -1






	@max_position_embeddings.setter
	def 				_UpperCamelCase     (			self			,     a   )			->       List[str]:
								# Message copied from Transformer-XL documentation
								raise NotImplementedError(
								    F'''The model {self.model_type} is one of the few models that has no sequence length limit.'''   )





