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__				(       UpperCAmelCase__			):
     lowerCamelCase  :					Any							=["image_processor", "tokenizer"]
     lowerCamelCase  :					Union[str, Any]							="BlipImageProcessor"
     lowerCamelCase  :					Optional[Any]							=("BertTokenizer", "BertTokenizerFast")






     def __init__(			self		:		Tuple  ,    a		:		str  ,    a		:		Union[str, Any]   ):





         """simple docstring"""



         __lowerCamelCase          =  False
         super().__init__(a  ,    a   )
         __lowerCamelCase          =  self.image_processor






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





         """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=a  ,    add_special_tokens=a  ,    padding=a  ,    truncation=a  ,    max_length=a  ,    stride=a  ,    pad_to_multiple_of=a  ,    return_attention_mask=a  ,    return_overflowing_tokens=a  ,    return_special_tokens_mask=a  ,    return_offsets_mapping=a  ,    return_token_type_ids=a  ,    return_length=a  ,    verbose=a  ,    return_tensors=a  ,    **a  ,    )
             return text_encoding

         # add pixel_values
         __lowerCamelCase          =  self.image_processor(a  ,    return_tensors=a   )

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

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

         return encoding_image_processor






     def        SCREAMING_SNAKE_CASE__       (			self		:		List[str]  ,    *a		:		Tuple  ,    **a		:		str   ):





         """simple docstring"""



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






     def        SCREAMING_SNAKE_CASE__       (			self		:		Optional[Any]  ,    *a		:		int  ,    **a		:		Optional[Any]   ):





         """simple docstring"""



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






     @property
     def        SCREAMING_SNAKE_CASE__       (			self		:		List[str]   ):





         """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   )   )

'''simple docstring'''




from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


__UpperCAmelCase												={
    "configuration_whisper": ["WHISPER_PRETRAINED_CONFIG_ARCHIVE_MAP", "WhisperConfig", "WhisperOnnxConfig"],
    "feature_extraction_whisper": ["WhisperFeatureExtractor"],
    "processing_whisper": ["WhisperProcessor"],
    "tokenization_whisper": ["WhisperTokenizer"],
}

try:
  if not is_tokenizers_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __UpperCAmelCase												=["WhisperTokenizerFast"]

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __UpperCAmelCase												=[
      "WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST",
      "WhisperForConditionalGeneration",
      "WhisperModel",
      "WhisperPreTrainedModel",
      "WhisperForAudioClassification",
  ]

try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __UpperCAmelCase												=[
      "TF_WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST",
      "TFWhisperForConditionalGeneration",
      "TFWhisperModel",
      "TFWhisperPreTrainedModel",
  ]

try:
  if not is_flax_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __UpperCAmelCase												=[
      "FlaxWhisperForConditionalGeneration",
      "FlaxWhisperModel",
      "FlaxWhisperPreTrainedModel",
      "FlaxWhisperForAudioClassification",
  ]


if TYPE_CHECKING:
  from .configuration_whisper import WHISPER_PRETRAINED_CONFIG_ARCHIVE_MAP, WhisperConfig, WhisperOnnxConfig
  from .feature_extraction_whisper import WhisperFeatureExtractor
  from .processing_whisper import WhisperProcessor
  from .tokenization_whisper import WhisperTokenizer

  try:
    if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_whisper_fast import WhisperTokenizerFast

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_whisper import (
        WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST,
        WhisperForAudioClassification,
        WhisperForConditionalGeneration,
        WhisperModel,
        WhisperPreTrainedModel,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_whisper import (
        TF_WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST,
        TFWhisperForConditionalGeneration,
        TFWhisperModel,
        TFWhisperPreTrainedModel,
    )

  try:
    if not is_flax_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_flax_whisper import (
        FlaxWhisperForAudioClassification,
        FlaxWhisperForConditionalGeneration,
        FlaxWhisperModel,
        FlaxWhisperPreTrainedModel,
    )

else:
  import sys

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