






import warnings

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding
class 							__SCREAMING_SNAKE_CASE       (							__lowerCamelCase     ):
      __a  					=["image_processor", "tokenizer"]
      __a  					="CLIPImageProcessor"
      __a  					=("CLIPTokenizer", "CLIPTokenizerFast")




      def __init__(  self ,   lowerCamelCase=None ,   lowerCamelCase=None ,   **lowerCamelCase      )							->str:



         '''simple docstring'''
         __a				     =    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				     =    kwargs.pop('feature_extractor'      )

         __a				     =    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 ,   lowerCamelCase=None ,   lowerCamelCase=None ,   lowerCamelCase=None ,   **lowerCamelCase      )							->Optional[int]:



         '''simple docstring'''

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

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

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




      def  __UpperCamelCase							(  self ,   *lowerCamelCase ,   **lowerCamelCase      )							->Tuple:



         '''simple docstring'''
         return self.tokenizer.batch_decode(*UpperCAmelCase_ ,   **UpperCAmelCase_      )




      def  __UpperCamelCase							(  self ,   *lowerCamelCase ,   **lowerCamelCase      )							->str:



         '''simple docstring'''
         return self.tokenizer.decode(*UpperCAmelCase_ ,   **UpperCAmelCase_      )




      @property
      def  __UpperCamelCase							(  self      )							->Optional[int]:



         '''simple docstring'''
         __a				     =    self.tokenizer.model_input_names
         __a				     =    self.image_processor.model_input_names
         return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names      )      )




      @property
      def  __UpperCamelCase							(  self      )							->int:



         '''simple docstring'''
         warnings.warn(
             '`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead.' ,   UpperCAmelCase_ ,   )
         return self.image_processor_class






      @property
      def  __UpperCamelCase							(  self      )							->Tuple:



         '''simple docstring'''
         warnings.warn(
             '`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead.' ,   UpperCAmelCase_ ,   )
         return self.image_processor







'''simple docstring'''



__UpperCamelCase      :       Optional[Any]      			=      [
    """DownloadConfig""",
    """DownloadManager""",
    """DownloadMode""",
    """StreamingDownloadManager""",
]

from .download_config import DownloadConfig
from .download_manager import DownloadManager, DownloadMode
from .streaming_download_manager import StreamingDownloadManager