code: 
  
  
  """simple docstring"""
  
  
  
  
  from typing import List, Optional, Tuple, Union
  
  import torch
  
  from ...models import UNetaDModel
  from ...schedulers import PNDMScheduler
  from ...utils import randn_tensor
  from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput
  
  
  
  
  
  class __snake_case		(					_SCREAMING_SNAKE_CASE      ):
  
  
  
  
  
  
  
     """simple docstring"""
  
  
  
  
     lowerCAmelCase_				:   UNetaDModel
     lowerCAmelCase_				:   PNDMScheduler
  
  
  
  
     def __init__(		self							:Union[str, Any]				,  UpperCamelCase__							:UNetaDModel				,  UpperCamelCase__							:PNDMScheduler       ):
            super().__init__()
  
            _a          =				PNDMScheduler.from_config(scheduler.config       )
  
            self.register_modules(unet=UpperCamelCase__				,  scheduler=UpperCamelCase__       )
  
  
  
  
     @torch.no_grad()
     def __call__(		self							:Dict				,  UpperCamelCase__							:int = 1				,  UpperCamelCase__							:int = 50				,  UpperCamelCase__							:Optional[Union[torch.Generator, List[torch.Generator]]] = None				,  UpperCamelCase__							:Optional[str] = "pil"				,  UpperCamelCase__							:bool = True				,  **UpperCamelCase__							:int				,  ):
            _a          =				randn_tensor(
                (batch_size, self.unet.config.in_channels, self.unet.config.sample_size, self.unet.config.sample_size)				,  generator=UpperCamelCase__				,  device=self.device				,  )
  
            self.scheduler.set_timesteps(UpperCamelCase__       )
            for t in self.progress_bar(self.scheduler.timesteps       ):
                   _a          =				self.unet(UpperCamelCase__				,  UpperCamelCase__       ).sample
  
                   _a          =				self.scheduler.step(UpperCamelCase__				,  UpperCamelCase__				,  UpperCamelCase__       ).prev_sample
  
            _a          =				(image / 2 + 0.5).clamp(0				,  1       )
            _a          =				image.cpu().permute(0				,  2				,  3				,  1       ).numpy()
            if output_type == "pil":
                   _a          =				self.numpy_to_pil(UpperCamelCase__       )
  
            if not return_dict:
                   return (image,)
  
            return ImagePipelineOutput(images=UpperCamelCase__       )
  
style_context: 
  
  
  """simple docstring"""
  
  
  
  
  from ...configuration_utils import PretrainedConfig
  from ...utils import logging
  
  
  __SCREAMING_SNAKE_CASE					=						logging.get_logger(__name__)
  
  __SCREAMING_SNAKE_CASE					=						{
      """bert-base-uncased""": """https://huggingface.co/bert-base-uncased/resolve/main/config.json""",
      # QDQBERT models can be loaded from any BERT checkpoint, available at https://huggingface.co/models?filter=bert
  }
  
  
  
  
  
  class __snake_case		(					_SCREAMING_SNAKE_CASE      ):
  
  
  
  
  
  
  
     """simple docstring"""
  
  
  
  
     lowerCAmelCase_				:   Tuple     	=			'qdqbert'
  
  
  
  
     def __init__(		self							:List[Any]				,  UpperCamelCase__							:List[Any]=30_522				,  UpperCamelCase__							:Optional[int]=768				,  UpperCamelCase__							:str=12				,  UpperCamelCase__							:Tuple=12				,  UpperCamelCase__							:Any=3_072				,  UpperCamelCase__							:Union[str, Any]="gelu"				,  UpperCamelCase__							:Dict=0.1				,  UpperCamelCase__							:Any=0.1				,  UpperCamelCase__							:Dict=512				,  UpperCamelCase__							:Optional[int]=2				,  UpperCamelCase__							:Any=0.02				,  UpperCamelCase__							:Optional[int]=1E-12				,  UpperCamelCase__							:str=True				,  UpperCamelCase__							:str=1				,  UpperCamelCase__							:List[Any]=0				,  UpperCamelCase__							:List[str]=2				,  **UpperCamelCase__							:Optional[Any]				,  ):
            super().__init__(pad_token_id=UpperCamelCase__				,  bos_token_id=UpperCamelCase__				,  eos_token_id=UpperCamelCase__				,  **UpperCamelCase__       )
  
            _a          =				vocab_size
            _a          =				max_position_embeddings
            _a          =				hidden_size
            _a          =				num_hidden_layers
            _a          =				num_attention_heads
            _a          =				intermediate_size
            _a          =				hidden_act
            _a          =				hidden_dropout_prob
            _a          =				attention_probs_dropout_prob
            _a          =				initializer_range
            _a          =				type_vocab_size
            _a          =				layer_norm_eps
            _a          =				use_cache
  