





from dataclasses import dataclass
from enum import Enum
from typing import List, Optional, Union

import numpy as np
import PIL
from PIL import Image

from ...utils import BaseOutput, is_torch_available, is_transformers_available

@dataclass
class 		__a							(	UpperCamelCase_      ):
       __snake_case						:   List[Any]      =		{
           """sld_warmup_steps""": 15,
           """sld_guidance_scale""": 20,
           """sld_threshold""": 0.0,
           """sld_momentum_scale""": 0.0,
           """sld_mom_beta""": 0.0,
       }
       __snake_case						:   List[Any]      =		{
           """sld_warmup_steps""": 10,
           """sld_guidance_scale""": 1000,
           """sld_threshold""": 0.01,
           """sld_momentum_scale""": 0.3,
           """sld_mom_beta""": 0.4,
       }
       __snake_case						:   Optional[Any]      =		{
           """sld_warmup_steps""": 7,
           """sld_guidance_scale""": 2000,
           """sld_threshold""": 0.025,
           """sld_momentum_scale""": 0.5,
           """sld_mom_beta""": 0.7,
       }
       __snake_case						:   str      =		{
           """sld_warmup_steps""": 0,
           """sld_guidance_scale""": 5000,
           """sld_threshold""": 1.0,
           """sld_momentum_scale""": 0.5,
           """sld_mom_beta""": 0.7,
       }






@dataclass
class 		__a							(	UpperCamelCase_      ):
       __snake_case						:   Union[List[PIL.Image.Image], np.ndarray]
       __snake_case						:   Optional[List[bool]]
       __snake_case						:   Optional[Union[List[PIL.Image.Image], np.ndarray]]
       __snake_case						:   Optional[str]


if is_transformers_available() and is_torch_available():
  from .pipeline_stable_diffusion_safe import StableDiffusionPipelineSafe
  from .safety_checker import SafeStableDiffusionSafetyChecker









import torch
import torch.nn.functional as F

from diffusers import VQDiffusionScheduler

from .test_schedulers import SchedulerCommonTest

class 		__a							(	__UpperCamelCase      ):
       __snake_case						:   Optional[Any]      =		(VQDiffusionScheduler,)



       def  A							(     self	:   Optional[int]					,			**UpperCAmelCase	:   List[Any]			):
           lowerCAmelCase_					:	Any						=   {
               """num_vec_classes""": 40_97,
               """num_train_timesteps""": 1_00,
           }

           config.update(**UpperCAmelCase			)
           return config



       def  A							(     self	:   str					,			UpperCAmelCase	:   List[Any]			):
           lowerCAmelCase_					:	Union[str, Any]						=   4
           lowerCAmelCase_					:	str						=   8
           lowerCAmelCase_					:	Optional[Any]						=   8

           lowerCAmelCase_					:	str						=   torch.randint(0					,			UpperCAmelCase					,			(batch_size, height * width)			)

           return sample



       @property
       def  A							(     self	:   Optional[int]			):
           assert False



       def  A							(     self	:   int					,			UpperCAmelCase	:   Dict			):
           def model(UpperCAmelCase	:   Union[str, Any]					,			UpperCAmelCase	:   List[str]					,			*UpperCAmelCase	:   List[Any]			):
               lowerCAmelCase_		,		lowerCAmelCase_					:	Tuple						=   sample.shape
               lowerCAmelCase_					:	int						=   torch.rand((batch_size, num_vec_classes - 1, num_latent_pixels)			)
               lowerCAmelCase_					:	str						=   F.log_softmax(logits.double()					,			dim=1			).float()
               return return_value

           return model



       def  A							(     self	:   Union[str, Any]			):
           for timesteps in [2, 5, 1_00, 10_00]:
               self.check_over_configs(num_train_timesteps=UpperCAmelCase			)



       def  A							(     self	:   str			):
           for num_vec_classes in [5, 1_00, 10_00, 40_00]:
               self.check_over_configs(num_vec_classes=UpperCAmelCase			)



       def  A							(     self	:   Optional[Any]			):
           for t in [0, 50, 99]:
               self.check_over_forward(time_step=UpperCAmelCase			)



       def  A							(     self	:   int			):
           pass


