docstr: Test that stable diffusion img2img works with fp16
docstr_tok: ["Test","that","stable","diffusion","img2img","works","with","fp16"]
code: def test_stable_diffusion_img2img_fp16(self):
      """Test that stable diffusion img2img works with fp16"""
      unet = self.dummy_cond_unet
      scheduler = PNDMScheduler(skip_prk_steps=True)
      vae = self.dummy_vae
      bert = self.dummy_text_encoder
      tokenizer = XLMRobertaTokenizer.from_pretrained(
          "hf-internal-testing/tiny-xlm-roberta"
      )
      tokenizer.model_max_length = 77
  
      init_image = self.dummy_image.to(torch_device)
  
      # put models in fp16
      unet = unet.half()
      vae = vae.half()
      bert = bert.half()
  
      # make sure here that pndm scheduler skips prk
      alt_pipe = AltDiffusionImg2ImgPipeline(
          unet=unet,
          scheduler=scheduler,
          vae=vae,
          text_encoder=bert,
          tokenizer=tokenizer,
          safety_checker=None,
          feature_extractor=self.dummy_extractor,
      )
      alt_pipe.image_processor = VaeImageProcessor(
          vae_scale_factor=alt_pipe.vae_scale_factor, do_normalize=False
      )
      alt_pipe = alt_pipe.to(torch_device)
      alt_pipe.set_progress_bar_config(disable=None)
  
      prompt = "A painting of a squirrel eating a burger"
      generator = torch.manual_seed(0)
      image = alt_pipe(
          [prompt],
          generator=generator,
          num_inference_steps=2,
          output_type="np",
          image=init_image,
      ).images
  
      assert image.shape == (1, 32, 32, 3)
  
imports: import gc
  import random
  import unittest
  import numpy
  import torch
  from transformers import XLMRobertaTokenizer
  from diffusers import AltDiffusionImg2ImgPipeline, AutoencoderKL, PNDMScheduler, UNet2DConditionModel
  from diffusers.image_processor import VaeImageProcessor
  from diffusers.pipelines.alt_diffusion.modeling_roberta_series import RobertaSeriesConfig, RobertaSeriesModelWithTransformation
  from diffusers.utils import load_image
  from diffusers.utils.testing_utils import enable_full_determinism, floats_tensor, load_numpy, nightly, require_torch_gpu, torch_device
label_desc: Use image node_id 8 for calling the AltDiffusionImg2ImgPipelineFastTests obj's underlying member method code with example usage: obj.test_stable_diffusion_img2img_fp16() without return types