




from typing import List, Optional, Union

from ...image_utils import ImageInput
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import TensorType

class  _lowerCamelCase						(			UpperCAmelCase__   ):

      """simple docstring"""

      lowerCAmelCase__			: Any    =					["image_processor", "tokenizer"]
      lowerCAmelCase__			: List[Any]    =					"BlipImageProcessor"
      lowerCAmelCase__			: Union[str, Any]    =					"AutoTokenizer"







      def __init__(     self					: Any ,       snake_case					: Tuple ,       snake_case					: int				):
          __UpperCamelCase  		=						False
          super().__init__(lowerCamelCase__ ,       lowerCamelCase__				)
          __UpperCamelCase  		=						self.image_processor







      def __call__(     self					: Dict ,       snake_case					: ImageInput = None ,       snake_case					: Union[TextInput, PreTokenizedInput, List[TextInput], List[PreTokenizedInput]] = None ,       snake_case					: bool = True ,       snake_case					: Union[bool, str, PaddingStrategy] = False ,       snake_case					: Union[bool, str, TruncationStrategy] = None ,       snake_case					: Optional[int] = None ,       snake_case					: int = 0 ,       snake_case					: Optional[int] = None ,       snake_case					: Optional[bool] = None ,       snake_case					: bool = False ,       snake_case					: bool = False ,       snake_case					: bool = False ,       snake_case					: bool = False ,       snake_case					: bool = False ,       snake_case					: bool = True ,       snake_case					: Optional[Union[str, TensorType]] = None ,       **snake_case					: Tuple ,       ):







          if images is None and text is None:
              raise ValueError('''You have to specify either images or text.'''				)

          # Get only text
          if images is None:
              __UpperCamelCase  		=						self.tokenizer
              __UpperCamelCase  		=						self.tokenizer(
                  text=lowerCamelCase__ ,       add_special_tokens=lowerCamelCase__ ,       padding=lowerCamelCase__ ,       truncation=lowerCamelCase__ ,       max_length=lowerCamelCase__ ,       stride=lowerCamelCase__ ,       pad_to_multiple_of=lowerCamelCase__ ,       return_attention_mask=lowerCamelCase__ ,       return_overflowing_tokens=lowerCamelCase__ ,       return_special_tokens_mask=lowerCamelCase__ ,       return_offsets_mapping=lowerCamelCase__ ,       return_token_type_ids=lowerCamelCase__ ,       return_length=lowerCamelCase__ ,       verbose=lowerCamelCase__ ,       return_tensors=lowerCamelCase__ ,       **lowerCamelCase__ ,       )
              return text_encoding

          # add pixel_values
          __UpperCamelCase  		=						self.image_processor(lowerCamelCase__ ,       return_tensors=lowerCamelCase__				)

          if text is not None:
              __UpperCamelCase  		=						self.tokenizer(
                  text=lowerCamelCase__ ,       add_special_tokens=lowerCamelCase__ ,       padding=lowerCamelCase__ ,       truncation=lowerCamelCase__ ,       max_length=lowerCamelCase__ ,       stride=lowerCamelCase__ ,       pad_to_multiple_of=lowerCamelCase__ ,       return_attention_mask=lowerCamelCase__ ,       return_overflowing_tokens=lowerCamelCase__ ,       return_special_tokens_mask=lowerCamelCase__ ,       return_offsets_mapping=lowerCamelCase__ ,       return_token_type_ids=lowerCamelCase__ ,       return_length=lowerCamelCase__ ,       verbose=lowerCamelCase__ ,       return_tensors=lowerCamelCase__ ,       **lowerCamelCase__ ,       )
          else:
              __UpperCamelCase  		=						None

          if text_encoding is not None:
              encoding_image_processor.update(lowerCamelCase__				)

          return encoding_image_processor







      def       snake_case	(     self					: List[Any] ,       *snake_case					: Optional[int] ,       **snake_case					: Dict				):
          return self.tokenizer.batch_decode(*lowerCamelCase__ ,       **lowerCamelCase__				)







      def       snake_case	(     self					: int ,       *snake_case					: Dict ,       **snake_case					: str				):
          return self.tokenizer.decode(*lowerCamelCase__ ,       **lowerCamelCase__				)







      @property
      # Copied from transformers.models.blip.processing_blip.BlipProcessor.model_input_names
      def       snake_case	(     self					: Any				):
          __UpperCamelCase  		=						self.tokenizer.model_input_names
          __UpperCamelCase  		=						self.image_processor.model_input_names
          return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names				)				)












from abc import ABC, abstractmethod
from argparse import ArgumentParser

class  _lowerCamelCase						(			_SCREAMING_SNAKE_CASE   ):

      """simple docstring"""

      @staticmethod
      @abstractmethod
      def       snake_case	(     snake_case					: ArgumentParser				):
          raise NotImplementedError()







      @abstractmethod
      def       snake_case	(     self					: Optional[Any]				):
          raise NotImplementedError()






