code: 
  
  
  """simple docstring"""
  
  
  
  
  # limitations under the License.
  
  
  from typing import Optional, Tuple, Union
  
  import torch
  
  from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput
  
  
  
  
  
  class __snake_case		(					UpperCAmelCase__      ):
  
  
  
  
  
  
  
  			"""simple docstring"""
  
  
  
  
  			def __init__(		self							:str				,  UpperCamelCase__							:List[str]				,  UpperCamelCase__							:Optional[Any]       ):
  										super().__init__()
  										self.register_modules(unet=lowerCamelCase__				,  scheduler=lowerCamelCase__       )
  
  
  
  
  			@torch.no_grad()
  			def __call__(		self							:Optional[int]				,  UpperCamelCase__							:Union[str, Any] = 1				,  UpperCamelCase__							:Tuple = None				,  UpperCamelCase__							:int = 50				,  UpperCamelCase__							:List[Any] = "pil"				,  UpperCamelCase__							:List[str] = True				,  **UpperCamelCase__							:Union[str, Any]				,  ):
  										_a          =				torch.randn(
  										    (batch_size, self.unet.config.in_channels, self.unet.config.sample_size, self.unet.config.sample_size)				,  generator=lowerCamelCase__				,  )
  										_a          =				image.to(self.device       )
  
  										# set step values
  										self.scheduler.set_timesteps(lowerCamelCase__       )
  
  										for t in self.progress_bar(self.scheduler.timesteps       ):
  																	# 1. predict noise model_output
  																	_a          =				self.unet(lowerCamelCase__				,  lowerCamelCase__       ).sample
  
  																	# 2. predict previous mean of image x_t-1 and add variance depending on eta
  																	# eta corresponds to η in paper and should be between [0, 1]
  																	# do x_t -> x_t-1
  																	_a          =				self.scheduler.step(lowerCamelCase__				,  lowerCamelCase__				,  lowerCamelCase__       ).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(lowerCamelCase__       )
  
  										if not return_dict:
  																	return (image,), "This is a local test"
  
  										return ImagePipelineOutput(images=lowerCamelCase__       ), "This is a local test"
  
style_context: 
  
  
  """simple docstring"""
  
  
  
  
  import warnings
  from contextlib import contextmanager
  
  from ...processing_utils import ProcessorMixin
  
  
  
  
  
  class __snake_case		(					_SCREAMING_SNAKE_CASE      ):
  
  
  
  
  
  
  
     """simple docstring"""
  
  
  
  
     lowerCAmelCase_				:   str     	=			'AutoFeatureExtractor'
     lowerCAmelCase_				:   List[Any]     	=			'Speech2Text2Tokenizer'
  
  
  
  
     def __init__(		self							:int				,  UpperCamelCase__							:List[str]				,  UpperCamelCase__							:Union[str, Any]       ):
            super().__init__(UpperCamelCase__				,  UpperCamelCase__       )
            _a          =				self.feature_extractor
            _a          =				False
  
  
  
  
     def __call__(		self							:List[str]				,  *UpperCamelCase__							:List[str]				,  **UpperCamelCase__							:Dict       ):
            # For backward compatibility
            if self._in_target_context_manager:
                   return self.current_processor(*UpperCamelCase__				,  **UpperCamelCase__       )
  
            if "raw_speech" in kwargs:
                   warnings.warn("Using `raw_speech` as a keyword argument is deprecated. Use `audio` instead."       )
                   _a          =				kwargs.pop("raw_speech"       )
            else:
                   _a          =				kwargs.pop("audio"				,  UpperCamelCase__       )
            _a          =				kwargs.pop("sampling_rate"				,  UpperCamelCase__       )
            _a          =				kwargs.pop("text"				,  UpperCamelCase__       )
            if len(UpperCamelCase__       ) > 0:
                   _a          =				args[0]
                   _a          =				args[1:]
  
            if audio is None and text is None:
                   raise ValueError("You need to specify either an `audio` or `text` input to process."       )
  
            if audio is not None:
                   _a          =				self.feature_extractor(UpperCamelCase__				,  *UpperCamelCase__				,  sampling_rate=UpperCamelCase__				,  **UpperCamelCase__       )
            if text is not None:
                   _a          =				self.tokenizer(UpperCamelCase__				,  **UpperCamelCase__       )
  
            if text is None:
                   return inputs
            elif audio is None:
                   return encodings
            else:
                   _a          =				encodings["input_ids"]
                   return inputs
  
  
  
  
     def SCREAMING_SNAKE_CASE_      (		self							:Union[str, Any]				,  *UpperCamelCase__							:int				,  **UpperCamelCase__							:Optional[Any]       ):
            return self.tokenizer.batch_decode(*UpperCamelCase__				,  **UpperCamelCase__       )
  
  
  
  
     def SCREAMING_SNAKE_CASE_      (		self							:Optional[Any]				,  *UpperCamelCase__							:List[Any]				,  **UpperCamelCase__							:List[Any]       ):
            return self.tokenizer.decode(*UpperCamelCase__				,  **UpperCamelCase__       )
  
  
  
  
     @contextmanager
     def SCREAMING_SNAKE_CASE_      (		self							:Dict       ):
            warnings.warn(
                "`as_target_processor` is deprecated and will be removed in v5 of Transformers. You can process your "
                "labels by using the argument `text` of the regular `__call__` method (either in the same call as "
                "your audio inputs, or in a separate call."       )
            _a          =				True
            _a          =				self.tokenizer
            yield
            _a          =				self.feature_extractor
            _a          =				False
  