
'''simple docstring'''







from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


_lowercase					:    Any       				=			{
    "configuration_videomae": ["VIDEOMAE_PRETRAINED_CONFIG_ARCHIVE_MAP", "VideoMAEConfig"],
}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							_lowercase					:    Any       				=			[
							    "VIDEOMAE_PRETRAINED_MODEL_ARCHIVE_LIST",
							    "VideoMAEForPreTraining",
							    "VideoMAEModel",
							    "VideoMAEPreTrainedModel",
							    "VideoMAEForVideoClassification",
							]

try:
							if not is_vision_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							_lowercase					:    Any       				=			["VideoMAEFeatureExtractor"]
							_lowercase					:    List[Any]       				=			["VideoMAEImageProcessor"]

if TYPE_CHECKING:
							from .configuration_videomae import VIDEOMAE_PRETRAINED_CONFIG_ARCHIVE_MAP, VideoMAEConfig

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_videomae import (
														    VIDEOMAE_PRETRAINED_MODEL_ARCHIVE_LIST,
														    VideoMAEForPreTraining,
														    VideoMAEForVideoClassification,
														    VideoMAEModel,
														    VideoMAEPreTrainedModel,
														)

							try:
														if not is_vision_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .feature_extraction_videomae import VideoMAEFeatureExtractor
														from .image_processing_videomae import VideoMAEImageProcessor

else:
							import sys

							_lowercase					:    List[str]       				=			_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)





'''simple docstring'''







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






class 					lowerCAmelCase__  (    lowerCamelCase_	):
					lowerCAmelCase_	  =	['''image_processor''', '''tokenizer''']
					lowerCAmelCase_	  =	'''EfficientNetImageProcessor'''
					lowerCAmelCase_	  =	('''BertTokenizer''', '''BertTokenizerFast''')






					def __init__(  self							,				__SCREAMING_SNAKE_CASE							,				__SCREAMING_SNAKE_CASE						):


											"""simple docstring"""





											super().__init__(__SCREAMING_SNAKE_CASE							,				__SCREAMING_SNAKE_CASE						)






					def __call__(  self							,				__SCREAMING_SNAKE_CASE=None							,				__SCREAMING_SNAKE_CASE=None							,				__SCREAMING_SNAKE_CASE="max_length"							,				__SCREAMING_SNAKE_CASE=64							,				__SCREAMING_SNAKE_CASE=None							,				**__SCREAMING_SNAKE_CASE						):


											"""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:
																	lowercase_      :	str						=			self.tokenizer(
																	    __SCREAMING_SNAKE_CASE							,				padding=__SCREAMING_SNAKE_CASE							,				max_length=__SCREAMING_SNAKE_CASE							,				return_tensors=__SCREAMING_SNAKE_CASE							,				**__SCREAMING_SNAKE_CASE						)

											if images is not None:
																	lowercase_      :	int						=			self.image_processor(__SCREAMING_SNAKE_CASE							,				return_tensors=__SCREAMING_SNAKE_CASE							,				**__SCREAMING_SNAKE_CASE						)

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






					def       _snake_case       (  self							,				*__SCREAMING_SNAKE_CASE							,				**__SCREAMING_SNAKE_CASE						):


											"""simple docstring"""





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






					def       _snake_case       (  self							,				*__SCREAMING_SNAKE_CASE							,				**__SCREAMING_SNAKE_CASE						):


											"""simple docstring"""





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






					@property
					def       _snake_case       (  self						):


											"""simple docstring"""





											lowercase_      :	Dict						=			self.tokenizer.model_input_names
											lowercase_      :	Optional[int]						=			self.image_processor.model_input_names
											return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names						)						)



