

"""simple docstring"""




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   __lowercase      (     __lowerCamelCase       ):
  snake_case_												=							["""image_processor""", """tokenizer"""]
  snake_case_												=							"""BlipImageProcessor"""
  snake_case_												=							("""BertTokenizer""", """BertTokenizerFast""")

  def __init__(	self		:      Union[str, Any]       ,A		:      List[Any]       ,A		:      Union[str, Any]     ):






   '''simple docstring'''
   UpperCAmelCase__       :	Dict        =       False
   super().__init__(lowerCamelCase_       ,lowerCamelCase_     )
   UpperCAmelCase__       :	Tuple        =       self.image_processor

  def __call__(	self		:      Union[str, Any]       ,A		:      str = None       ,A		:      List[Any] = None       ,A		:      Optional[Any] = True       ,A		:      Optional[int] = False       ,A		:      Dict = None       ,A		:      int = None       ,A		:      List[Any] = 0       ,A		:      Optional[int] = None       ,A		:      Optional[int] = None       ,A		:      int = False       ,A		:      Any = False       ,A		:      str = False       ,A		:      List[str] = False       ,A		:      Union[str, Any] = False       ,A		:      str = True       ,A		:      Union[str, Any] = None       ,**A		:      Tuple       ,):






   '''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:
    UpperCAmelCase__       :	List[Any]        =       self.tokenizer
    UpperCAmelCase__       :	Any        =       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__       :	Optional[int]        =       self.image_processor(lowerCamelCase_       ,return_tensors=lowerCamelCase_     )

   if text is not None:
    UpperCAmelCase__       :	Any        =       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__       :	Tuple        =       None

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

   return encoding_image_processor

  def  __lowercase							(	self		:      List[Any]       ,*A		:      List[Any]       ,**A		:      int     ):






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

  def  __lowercase							(	self		:      Any       ,*A		:      int       ,**A		:      Union[str, Any]     ):






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




  @property
  def  __lowercase							(	self		:      str     ):






   '''simple docstring'''
   UpperCAmelCase__       :	Tuple        =       self.tokenizer.model_input_names
   UpperCAmelCase__       :	Union[str, Any]        =       self.image_processor.model_input_names
   return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names     )     )








"""simple docstring"""


from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


UpperCAmelCase													={
    "configuration_informer": [
        "INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "InformerConfig",
    ],
}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase													=[
      "INFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
      "InformerForPrediction",
      "InformerModel",
      "InformerPreTrainedModel",
  ]


if TYPE_CHECKING:
  from .configuration_informer import INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, InformerConfig

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_informer import (
        INFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
        InformerForPrediction,
        InformerModel,
        InformerPreTrainedModel,
    )

else:
  import sys

  UpperCAmelCase													=_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)




