code: 
  
  
  import gc
  import tempfile
  import unittest
  
  import numpy as np
  import torch
  
  from diffusers import VersatileDiffusionDualGuidedPipeline
  from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device
  
  
  SCREAMING_SNAKE_CASE__				:    Union[str, Any]         =    False
  
  
  @nightly
  @require_torch_gpu
  class 		_SCREAMING_SNAKE_CASE    (	unittest.TestCase    ):
  
  
       def 					__snake_case(     self						):
         # clean up the VRAM after each test
         super().tearDown()
         gc.collect()
         torch.cuda.empty_cache()
  
  
       def 					__snake_case(     self						):
         _UpperCAmelCase		:       Tuple       =    VersatileDiffusionDualGuidedPipeline.from_pretrained("""shi-labs/versatile-diffusion"""						)
         # remove text_unet
         pipe.remove_unused_weights()
         pipe.to(A_						)
         pipe.set_progress_bar_config(disable=A_						)
  
         _UpperCAmelCase		:       Tuple       =    load_image(
             """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/versatile_diffusion/benz.jpg"""						)
  
         _UpperCAmelCase		:       Optional[int]       =    torch.manual_seed(0						)
         _UpperCAmelCase		:       Optional[Any]       =    pipe(
             prompt="""first prompt"""       ,				image=A_       ,				text_to_image_strength=0.7_5       ,				generator=A_       ,				guidance_scale=7.5       ,				num_inference_steps=2       ,				output_type="""numpy"""       ,				).images
  
         with tempfile.TemporaryDirectory() as tmpdirname:
           pipe.save_pretrained(A_						)
           _UpperCAmelCase		:       Optional[Any]       =    VersatileDiffusionDualGuidedPipeline.from_pretrained(A_						)
  
         pipe.to(A_						)
         pipe.set_progress_bar_config(disable=A_						)
  
         _UpperCAmelCase		:       Optional[int]       =    generator.manual_seed(0						)
         _UpperCAmelCase		:       Union[str, Any]       =    pipe(
             prompt="""first prompt"""       ,				image=A_       ,				text_to_image_strength=0.7_5       ,				generator=A_       ,				guidance_scale=7.5       ,				num_inference_steps=2       ,				output_type="""numpy"""       ,				).images
  
         assert np.abs(image - new_image						).sum() < 1e-5, "Models don't have the same forward pass"
  
  
  
  
       def 					__snake_case(     self						):
         _UpperCAmelCase		:       Any       =    VersatileDiffusionDualGuidedPipeline.from_pretrained("""shi-labs/versatile-diffusion"""						)
         pipe.remove_unused_weights()
         pipe.to(A_						)
         pipe.set_progress_bar_config(disable=A_						)
  
         _UpperCAmelCase		:       List[Any]       =    """cyberpunk 2077"""
         _UpperCAmelCase		:       Any       =    load_image(
             """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/versatile_diffusion/benz.jpg"""						)
         _UpperCAmelCase		:       Any       =    torch.manual_seed(0						)
         _UpperCAmelCase		:       List[str]       =    pipe(
             prompt=A_       ,				image=A_       ,				text_to_image_strength=0.7_5       ,				generator=A_       ,				guidance_scale=7.5       ,				num_inference_steps=50       ,				output_type="""numpy"""       ,				).images
  
         _UpperCAmelCase		:       Any       =    image[0, 2_53:2_56, 2_53:2_56, -1]
  
         assert image.shape == (1, 5_12, 5_12, 3)
         _UpperCAmelCase		:       Dict       =    np.array([0.0_7_8_7, 0.0_8_4_9, 0.0_8_2_6, 0.0_8_1_2, 0.0_8_0_7, 0.0_7_9_5, 0.0_8_1_8, 0.0_7_9_8, 0.0_7_7_9]						)
  
         assert np.abs(image_slice.flatten() - expected_slice						).max() < 1e-2
  
  
  
  
  
  
style_context: 
  
  
  from typing import Any
  
  
  class 		_SCREAMING_SNAKE_CASE    :
  
  
       def __init__(     self						):
         _UpperCAmelCase		:       Union[str, Any]       =    []
         _UpperCAmelCase		:       Dict       =    0
  
  
       def __str__(     self						):
         _UpperCAmelCase		:       Union[str, Any]       =    """<""" + str(self.stack						)[1:-1] + """>"""
         return printed
  
  
       def 					__snake_case(     self       ,				A_						):
         self.stack.append(A_						)
         _UpperCAmelCase		:       Optional[Any]       =    self.length + 1
  
  
       def 					__snake_case(     self						):
         self.rotate(1						)
         _UpperCAmelCase		:       List[Any]       =    self.stack[self.length - 1]
         _UpperCAmelCase		:       Optional[Any]       =    self.stack[:-1]
         self.rotate(self.length - 1						)
         _UpperCAmelCase		:       Union[str, Any]       =    self.length - 1
         return dequeued
  
  
       def 					__snake_case(     self       ,				A_						):
         for _ in range(A_						):
           _UpperCAmelCase		:       Dict       =    self.stack[0]
           _UpperCAmelCase		:       List[Any]       =    self.stack[1:]
           self.put(A_						)
           _UpperCAmelCase		:       Dict       =    self.length - 1
  
  
       def 					__snake_case(     self						):
         _UpperCAmelCase		:       Tuple       =    self.get()
         self.put(A_						)
         self.rotate(self.length - 1						)
         return front
  
  
       def 					__snake_case(     self						):
         return self.length
  
  
  
  
  
  