





'''simple docstring'''
import warnings

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

class 	snake_case	(       __lowerCamelCase			):




 """simple docstring"""



 SCREAMING_SNAKE_CASE_      :   Any     						=['image_processor', 'tokenizer']
 SCREAMING_SNAKE_CASE_      :   Optional[Any]     						='ChineseCLIPImageProcessor'
 SCREAMING_SNAKE_CASE_      :   List[str]     						=('BertTokenizer', 'BertTokenizerFast')






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

        __UpperCamelCase			=    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__      )
        __UpperCamelCase			=    self.image_processor






 def __call__(			self			:				Optional[Any]				,      __A			:				Optional[int]=None				,      __A			:				List[Any]=None				,      __A			:				List[str]=None				,      **__A			:				Optional[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:
               __UpperCamelCase			=    self.tokenizer(lowerCAmelCase__				,      return_tensors=lowerCAmelCase__				,      **lowerCAmelCase__      )

        if images is not None:
               __UpperCamelCase			=    self.image_processor(lowerCAmelCase__				,      return_tensors=lowerCAmelCase__				,      **lowerCAmelCase__      )

        if text is not None and images is not None:
               __UpperCamelCase			=    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]				,      *__A			:				str				,      **__A			:				List[str]      ):
        return self.tokenizer.batch_decode(*lowerCAmelCase__				,      **lowerCAmelCase__      )






 def 			_lowerCamelCase   (			self			:				int				,      *__A			:				Union[str, Any]				,      **__A			:				int      ):
        return self.tokenizer.decode(*lowerCAmelCase__				,      **lowerCAmelCase__      )






 @property
 def 			_lowerCamelCase   (			self			:				str      ):
        __UpperCamelCase			=    self.tokenizer.model_input_names
        __UpperCamelCase			=    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







'''simple docstring'''

from typing import TYPE_CHECKING

from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


lowercase__		:     Tuple			=							{'configuration_mmbt': ['MMBTConfig']}

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   lowercase__		:     int			=							['MMBTForClassification', 'MMBTModel', 'ModalEmbeddings']


if TYPE_CHECKING:
   from .configuration_mmbt import MMBTConfig

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_mmbt import MMBTForClassification, MMBTModel, ModalEmbeddings

else:
   import sys

   lowercase__		:     List[Any]			=							_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)



