





import warnings

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





class UpperCAmelCase_							(   _SCREAMING_SNAKE_CASE   ):
  __lowerCAmelCase      :	Optional[Any]  	=      ["""image_processor""", """tokenizer"""]
  __lowerCAmelCase      :	Union[str, Any]  	=      """AutoImageProcessor"""
  __lowerCAmelCase      :	Any  	=      """AutoTokenizer"""


  def __init__(       self   ,__snake_case=None   ,__snake_case=None   ,**__snake_case   ):



       """simple docstring"""





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

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

       super().__init__(__snake_case   ,__snake_case   )
       A_					      =					self.image_processor


  def __call__(       self   ,__snake_case=None   ,__snake_case=None   ,__snake_case=None   ,**__snake_case   ):



       """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:
            A_					      =					self.tokenizer(__snake_case   ,return_tensors=__snake_case   ,**__snake_case   )

       if images is not None:
            A_					      =					self.image_processor(__snake_case   ,return_tensors=__snake_case   ,**__snake_case   )

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


  def 	__UpperCAmelCase    (       self   ,*__snake_case   ,**__snake_case   ):



       """simple docstring"""





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


  def 	__UpperCAmelCase    (       self   ,*__snake_case   ,**__snake_case   ):



       """simple docstring"""





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


  @property
  def 	__UpperCAmelCase    (       self   ):



       """simple docstring"""





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


  @property
  def 	__UpperCAmelCase    (       self   ):



       """simple docstring"""





       warnings.warn(
           '''`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead.'''   ,__snake_case   ,)
       return self.image_processor_class




  @property
  def 	__UpperCAmelCase    (       self   ):



       """simple docstring"""





       warnings.warn(
           '''`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead.'''   ,__snake_case   ,)
       return self.image_processor






from typing import TYPE_CHECKING

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


a__			:    Tuple			      =		{'configuration_yoso': ['YOSO_PRETRAINED_CONFIG_ARCHIVE_MAP', 'YosoConfig']}

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      a__			:    Optional[int]			      =		[
          'YOSO_PRETRAINED_MODEL_ARCHIVE_LIST',
          'YosoForMaskedLM',
          'YosoForMultipleChoice',
          'YosoForQuestionAnswering',
          'YosoForSequenceClassification',
          'YosoForTokenClassification',
          'YosoLayer',
          'YosoModel',
          'YosoPreTrainedModel',
      ]


if TYPE_CHECKING:
      from .configuration_yoso import YOSO_PRETRAINED_CONFIG_ARCHIVE_MAP, YosoConfig

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_yoso import (
                YOSO_PRETRAINED_MODEL_ARCHIVE_LIST,
                YosoForMaskedLM,
                YosoForMultipleChoice,
                YosoForQuestionAnswering,
                YosoForSequenceClassification,
                YosoForTokenClassification,
                YosoLayer,
                YosoModel,
                YosoPreTrainedModel,
            )


else:
      import sys

      a__			:    Union[str, Any]			      =		_LazyModule(__name__, globals()['__file__'], _import_structure)



