



import warnings

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



class 							__snake_case		(	UpperCamelCase_		):
							_a      =					['''image_processor''', '''tokenizer''']
							_a      =					'''ChineseCLIPImageProcessor'''
							_a      =					('''BertTokenizer''', '''BertTokenizerFast''')




							def __init__(			self	:			str							,							A_	:			Optional[Any]=None							,							A_	:			Any=None							,							**A_	:			str):
									lowerCAmelCase_     :	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							,							)
											lowerCAmelCase_     :	List[Any]							   =					kwargs.pop('''feature_extractor''')

									lowerCAmelCase_     :	Any							   =					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)
									lowerCAmelCase_     :	Dict							   =					self.image_processor




							def __call__(			self	:			Any							,							A_	:			Dict=None							,							A_	:			Dict=None							,							A_	:			Dict=None							,							**A_	:			Union[str, Any]):

									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:
											lowerCAmelCase_     :	int							   =					self.tokenizer(__a							,							return_tensors=__a							,							**__a)

									if images is not None:
											lowerCAmelCase_     :	int							   =					self.image_processor(__a							,							return_tensors=__a							,							**__a)

									if text is not None and images is not None:
											lowerCAmelCase_     :	Dict							   =					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	:			Tuple							,							*A_	:			Dict							,							**A_	:			Dict):
									return self.tokenizer.batch_decode(*__a							,							**__a)




							def   UpperCAmelCase__     (			self	:			int							,							*A_	:			List[str]							,							**A_	:			List[str]):
									return self.tokenizer.decode(*__a							,							**__a)




							@property
							def   UpperCAmelCase__     (			self	:			Any):
									lowerCAmelCase_     :	Optional[int]							   =					self.tokenizer.model_input_names
									lowerCAmelCase_     :	Union[str, Any]							   =					self.image_processor.model_input_names
									return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names))







							@property
							def   UpperCAmelCase__     (			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






'''simple docstring'''


from collections.abc import Sequence





def    lowerCAmelCase       (		UpperCamelCase__					: Sequence[float]     ,       UpperCamelCase__					: bool = False							):


	"""simple docstring"""
	if not arr:
		return 0

	__UpperCAmelCase      					=      0 if allow_empty_subarrays else float('''-inf'''							)
	__UpperCAmelCase      					=      0.0
	for num in arr:
		__UpperCAmelCase      					=      max(0 if allow_empty_subarrays else num     ,       curr_sum + num							)
		__UpperCAmelCase      					=      max(UpperCamelCase__     ,       UpperCamelCase__							)

	return max_sum


if __name__ == "__main__":
					from doctest import testmod

					testmod()

					__lowerCAmelCase						:							int    							=						[-2, 1, -3, 4, -1, 2, 1, -5, 4]
					print(F"""{max_subarray_sum(nums) = }""")
