import warnings

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




class        _UpperCamelCase				(						_UpperCAmelCase			):


			"""simple docstring"""






			__a  :			Union[str, Any]      			=						['''image_processor''', '''tokenizer''']
			__a  :			int      			=						'''VideoMAEImageProcessor'''
			__a  :			int      			=						('''CLIPTokenizer''', '''CLIPTokenizerFast''')





			def __init__(       self				,       lowerCAmelCase__=None				,       lowerCAmelCase__=None				,       **lowerCAmelCase__						)					-> int:

							'''simple docstring'''


							__lowercase			      =							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__				,       )
											__lowercase			      =							kwargs.pop('''feature_extractor'''						)

							__lowercase			      =							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__						)
							__lowercase			      =							self.image_processor





			def __call__(       self				,       lowerCAmelCase__=None				,       lowerCAmelCase__=None				,       lowerCAmelCase__=None				,       **lowerCAmelCase__						)					-> List[Any]:

							'''simple docstring'''


							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:
											__lowercase			      =							self.tokenizer(lowerCAmelCase__				,       return_tensors=lowerCAmelCase__				,       **lowerCAmelCase__						)

							if videos is not None:
											__lowercase			      =							self.image_processor(lowerCAmelCase__				,       return_tensors=lowerCAmelCase__				,       **lowerCAmelCase__						)

							if text is not None and videos is not None:
											__lowercase			      =							image_features.pixel_values
											return encoding
							elif text is not None:
											return encoding
							else:
											return BatchEncoding(data=dict(**lowerCAmelCase__						)				,       tensor_type=lowerCAmelCase__						)





			def 	_SCREAMING_SNAKE_CASE      (       self				,       *lowerCAmelCase__				,       **lowerCAmelCase__						)					-> List[Any]:

							'''simple docstring'''


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





			def 	_SCREAMING_SNAKE_CASE      (       self				,       *lowerCAmelCase__				,       **lowerCAmelCase__						)					-> List[Any]:

							'''simple docstring'''


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





			@property
			def 	_SCREAMING_SNAKE_CASE      (       self						)					-> List[Any]:

							'''simple docstring'''


							return ["input_ids", "attention_mask", "position_ids", "pixel_values"]





			@property
			def 	_SCREAMING_SNAKE_CASE      (       self						)					-> Dict:

							'''simple docstring'''


							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 	_SCREAMING_SNAKE_CASE      (       self						)					-> List[str]:

							'''simple docstring'''


							warnings.warn(
							    '''`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead.'''				,       lowerCAmelCase__				,       )
							return self.image_processor
from typing import TypeVar

from .arrow_dataset import Dataset, _split_by_node_map_style_dataset
from .iterable_dataset import IterableDataset, _split_by_node_iterable_dataset


__a  :					Union[str, Any]          =  TypeVar("""DatasetType""", Dataset, IterableDataset)





def     UpperCAmelCase						(   lowercase							,      lowercase							,      lowercase							):







				"""simple docstring"""



				if isinstance(lowercase							,      lowercase							):
								return _split_by_node_map_style_dataset(lowercase							,      rank=lowercase							,      world_size=lowercase							)
				else:
								return _split_by_node_iterable_dataset(lowercase							,      rank=lowercase							,      world_size=lowercase							)