





import warnings

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

class 		snake_case_      (       UpperCAmelCase_	):







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




	def __init__(	self       :    Optional[Any]				,			__lowerCamelCase       :    Optional[int]=None				,			__lowerCamelCase       :    Union[str, Any]=None				,			**__lowerCamelCase       :    Any      )					->   List[Any]:

			'''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       :    List[Any]				,			__lowerCamelCase       :    List[Any]=None				,			__lowerCamelCase       :    Any=None				,			__lowerCamelCase       :    List[Any]=None				,			**__lowerCamelCase       :    Union[str, Any]      )					->   Tuple:

			'''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       UpperCAmelCase (	self       :    str				,			*__lowerCamelCase       :    Optional[int]				,			**__lowerCamelCase       :    str      )					->   Tuple:

			'''simple docstring'''




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




	def       UpperCAmelCase (	self       :    List[str]				,			*__lowerCamelCase       :    Optional[int]				,			**__lowerCamelCase       :    Union[str, Any]      )					->   Optional[int]:

			'''simple docstring'''




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




	@property
	def       UpperCAmelCase (	self       :    List[str]      )					->   Dict:

			'''simple docstring'''




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




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

			'''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       UpperCAmelCase (	self       :    int      )					->   List[Any]:

			'''simple docstring'''




			warnings.warn(
			    '`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead.'				,			__lowerCamelCase				,			)
			return self.image_processor











import torch
import torch.nn.functional as F

from diffusers import VQDiffusionScheduler

from .test_schedulers import SchedulerCommonTest

class 		snake_case_      (       UpperCAmelCase_	):







	'''simple docstring'''
	__UpperCamelCase        =		(VQDiffusionScheduler,)




	def       UpperCAmelCase (	self       :    int				,			**__lowerCamelCase       :    List[Any]      )					->   Tuple:

			'''simple docstring'''




			__lowercase					=    {
			    'num_vec_classes': 4_097,
			    'num_train_timesteps': 100,
			}

			config.update(**__lowerCamelCase      )
			return config




	def       UpperCAmelCase (	self       :    List[Any]				,			__lowerCamelCase       :    List[str]      )					->   Tuple:

			'''simple docstring'''




			__lowercase					=    4
			__lowercase					=    8
			__lowercase					=    8

			__lowercase					=    torch.randint(0				,			__lowerCamelCase				,			(batch_size, height * width)      )

			return sample




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

			'''simple docstring'''




			assert False




	def       UpperCAmelCase (	self       :    Union[str, Any]				,			__lowerCamelCase       :    str      )					->   Dict:

			'''simple docstring'''




			def model(__lowerCamelCase       :    Dict				,			__lowerCamelCase       :    Optional[Any]				,			*__lowerCamelCase       :    List[Any]      ):
					__lowercase	,			__lowercase					=    sample.shape
					__lowercase					=    torch.rand((batch_size, num_vec_classes - 1, num_latent_pixels)      )
					__lowercase					=    F.log_softmax(logits.double()				,			dim=1      ).float()
					return return_value

			return model




	def       UpperCAmelCase (	self       :    Dict      )					->   List[Any]:

			'''simple docstring'''




			for timesteps in [2, 5, 100, 1_000]:
					self.check_over_configs(num_train_timesteps=__lowerCamelCase      )




	def       UpperCAmelCase (	self       :    Optional[Any]      )					->   int:

			'''simple docstring'''




			for num_vec_classes in [5, 100, 1_000, 4_000]:
					self.check_over_configs(num_vec_classes=__lowerCamelCase      )




	def       UpperCAmelCase (	self       :    Any      )					->   List[Any]:

			'''simple docstring'''




			for t in [0, 50, 99]:
					self.check_over_forward(time_step=__lowerCamelCase      )






	def       UpperCAmelCase (	self       :    str      )					->   Optional[int]:

			'''simple docstring'''




			pass




