





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 					__A    (    lowerCAmelCase ):

			'''simple docstring'''







			lowerCAmelCase_							     =						["""image_processor""", """tokenizer"""]
			lowerCAmelCase_							     =						"""BlipImageProcessor"""
			lowerCAmelCase_							     =						("""BertTokenizer""", """BertTokenizerFast""")





			def __init__(    self       ,  __lowerCAmelCase       ,  __lowerCAmelCase							):



				'''simple docstring'''







				lowerCamelCase__								=		False
				super().__init__(__lowerCAmelCase       ,  __lowerCAmelCase							)
				lowerCamelCase__								=		self.image_processor





			def __call__(    self       ,  __lowerCAmelCase = None       ,  __lowerCAmelCase = None       ,  __lowerCAmelCase = True       ,  __lowerCAmelCase = False       ,  __lowerCAmelCase = None       ,  __lowerCAmelCase = None       ,  __lowerCAmelCase = 0       ,  __lowerCAmelCase = None       ,  __lowerCAmelCase = None       ,  __lowerCAmelCase = False       ,  __lowerCAmelCase = False       ,  __lowerCAmelCase = False       ,  __lowerCAmelCase = False       ,  __lowerCAmelCase = False       ,  __lowerCAmelCase = True       ,  __lowerCAmelCase = None       ,  **__lowerCAmelCase       ,  ):



				'''simple docstring'''







				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:
					lowerCamelCase__								=		self.tokenizer
					lowerCamelCase__								=		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
				lowerCamelCase__								=		self.image_processor(__lowerCAmelCase       ,  return_tensors=__lowerCAmelCase							)

				if text is not None:
					lowerCamelCase__								=		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:
					lowerCamelCase__								=		None

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

				return encoding_image_processor





			def 		__lowerCamelCase				(    self       ,  *__lowerCAmelCase       ,  **__lowerCAmelCase							):



				'''simple docstring'''







				return self.tokenizer.batch_decode(*__lowerCAmelCase       ,  **__lowerCAmelCase							)





			def 		__lowerCamelCase				(    self       ,  *__lowerCAmelCase       ,  **__lowerCAmelCase							):



				'''simple docstring'''







				return self.tokenizer.decode(*__lowerCAmelCase       ,  **__lowerCAmelCase							)





			@property
			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







				lowerCamelCase__								=		self.tokenizer.model_input_names
				lowerCamelCase__								=		self.image_processor.model_input_names
				return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names							)							)










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 					__A    (    lowerCAmelCase ):

			'''simple docstring'''







			lowerCAmelCase_							     =						["""image_processor""", """tokenizer"""]
			lowerCAmelCase_							     =						"""BlipImageProcessor"""
			lowerCAmelCase_							     =						("""BertTokenizer""", """BertTokenizerFast""")





			def __init__(    self       ,  __lowerCAmelCase       ,  __lowerCAmelCase							):



				'''simple docstring'''







				lowerCamelCase__								=		False
				super().__init__(__lowerCAmelCase       ,  __lowerCAmelCase							)
				lowerCamelCase__								=		self.image_processor





			def __call__(    self       ,  __lowerCAmelCase = None       ,  __lowerCAmelCase = None       ,  __lowerCAmelCase = True       ,  __lowerCAmelCase = False       ,  __lowerCAmelCase = None       ,  __lowerCAmelCase = None       ,  __lowerCAmelCase = 0       ,  __lowerCAmelCase = None       ,  __lowerCAmelCase = None       ,  __lowerCAmelCase = False       ,  __lowerCAmelCase = False       ,  __lowerCAmelCase = False       ,  __lowerCAmelCase = False       ,  __lowerCAmelCase = False       ,  __lowerCAmelCase = True       ,  __lowerCAmelCase = None       ,  **__lowerCAmelCase       ,  ):



				'''simple docstring'''







				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:
					lowerCamelCase__								=		self.tokenizer
					lowerCamelCase__								=		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
				lowerCamelCase__								=		self.image_processor(__lowerCAmelCase       ,  return_tensors=__lowerCAmelCase							)

				if text is not None:
					lowerCamelCase__								=		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:
					lowerCamelCase__								=		None

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

				return encoding_image_processor





			def 		__lowerCamelCase				(    self       ,  *__lowerCAmelCase       ,  **__lowerCAmelCase							):



				'''simple docstring'''







				return self.tokenizer.batch_decode(*__lowerCAmelCase       ,  **__lowerCAmelCase							)





			def 		__lowerCamelCase				(    self       ,  *__lowerCAmelCase       ,  **__lowerCAmelCase							):



				'''simple docstring'''







				return self.tokenizer.decode(*__lowerCAmelCase       ,  **__lowerCAmelCase							)





			@property
			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







				lowerCamelCase__								=		self.tokenizer.model_input_names
				lowerCamelCase__								=		self.image_processor.model_input_names
				return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names							)							)



