"""simple docstring"""




import warnings

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding
class 		__A							(				SCREAMING_SNAKE_CASE_	):
     _UpperCamelCase							:    int	      =	["image_processor", "tokenizer"]
     _UpperCamelCase							:    Dict	      =	"ChineseCLIPImageProcessor"
     _UpperCamelCase							:    List[str]	      =	("BertTokenizer", "BertTokenizerFast")






     def __init__(	self       ,  a__=None       ,  a__=None       ,  **a__						):
       _lowerCAmelCase		: Optional[int]						    =  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		: List[str]						    =  kwargs.pop("""feature_extractor"""						)

       _lowerCAmelCase		: Dict						    =  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__						)
       _lowerCAmelCase		: Any						    =  self.image_processor






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

       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		: List[str]						    =  self.tokenizer(a__       ,  return_tensors=a__       ,  **a__						)

       if images is not None:
         _lowerCAmelCase		: str						    =  self.image_processor(a__       ,  return_tensors=a__       ,  **a__						)

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






     def 					__A						(	self       ,  *a__       ,  **a__						):
       return self.tokenizer.batch_decode(*a__       ,  **a__						)






     def 					__A						(	self       ,  *a__       ,  **a__						):
       return self.tokenizer.decode(*a__       ,  **a__						)






     @property
     def 					__A						(	self						):
       _lowerCAmelCase		: Any						    =  self.tokenizer.model_input_names
       _lowerCAmelCase		: Tuple						    =  self.image_processor.model_input_names
       return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names						)						)






     @property
     def 					__A						(	self						):
       warnings.warn(
           """`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."""       ,  a__       ,  )
       return self.image_processor_class


"""simple docstring"""




from ...utils import (
    OptionalDependencyNotAvailable,
    is_torch_available,
    is_transformers_available,
    is_transformers_version,
)


try:
     if not (is_transformers_available() and is_torch_available() and is_transformers_version('>=', '4.25.0')):
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     from ...utils.dummy_torch_and_transformers_objects import UnCLIPImageVariationPipeline, UnCLIPPipeline
else:
     from .pipeline_unclip import UnCLIPPipeline
     from .pipeline_unclip_image_variation import UnCLIPImageVariationPipeline
     from .text_proj import UnCLIPTextProjModel




