



"""simple docstring"""

from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_torch_available,
    is_vision_available,
)


A_	:						List[str]				=			{
    'configuration_sam': [
        'SAM_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'SamConfig',
        'SamMaskDecoderConfig',
        'SamPromptEncoderConfig',
        'SamVisionConfig',
    ],
    'processing_sam': ['SamProcessor'],
}


try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							A_	:						str				=			[
							    'SAM_PRETRAINED_MODEL_ARCHIVE_LIST',
							    'SamModel',
							    'SamPreTrainedModel',
							]
try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							A_	:						Union[str, Any]				=			[
							    'TF_SAM_PRETRAINED_MODEL_ARCHIVE_LIST',
							    'TFSamModel',
							    'TFSamPreTrainedModel',
							]
try:
							if not is_vision_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							A_	:						List[Any]				=			['SamImageProcessor']


if TYPE_CHECKING:
							from .configuration_sam import (
							    SAM_PRETRAINED_CONFIG_ARCHIVE_MAP,
							    SamConfig,
							    SamMaskDecoderConfig,
							    SamPromptEncoderConfig,
							    SamVisionConfig,
							)
							from .processing_sam import SamProcessor

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_sam import SAM_PRETRAINED_MODEL_ARCHIVE_LIST, SamModel, SamPreTrainedModel

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_sam import TF_SAM_PRETRAINED_MODEL_ARCHIVE_LIST, TFSamModel, TFSamPreTrainedModel

							try:
														if not is_vision_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .image_processing_sam import SamImageProcessor

else:
							import sys

							A_	:						Any				=			_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)










"""simple docstring"""

import torch
import torch.nn.functional as F

from diffusers import VQDiffusionScheduler

from .test_schedulers import SchedulerCommonTest
class 						lowerCAmelCase__	(  _lowerCamelCase   ):


	'''simple docstring'''







	_SCREAMING_SNAKE_CASE  :		Dict     	=   (VQDiffusionScheduler,)





	def  _lowerCAmelCase    (			self							:					Tuple    ,					**_SCREAMING_SNAKE_CASE							:					Optional[int]						)	->  int:





					"""simple docstring"""


					SCREAMING_SNAKE_CASE	:       List[str] 							=    {
					    'num_vec_classes': 4_097,
					    'num_train_timesteps': 100,
					}

					config.update(**_SCREAMING_SNAKE_CASE						)
					return config





	def  _lowerCAmelCase    (			self							:					Dict    ,					_SCREAMING_SNAKE_CASE							:					Tuple						)	->  List[str]:





					"""simple docstring"""


					SCREAMING_SNAKE_CASE	:       Tuple 							=    4
					SCREAMING_SNAKE_CASE	:       List[str] 							=    8
					SCREAMING_SNAKE_CASE	:       List[Any] 							=    8

					SCREAMING_SNAKE_CASE	:       Tuple 							=    torch.randint(0    ,					_SCREAMING_SNAKE_CASE    ,					(batch_size, height * width)						)

					return sample





	@property
	def  _lowerCAmelCase    (			self							:					str						)	->  int:





					"""simple docstring"""


					assert False





	def  _lowerCAmelCase    (			self							:					List[str]    ,					_SCREAMING_SNAKE_CASE							:					Optional[Any]						)	->  Optional[int]:





					"""simple docstring"""


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

					return model





	def  _lowerCAmelCase    (			self							:					List[str]						)	->  Dict:





					"""simple docstring"""


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





	def  _lowerCAmelCase    (			self							:					Union[str, Any]						)	->  int:





					"""simple docstring"""


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





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





					"""simple docstring"""


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







	def  _lowerCAmelCase    (			self							:					Any						)	->  Dict:





					"""simple docstring"""


					pass





