weifeng-chen commited on
Commit
3519104
β€’
1 Parent(s): 7c6ef59
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -10,11 +10,11 @@ from diffusers import (
10
  device="cuda"
11
  model_id = "IDEA-CCNL/Taiyi-Stable-Diffusion-1B-Chinese-v0.1"
12
 
13
- pipe_text2img = StableDiffusionPipeline.from_pretrained(model_id).to(device)
14
 
15
  # pipe_inpaint = StableDiffusionInpaintPipeline.from_pretrained(model_id).to(device) # work
16
  # pipe_inpaint = StableDiffusionInpaintPipeline(**pipe_text2img.components) # not work
17
- pipe_img2img = StableDiffusionImg2ImgPipeline(**pipe_text2img.components)
18
 
19
  def infer_text2img(prompt, width, height):
20
  output = pipe_text2img(prompt, width=width, height=height, guidance_scale=7.5, num_inference_steps=20,)
 
10
  device="cuda"
11
  model_id = "IDEA-CCNL/Taiyi-Stable-Diffusion-1B-Chinese-v0.1"
12
 
13
+ pipe_text2img = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to(device)
14
 
15
  # pipe_inpaint = StableDiffusionInpaintPipeline.from_pretrained(model_id).to(device) # work
16
  # pipe_inpaint = StableDiffusionInpaintPipeline(**pipe_text2img.components) # not work
17
+ pipe_img2img = StableDiffusionImg2ImgPipeline(**pipe_text2img.components).to(device)
18
 
19
  def infer_text2img(prompt, width, height):
20
  output = pipe_text2img(prompt, width=width, height=height, guidance_scale=7.5, num_inference_steps=20,)