MudeHui commited on
Commit
3a5f470
1 Parent(s): 76599fb

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +13 -7
README.md CHANGED
@@ -18,23 +18,29 @@ pip install git+https://github.com/huggingface/diffusers
18
 
19
  ```python
20
  import torch
21
- from diffusers import StableDiffusionXLInstructPix2PixPipeline
 
22
  from diffusers.utils import load_image
23
- resolution = 768
 
 
 
 
 
 
 
24
  image = load_image(
25
  "https://hf.co/datasets/diffusers/diffusers-images-docs/resolve/main/mountain.png"
26
  ).resize((resolution, resolution))
 
27
  edit_instruction = "Turn sky into a cloudy one"
28
- pipe = StableDiffusionXLInstructPix2PixPipeline.from_pretrained(
29
- "UCSC-VLAA/HQ-Edit", torch_dtype=torch.float16
30
- ).to("cuda")
31
  edited_image = pipe(
32
  prompt=edit_instruction,
33
  image=image,
34
  height=resolution,
35
  width=resolution,
36
- guidance_scale=3.0,
37
- image_guidance_scale=1.5,
38
  num_inference_steps=30,
39
  ).images[0]
40
  edited_image.save("edited_image.png")
 
18
 
19
  ```python
20
  import torch
21
+ import torch
22
+ from diffusers import StableDiffusionInstructPix2PixPipeline, EulerAncestralDiscreteScheduler
23
  from diffusers.utils import load_image
24
+
25
+ image_guidance_scale = 1.5
26
+ guidance_scale = 7.0
27
+ model_id = "MudeHui/HQ-Edit"
28
+ pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(model_id, torch_dtype=torch.float16, safety_checker=None)
29
+ pipe.to("cuda")
30
+ pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
31
+ resolution = 512
32
  image = load_image(
33
  "https://hf.co/datasets/diffusers/diffusers-images-docs/resolve/main/mountain.png"
34
  ).resize((resolution, resolution))
35
+
36
  edit_instruction = "Turn sky into a cloudy one"
 
 
 
37
  edited_image = pipe(
38
  prompt=edit_instruction,
39
  image=image,
40
  height=resolution,
41
  width=resolution,
42
+ guidance_scale=image_guidance_scale,
43
+ image_guidance_scale=image_guidance_scale,
44
  num_inference_steps=30,
45
  ).images[0]
46
  edited_image.save("edited_image.png")