




import warnings

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





class 	lowerCamelCase_							(				_SCREAMING_SNAKE_CASE ):


 '''simple docstring'''







 lowercase_       =   ["image_processor", "tokenizer"]
 lowercase_       =   "ChineseCLIPImageProcessor"
 lowercase_       =   ("BertTokenizer", "BertTokenizerFast")



 def __init__(							self  :		Optional[Any]    ,    _lowerCAmelCase  :		Any=None    ,    _lowerCAmelCase  :		Dict=None    ,    **_lowerCAmelCase  :		Dict						):
       SCREAMING_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.'    ,    _lowerCAmelCase    ,    )
             SCREAMING_SNAKE_CASE_     						=      kwargs.pop('feature_extractor'						)

       SCREAMING_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__(_lowerCAmelCase    ,    _lowerCAmelCase						)
       SCREAMING_SNAKE_CASE_     						=      self.image_processor



 def __call__(							self  :		Optional[int]    ,    _lowerCAmelCase  :		Tuple=None    ,    _lowerCAmelCase  :		str=None    ,    _lowerCAmelCase  :		str=None    ,    **_lowerCAmelCase  :		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:
             SCREAMING_SNAKE_CASE_     						=      self.tokenizer(_lowerCAmelCase    ,    return_tensors=_lowerCAmelCase    ,    **_lowerCAmelCase						)

       if images is not None:
             SCREAMING_SNAKE_CASE_     						=      self.image_processor(_lowerCAmelCase    ,    return_tensors=_lowerCAmelCase    ,    **_lowerCAmelCase						)

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



 def 				lowerCAmelCase_  (							self  :		Optional[int]    ,    *_lowerCAmelCase  :		int    ,    **_lowerCAmelCase  :		Union[str, Any]						):
       return self.tokenizer.batch_decode(*_lowerCAmelCase    ,    **_lowerCAmelCase						)



 def 				lowerCAmelCase_  (							self  :		str    ,    *_lowerCAmelCase  :		Dict    ,    **_lowerCAmelCase  :		List[Any]						):
       return self.tokenizer.decode(*_lowerCAmelCase    ,    **_lowerCAmelCase						)



 @property
 def 				lowerCAmelCase_  (							self  :		int						):
       SCREAMING_SNAKE_CASE_     						=      self.tokenizer.model_input_names
       SCREAMING_SNAKE_CASE_     						=      self.image_processor.model_input_names
       return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names						)						)




 @property
 def 				lowerCAmelCase_  (							self  :		List[str]						):
       warnings.warn(
           '`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead.'    ,    _lowerCAmelCase    ,    )
       return self.image_processor_class





from abc import ABC, abstractmethod
from argparse import ArgumentParser





class 	lowerCamelCase_							(				_SCREAMING_SNAKE_CASE ):


 '''simple docstring'''







 @staticmethod
 @abstractmethod
 def 				lowerCAmelCase_  (							_lowerCAmelCase  :		ArgumentParser						):
       raise NotImplementedError()




 @abstractmethod
 def 				lowerCAmelCase_  (							self  :		Dict						):
       raise NotImplementedError()