


'''simple docstring'''

import warnings

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





class   snake_case					(					__UpperCAmelCase    ):





		"""simple docstring"""




		_lowerCamelCase						=						["image_processor", "tokenizer"]
		_lowerCamelCase						=						"ChineseCLIPImageProcessor"
		_lowerCamelCase						=						("BertTokenizer", "BertTokenizerFast")






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







			"""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."    ,						UpperCamelCase    ,						)
				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__(UpperCamelCase    ,						UpperCamelCase  )
			lowerCamelCase_  				=						self.image_processor






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







			"""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(UpperCamelCase    ,						return_tensors=UpperCamelCase    ,						**UpperCamelCase  )

			if images is not None:
				lowerCamelCase_  				=						self.image_processor(UpperCamelCase    ,						return_tensors=UpperCamelCase    ,						**UpperCamelCase  )

			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(**UpperCamelCase  )    ,						tensor_type=UpperCamelCase  )






		def 						snake_case	(					self    ,						*UpperCamelCase    ,						**UpperCamelCase  ):







			"""simple docstring"""
			return self.tokenizer.batch_decode(*UpperCamelCase    ,						**UpperCamelCase  )






		def 						snake_case	(					self    ,						*UpperCamelCase    ,						**UpperCamelCase  ):







			"""simple docstring"""
			return self.tokenizer.decode(*UpperCamelCase    ,						**UpperCamelCase  )






		@property
		def 						snake_case	(					self  ):







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







		@property
		def 						snake_case	(					self  ):







			"""simple docstring"""
			warnings.warn(
			    "`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."    ,						UpperCamelCase    ,						)
			return self.image_processor_class







'''simple docstring'''

from typing import TYPE_CHECKING

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


a_						:       List[Any]      			=				{
    """configuration_owlvit""": [
        """OWLVIT_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """OwlViTConfig""",
        """OwlViTOnnxConfig""",
        """OwlViTTextConfig""",
        """OwlViTVisionConfig""",
    ],
    """processing_owlvit""": ["""OwlViTProcessor"""],
}


try:
     if not is_vision_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     a_						:       int      			=				["""OwlViTFeatureExtractor"""]
     a_						:       Any      			=				["""OwlViTImageProcessor"""]

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     a_						:       Tuple      			=				[
         """OWLVIT_PRETRAINED_MODEL_ARCHIVE_LIST""",
         """OwlViTModel""",
         """OwlViTPreTrainedModel""",
         """OwlViTTextModel""",
         """OwlViTVisionModel""",
         """OwlViTForObjectDetection""",
     ]

if TYPE_CHECKING:
     from .configuration_owlvit import (
         OWLVIT_PRETRAINED_CONFIG_ARCHIVE_MAP,
         OwlViTConfig,
         OwlViTOnnxConfig,
         OwlViTTextConfig,
         OwlViTVisionConfig,
     )
     from .processing_owlvit import OwlViTProcessor

     try:
          if not is_vision_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .feature_extraction_owlvit import OwlViTFeatureExtractor
          from .image_processing_owlvit import OwlViTImageProcessor

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_owlvit import (
              OWLVIT_PRETRAINED_MODEL_ARCHIVE_LIST,
              OwlViTForObjectDetection,
              OwlViTModel,
              OwlViTPreTrainedModel,
              OwlViTTextModel,
              OwlViTVisionModel,
          )

else:
     import sys

     a_						:       Tuple      			=				_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)



