'''simple docstring'''




import warnings

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding




class    a__				(       UpperCAmelCase__			):
     lowerCamelCase  :					str							=["image_processor", "tokenizer"]
     lowerCamelCase  :					Optional[Any]							="CLIPImageProcessor"
     lowerCamelCase  :					Union[str, Any]							=("XLMRobertaTokenizer", "XLMRobertaTokenizerFast")






     def __init__(			self		:		List[Any]  ,    a		:		int=None  ,    a		:		Tuple=None  ,    **a		:		Any   ):





         """simple docstring"""



         __lowerCamelCase          =  None
         if "feature_extractor" in kwargs:
             warnings.warn(
                 '''The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`'''
                 ''' instead.'''  ,    a  ,    )
             __lowerCamelCase          =  kwargs.pop('''feature_extractor'''   )

         __lowerCamelCase          =  image_processor if image_processor is not None else feature_extractor
         if image_processor is None:
             raise ValueError('''You need to specify an `image_processor`.'''   )
         if tokenizer is None:
             raise ValueError('''You need to specify a `tokenizer`.'''   )

         super().__init__(a  ,    a   )






     def __call__(			self		:		List[str]  ,    a		:		Tuple=None  ,    a		:		Dict=None  ,    a		:		Union[str, Any]=None  ,    **a		:		Tuple   ):





         """simple docstring"""



         if text is None and images is None:
             raise ValueError('''You have to specify either text or images. Both cannot be none.'''   )

         if text is not None:
             __lowerCamelCase          =  self.tokenizer(a  ,    return_tensors=a  ,    **a   )

         if images is not None:
             __lowerCamelCase          =  self.image_processor(a  ,    return_tensors=a  ,    **a   )

         if text is not None and images is not None:
             __lowerCamelCase          =  image_features.pixel_values
             return encoding
         elif text is not None:
             return encoding
         else:
             return BatchEncoding(data=dict(**a   )  ,    tensor_type=a   )






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





         """simple docstring"""



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






     def        SCREAMING_SNAKE_CASE__       (			self		:		Optional[Any]  ,    *a		:		Tuple  ,    **a		:		Union[str, Any]   ):





         """simple docstring"""



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






     @property
     def        SCREAMING_SNAKE_CASE__       (			self		:		Optional[Any]   ):





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