



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       _SCREAMING_SNAKE_CASE	(UpperCamelCase ):
     lowerCAmelCase					=			["""image_processor""", """tokenizer"""]
     lowerCAmelCase					=			"""BlipImageProcessor"""
     lowerCAmelCase					=			("""BertTokenizer""", """BertTokenizerFast""")





     def __init__(       self :							Dict     ,  UpperCamelCase :							List[Any]     ,  UpperCamelCase :							int				)->Any:
      __SCREAMING_SNAKE_CASE       :    Optional[Any]       =	False
      super().__init__(UpperCamelCase     ,  UpperCamelCase				)
      __SCREAMING_SNAKE_CASE       :    List[Any]       =	self.image_processor





     def __call__(       self :							Any     ,  UpperCamelCase :							ImageInput = None     ,  UpperCamelCase :							Union[TextInput, PreTokenizedInput, List[TextInput], List[PreTokenizedInput]] = None     ,  UpperCamelCase :							bool = True     ,  UpperCamelCase :							Union[bool, str, PaddingStrategy] = False     ,  UpperCamelCase :							Union[bool, str, TruncationStrategy] = None     ,  UpperCamelCase :							Optional[int] = None     ,  UpperCamelCase :							int = 0     ,  UpperCamelCase :							Optional[int] = None     ,  UpperCamelCase :							Optional[bool] = None     ,  UpperCamelCase :							bool = False     ,  UpperCamelCase :							bool = False     ,  UpperCamelCase :							bool = False     ,  UpperCamelCase :							bool = False     ,  UpperCamelCase :							bool = False     ,  UpperCamelCase :							bool = True     ,  UpperCamelCase :							Optional[Union[str, TensorType]] = None     ,  **UpperCamelCase :							Dict     ,  )->BatchEncoding:
      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:
       __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	self.tokenizer
       __SCREAMING_SNAKE_CASE       :    Any       =	self.tokenizer(
           text=UpperCamelCase     ,  add_special_tokens=UpperCamelCase     ,  padding=UpperCamelCase     ,  truncation=UpperCamelCase     ,  max_length=UpperCamelCase     ,  stride=UpperCamelCase     ,  pad_to_multiple_of=UpperCamelCase     ,  return_attention_mask=UpperCamelCase     ,  return_overflowing_tokens=UpperCamelCase     ,  return_special_tokens_mask=UpperCamelCase     ,  return_offsets_mapping=UpperCamelCase     ,  return_token_type_ids=UpperCamelCase     ,  return_length=UpperCamelCase     ,  verbose=UpperCamelCase     ,  return_tensors=UpperCamelCase     ,  **UpperCamelCase     ,  )
       return text_encoding

      # add pixel_values
      __SCREAMING_SNAKE_CASE       :    Dict       =	self.image_processor(UpperCamelCase     ,  return_tensors=UpperCamelCase				)

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

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

      return encoding_image_processor





     def 	__snake_case    (       self :							int     ,  *UpperCamelCase :							Optional[Any]     ,  **UpperCamelCase :							Any				)->List[str]:
      return self.tokenizer.batch_decode(*UpperCamelCase     ,  **UpperCamelCase				)





     def 	__snake_case    (       self :							List[str]     ,  *UpperCamelCase :							List[str]     ,  **UpperCamelCase :							int				)->str:
      return self.tokenizer.decode(*UpperCamelCase     ,  **UpperCamelCase				)






     @property
     def 	__snake_case    (       self :							List[Any]				)->Any:
      __SCREAMING_SNAKE_CASE       :    str       =	self.tokenizer.model_input_names
      __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	self.image_processor.model_input_names
      return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names				)				)











from diffusers.utils.testing_utils import require_onnxruntime

@require_onnxruntime
class       _SCREAMING_SNAKE_CASE	:
     pass






