
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_						(    a_							):




			'''simple docstring'''


			_lowercase      =							['image_processor', 'tokenizer']
			_lowercase      =							'BlipImageProcessor'
			_lowercase      =							('BertTokenizer', 'BertTokenizerFast')







			def __init__(	self    ,							__UpperCAmelCase    ,							__UpperCAmelCase  ):
										SCREAMING_SNAKE_CASE_	:							List[Any]											=False
										super().__init__(__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE  )
										SCREAMING_SNAKE_CASE_	:							Optional[int]											=self.image_processor







			def __call__(	self    ,							__UpperCAmelCase = None    ,							__UpperCAmelCase = None    ,							__UpperCAmelCase = True    ,							__UpperCAmelCase = False    ,							__UpperCAmelCase = None    ,							__UpperCAmelCase = None    ,							__UpperCAmelCase = 0    ,							__UpperCAmelCase = None    ,							__UpperCAmelCase = None    ,							__UpperCAmelCase = False    ,							__UpperCAmelCase = False    ,							__UpperCAmelCase = False    ,							__UpperCAmelCase = False    ,							__UpperCAmelCase = False    ,							__UpperCAmelCase = True    ,							__UpperCAmelCase = None    ,							**__UpperCAmelCase    ,							):
										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_	:							List[Any]											=self.tokenizer
																	SCREAMING_SNAKE_CASE_	:							Optional[Any]											=self.tokenizer(
																	    text=__SCREAMING_SNAKE_CASE    ,							add_special_tokens=__SCREAMING_SNAKE_CASE    ,							padding=__SCREAMING_SNAKE_CASE    ,							truncation=__SCREAMING_SNAKE_CASE    ,							max_length=__SCREAMING_SNAKE_CASE    ,							stride=__SCREAMING_SNAKE_CASE    ,							pad_to_multiple_of=__SCREAMING_SNAKE_CASE    ,							return_attention_mask=__SCREAMING_SNAKE_CASE    ,							return_overflowing_tokens=__SCREAMING_SNAKE_CASE    ,							return_special_tokens_mask=__SCREAMING_SNAKE_CASE    ,							return_offsets_mapping=__SCREAMING_SNAKE_CASE    ,							return_token_type_ids=__SCREAMING_SNAKE_CASE    ,							return_length=__SCREAMING_SNAKE_CASE    ,							verbose=__SCREAMING_SNAKE_CASE    ,							return_tensors=__SCREAMING_SNAKE_CASE    ,							**__SCREAMING_SNAKE_CASE    ,							)
																	return text_encoding

										# add pixel_values
										SCREAMING_SNAKE_CASE_	:							Optional[int]											=self.image_processor(__SCREAMING_SNAKE_CASE    ,							return_tensors=__SCREAMING_SNAKE_CASE  )

										if text is not None:
																	SCREAMING_SNAKE_CASE_	:							Optional[Any]											=self.tokenizer(
																	    text=__SCREAMING_SNAKE_CASE    ,							add_special_tokens=__SCREAMING_SNAKE_CASE    ,							padding=__SCREAMING_SNAKE_CASE    ,							truncation=__SCREAMING_SNAKE_CASE    ,							max_length=__SCREAMING_SNAKE_CASE    ,							stride=__SCREAMING_SNAKE_CASE    ,							pad_to_multiple_of=__SCREAMING_SNAKE_CASE    ,							return_attention_mask=__SCREAMING_SNAKE_CASE    ,							return_overflowing_tokens=__SCREAMING_SNAKE_CASE    ,							return_special_tokens_mask=__SCREAMING_SNAKE_CASE    ,							return_offsets_mapping=__SCREAMING_SNAKE_CASE    ,							return_token_type_ids=__SCREAMING_SNAKE_CASE    ,							return_length=__SCREAMING_SNAKE_CASE    ,							verbose=__SCREAMING_SNAKE_CASE    ,							return_tensors=__SCREAMING_SNAKE_CASE    ,							**__SCREAMING_SNAKE_CASE    ,							)
										else:
																	SCREAMING_SNAKE_CASE_	:							Optional[Any]											=None

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

										return encoding_image_processor







			def      __lowerCamelCase    (	self    ,							*__UpperCAmelCase    ,							**__UpperCAmelCase  ):
										return self.tokenizer.batch_decode(*__SCREAMING_SNAKE_CASE    ,							**__SCREAMING_SNAKE_CASE  )







			def      __lowerCamelCase    (	self    ,							*__UpperCAmelCase    ,							**__UpperCAmelCase  ):
										return self.tokenizer.decode(*__SCREAMING_SNAKE_CASE    ,							**__SCREAMING_SNAKE_CASE  )







			@property
			def      __lowerCamelCase    (	self  ):
										SCREAMING_SNAKE_CASE_	:							Optional[int]											=self.tokenizer.model_input_names
										SCREAMING_SNAKE_CASE_	:							int											=self.image_processor.model_input_names
										return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names  )  )






from typing import TYPE_CHECKING

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


SCREAMING_SNAKE_CASE			:						Optional[int]				  =		{
    """configuration_mctct""": ["""MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MCTCTConfig"""],
    """feature_extraction_mctct""": ["""MCTCTFeatureExtractor"""],
    """processing_mctct""": ["""MCTCTProcessor"""],
}


try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  SCREAMING_SNAKE_CASE			:						Optional[Any]				  =		[
      """MCTCT_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """MCTCTForCTC""",
      """MCTCTModel""",
      """MCTCTPreTrainedModel""",
  ]


if TYPE_CHECKING:
  from .configuration_mctct import MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP, MCTCTConfig
  from .feature_extraction_mctct import MCTCTFeatureExtractor
  from .processing_mctct import MCTCTProcessor

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_mctct import MCTCT_PRETRAINED_MODEL_ARCHIVE_LIST, MCTCTForCTC, MCTCTModel, MCTCTPreTrainedModel

else:
  import sys

  SCREAMING_SNAKE_CASE			:						Union[str, Any]				  =		_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)


