




import warnings

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





class        lowerCamelCase__(   __UpperCamelCase):
      UpperCAmelCase__ :      Optional[Any]       						=  ["image_processor", "tokenizer"]
      UpperCAmelCase__ :      Dict       						=  "VideoMAEImageProcessor"
      UpperCAmelCase__ :      Tuple       						=  ("CLIPTokenizer", "CLIPTokenizerFast")
      def __init__(							self:					str       ,			UpperCamelCase_:					Tuple=None       ,			UpperCamelCase_:					Any=None       ,			**UpperCamelCase_:					Union[str, Any]  ):
             __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."""       ,			_lowerCAmelCase       ,			)
                    __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__(_lowerCAmelCase       ,			_lowerCAmelCase  )
             __lowerCamelCase  =		self.image_processor
      def __call__(							self:					str       ,			UpperCamelCase_:					int=None       ,			UpperCamelCase_:					Dict=None       ,			UpperCamelCase_:					Optional[int]=None       ,			**UpperCamelCase_:					List[str]  ):

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

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

             if videos is not None:
                    __lowerCamelCase  =		self.image_processor(_lowerCAmelCase       ,			return_tensors=_lowerCAmelCase       ,			**_lowerCAmelCase  )

             if text is not None and videos is not None:
                    __lowerCamelCase  =		image_features.pixel_values
                    return encoding
             elif text is not None:
                    return encoding
             else:
                    return BatchEncoding(data=dict(**_lowerCAmelCase  )       ,			tensor_type=_lowerCAmelCase  )
      def      lowerCAmelCase__		(							self:					Tuple       ,			*UpperCamelCase_:					str       ,			**UpperCamelCase_:					List[Any]  ):
             return self.tokenizer.batch_decode(*_lowerCAmelCase       ,			**_lowerCAmelCase  )
      def      lowerCAmelCase__		(							self:					Tuple       ,			*UpperCamelCase_:					List[Any]       ,			**UpperCamelCase_:					Dict  ):
             return self.tokenizer.decode(*_lowerCAmelCase       ,			**_lowerCAmelCase  )
      @property
      def      lowerCAmelCase__		(							self:					str  ):
             return ["input_ids", "attention_mask", "position_ids", "pixel_values"]
      @property
      def      lowerCAmelCase__		(							self:					str  ):
             warnings.warn(
                 """`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."""       ,			_lowerCAmelCase       ,			)
             return self.image_processor_class




      @property
      def      lowerCAmelCase__		(							self:					Union[str, Any]  ):
             warnings.warn(
                 """`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead."""       ,			_lowerCAmelCase       ,			)
             return self.image_processor


import warnings

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







class      SCREAMING_SNAKE_CASE__					(  __UpperCamelCase    ):
       A							:	Optional[Any]          =	["image_processor", "tokenizer"]
       A							:	Dict          =	"VideoMAEImageProcessor"
       A							:	Tuple          =	("CLIPTokenizer", "CLIPTokenizerFast")

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

           __snake_case       :				int 			=    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__(_lowerCAmelCase			,			_lowerCAmelCase			)
           __snake_case       :				Optional[Any] 			=    self.image_processor

       def __call__(							self					:     str			,			_lowerCAmelCase					:     int=None			,			_lowerCAmelCase					:     Dict=None			,			_lowerCAmelCase					:     Optional[int]=None			,			**_lowerCAmelCase					:     List[str]			):

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

           if text is not None:
               __snake_case       :				Optional[Any] 			=    self.tokenizer(_lowerCAmelCase			,			return_tensors=_lowerCAmelCase			,			**_lowerCAmelCase			)

           if videos is not None:
               __snake_case       :				Optional[int] 			=    self.image_processor(_lowerCAmelCase			,			return_tensors=_lowerCAmelCase			,			**_lowerCAmelCase			)

           if text is not None and videos is not None:
               __snake_case       :				Union[str, Any] 			=    image_features.pixel_values
               return encoding
           elif text is not None:
               return encoding
           else:
               return BatchEncoding(data=dict(**_lowerCAmelCase			)			,			tensor_type=_lowerCAmelCase			)

       def 			snake_case__    (							self					:     Tuple			,			*_lowerCAmelCase					:     str			,			**_lowerCAmelCase					:     List[Any]			):
           return self.tokenizer.batch_decode(*_lowerCAmelCase			,			**_lowerCAmelCase			)

       def 			snake_case__    (							self					:     Tuple			,			*_lowerCAmelCase					:     List[Any]			,			**_lowerCAmelCase					:     Dict			):
           return self.tokenizer.decode(*_lowerCAmelCase			,			**_lowerCAmelCase			)

       @property
       def 			snake_case__    (							self					:     str			):
           return ["input_ids", "attention_mask", "position_ids", "pixel_values"]

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





       @property
       def 			snake_case__    (							self					:     Union[str, Any]			):
           warnings.warn(
               """`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead."""			,			_lowerCAmelCase			,			)
           return self.image_processor



