




import warnings

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







class 					lowerCAmelCase__	(    _a):




     '''simple docstring'''
     __SCREAMING_SNAKE_CASE        =			["image_processor", "tokenizer"]
     __SCREAMING_SNAKE_CASE        =			"VideoMAEImageProcessor"
     __SCREAMING_SNAKE_CASE        =			("CLIPTokenizer", "CLIPTokenizerFast")


     def __init__(						self			,						__lowerCamelCase=None			,						__lowerCamelCase=None			,						**__lowerCamelCase)      ->    Optional[Any]:
            _A				:	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."			,						__lowerCamelCase			,						)
                   _A				:	Optional[int]       =			kwargs.pop("feature_extractor")

            _A				:	Optional[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)
            _A				:	List[Any]       =			self.image_processor


     def __call__(						self			,						__lowerCamelCase=None			,						__lowerCamelCase=None			,						__lowerCamelCase=None			,						**__lowerCamelCase)      ->    Tuple:

            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:
                   _A				:	Optional[int]       =			self.tokenizer(__lowerCamelCase			,						return_tensors=__lowerCamelCase			,						**__lowerCamelCase)

            if videos is not None:
                   _A				:	List[str]       =			self.image_processor(__lowerCamelCase			,						return_tensors=__lowerCamelCase			,						**__lowerCamelCase)

            if text is not None and videos is not None:
                   _A				:	int       =			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			,						*__lowerCamelCase			,						**__lowerCamelCase)      ->    Union[str, Any]:
            return self.tokenizer.batch_decode(*__lowerCamelCase			,						**__lowerCamelCase)


     def 			_lowerCamelCase			(						self			,						*__lowerCamelCase			,						**__lowerCamelCase)      ->    Dict:
            return self.tokenizer.decode(*__lowerCamelCase			,						**__lowerCamelCase)


     @property
     def 			_lowerCamelCase			(						self)      ->    Tuple:
            return ["input_ids", "attention_mask", "position_ids", "pixel_values"]


     @property
     def 			_lowerCamelCase			(						self)      ->    Dict:
            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)      ->    str:
            warnings.warn(
                "`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead."			,						__lowerCamelCase			,						)
            return self.image_processor




from typing import List

import datasets
from datasets.tasks import ImageClassification

from ..folder_based_builder import folder_based_builder


lowerCAmelCase__						=			datasets.utils.logging.get_logger(__name__)







class 					lowerCAmelCase__	(    folder_based_builder.FolderBasedBuilderConfig):




     '''simple docstring'''
     __SCREAMING_SNAKE_CASE        =			None
     __SCREAMING_SNAKE_CASE        =			None







class 					lowerCAmelCase__	(    folder_based_builder.FolderBasedBuilder):




     '''simple docstring'''
     __SCREAMING_SNAKE_CASE        =			datasets.Image()
     __SCREAMING_SNAKE_CASE        =			"image"
     __SCREAMING_SNAKE_CASE        =			ImageFolderConfig
     __SCREAMING_SNAKE_CASE        =			42  # definition at the bottom of the script
     __SCREAMING_SNAKE_CASE        =			ImageClassification(image_column="image"					,   label_column="label")




lowerCAmelCase__						=			[
    '.blp',
    '.bmp',
    '.dib',
    '.bufr',
    '.cur',
    '.pcx',
    '.dcx',
    '.dds',
    '.ps',
    '.eps',
    '.fit',
    '.fits',
    '.fli',
    '.flc',
    '.ftc',
    '.ftu',
    '.gbr',
    '.gif',
    '.grib',
    '.h5',
    '.hdf',
    '.png',
    '.apng',
    '.jp2',
    '.j2k',
    '.jpc',
    '.jpf',
    '.jpx',
    '.j2c',
    '.icns',
    '.ico',
    '.im',
    '.iim',
    '.tif',
    '.tiff',
    '.jfif',
    '.jpe',
    '.jpg',
    '.jpeg',
    '.mpg',
    '.mpeg',
    '.msp',
    '.pcd',
    '.pxr',
    '.pbm',
    '.pgm',
    '.ppm',
    '.pnm',
    '.psd',
    '.bw',
    '.rgb',
    '.rgba',
    '.sgi',
    '.ras',
    '.tga',
    '.icb',
    '.vda',
    '.vst',
    '.webp',
    '.wmf',
    '.emf',
    '.xbm',
    '.xpm',
]
lowerCAmelCase__						=			IMAGE_EXTENSIONS
