

"""simple docstring"""

from ...configuration_utils import PretrainedConfig
from ...utils import logging


_UpperCamelCase		    =						logging.get_logger(__name__)

_UpperCamelCase		    =						{
    """openbmb/cpm-ant-10b""": """https://huggingface.co/openbmb/cpm-ant-10b/blob/main/config.json"""
    # See all CPMAnt models at https://huggingface.co/models?filter=cpmant
}






class  __a				(	__magic_name__					):





       """simple docstring"""


       __UpperCamelCase				:			str          =	'cpmant'






       def __init__(      self ,				snake_case = 30_720 ,				snake_case = 4_096 ,				snake_case = 32 ,				snake_case = 128 ,				snake_case = 10_240 ,				snake_case = 48 ,				snake_case = 0.0 ,				snake_case = 512 ,				snake_case = 2_048 ,				snake_case = 1e-6 ,				snake_case = 1.0 ,				snake_case = 32 ,				snake_case = 32 ,				snake_case = 32 ,				snake_case = True ,				**snake_case ,				):





        """simple docstring"""

        super().__init__(**snake_case      )
        lowerCAmelCase__      :							List[Any]    =							prompt_types
        lowerCAmelCase__      :							Any    =							prompt_length
        lowerCAmelCase__      :							int    =							segment_types
        lowerCAmelCase__      :							Tuple    =							hidden_size
        lowerCAmelCase__      :							Tuple    =							num_attention_heads
        lowerCAmelCase__      :							str    =							dim_head
        lowerCAmelCase__      :							List[str]    =							dim_ff
        lowerCAmelCase__      :							int    =							num_hidden_layers
        lowerCAmelCase__      :							Optional[int]    =							position_bias_num_buckets
        lowerCAmelCase__      :							Tuple    =							position_bias_max_distance
        lowerCAmelCase__      :							Optional[Any]    =							dropout_p
        lowerCAmelCase__      :							Any    =							eps
        lowerCAmelCase__      :							Union[str, Any]    =							use_cache
        lowerCAmelCase__      :							Union[str, Any]    =							vocab_size
        lowerCAmelCase__      :							str    =							init_std









"""simple docstring"""

import torch
import torch.nn.functional as F

from diffusers import VQDiffusionScheduler

from .test_schedulers import SchedulerCommonTest






class  __a				(	__magic_name__					):





       """simple docstring"""


       __UpperCamelCase				:			Optional[int]          =	(VQDiffusionScheduler,)






       def  SCREAMING_SNAKE_CASE_  (      self ,				**snake_case      ):





        """simple docstring"""

        lowerCAmelCase__      :							str    =							{
            "num_vec_classes": 4_097,
            "num_train_timesteps": 100,
        }

        config.update(**snake_case      )
        return config






       def  SCREAMING_SNAKE_CASE_  (      self ,				snake_case      ):





        """simple docstring"""

        lowerCAmelCase__      :							Optional[int]    =							4
        lowerCAmelCase__      :							Optional[Any]    =							8
        lowerCAmelCase__      :							Union[str, Any]    =							8

        lowerCAmelCase__      :							Optional[Any]    =							torch.randint(0 ,				snake_case ,				(batch_size, height * width)      )

        return sample






       @property
       def  SCREAMING_SNAKE_CASE_  (      self      ):





        """simple docstring"""

        assert False






       def  SCREAMING_SNAKE_CASE_  (      self ,				snake_case      ):





        """simple docstring"""

        def model(snake_case ,				snake_case ,				*snake_case      ):
         lowerCAmelCase__ ,	lowerCAmelCase__      :							str    =							sample.shape
         lowerCAmelCase__      :							Dict    =							torch.rand((batch_size, num_vec_classes - 1, num_latent_pixels)      )
         lowerCAmelCase__      :							int    =							F.log_softmax(logits.double() ,				dim=1      ).float()
         return return_value

        return model






       def  SCREAMING_SNAKE_CASE_  (      self      ):





        """simple docstring"""

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






       def  SCREAMING_SNAKE_CASE_  (      self      ):





        """simple docstring"""

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






       def  SCREAMING_SNAKE_CASE_  (      self      ):





        """simple docstring"""

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






       def  SCREAMING_SNAKE_CASE_  (      self      ):





        """simple docstring"""

        pass






