





"""simple docstring"""






from ..utils import DummyObject, requires_backends




class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






class 			__lowercase     (     metaclass=_UpperCamelCase							):







     '''simple docstring'''




     __lowerCAmelCase					=					['''sentencepiece''']







     def __init__(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
         requires_backends(self		,     ['''sentencepiece''']       )






"""simple docstring"""






import warnings

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




class 			__lowercase     (     _UpperCamelCase							):







					'''simple docstring'''




					__lowerCAmelCase					=					['''image_processor''', '''tokenizer''']
					__lowerCAmelCase					=					'''CLIPImageProcessor'''
					__lowerCAmelCase					=					('''XLMRobertaTokenizer''', '''XLMRobertaTokenizerFast''')







					def __init__(  self		,     _UpperCAmelCase=None		,     _UpperCAmelCase=None		,     **_UpperCAmelCase       ):
									__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.'''		,     _UpperCAmelCase		,     )
													__a	:  Any         =					kwargs.pop('''feature_extractor'''       )

									__a	:  Optional[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__(_UpperCAmelCase		,     _UpperCAmelCase       )







					def __call__(  self		,     _UpperCAmelCase=None		,     _UpperCAmelCase=None		,     _UpperCAmelCase=None		,     **_UpperCAmelCase       ):

									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	:  Any         =					self.tokenizer(_UpperCAmelCase		,     return_tensors=_UpperCAmelCase		,     **_UpperCAmelCase       )

									if images is not None:
													__a	:  List[str]         =					self.image_processor(_UpperCAmelCase		,     return_tensors=_UpperCAmelCase		,     **_UpperCAmelCase       )

									if text is not None and images is not None:
													__a	:  Optional[int]         =					image_features.pixel_values
													return encoding
									elif text is not None:
													return encoding
									else:
													return BatchEncoding(data=dict(**_UpperCAmelCase       )		,     tensor_type=_UpperCAmelCase       )







					def 	_lowerCamelCase						(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
									return self.tokenizer.batch_decode(*_UpperCAmelCase		,     **_UpperCAmelCase       )







					def 	_lowerCamelCase						(  self		,     *_UpperCAmelCase		,     **_UpperCAmelCase       ):
									return self.tokenizer.decode(*_UpperCAmelCase		,     **_UpperCAmelCase       )







					@property
					def 	_lowerCamelCase						(  self       ):
									__a	:  Union[str, 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       )       )