wangqixun commited on
Commit
2ef6ae4
1 Parent(s): 3e5be80

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +18 -28
README.md CHANGED
@@ -3,9 +3,9 @@
3
 
4
 
5
 
6
- | raw | control image | output |
7
- |:-------------------------:|:-------------------------:|:-------------------------:|
8
- |<img src="./raw.jpg" width = "400" /> | <img src="./pose.jpg" width = "400" /> | <img src="./demo_1.jpg" width = "400" /> |
9
 
10
 
11
  # Install Diffusers-SD3-Controlnet
@@ -21,37 +21,27 @@ pip install -e .
21
  # Demo
22
  ```python
23
  import torch
 
 
24
  from diffusers.utils import load_image
25
- import sys, os
26
- sys.path.append('/path/diffusers/examples/community')
27
- from pipeline_stable_diffusion_3_controlnet import StableDiffusion3CommonPipeline
28
 
29
  # load pipeline
30
- base_model = 'stabilityai/stable-diffusion-3-medium-diffusers'
31
- pipe = StableDiffusion3CommonPipeline.from_pretrained(
32
- base_model,
33
- controlnet_list=['InstantX/SD3-Controlnet-Pose']
34
  )
35
- pipe.to('cuda:0', torch.float16)
 
 
 
36
  prompt = 'Anime style illustration of a girl wearing a suit. A moon in sky. In the background we see a big rain approaching. text "InstantX" on image'
37
  n_prompt = 'NSFW, nude, naked, porn, ugly'
38
- # controlnet config
39
- controlnet_conditioning = [
40
- dict(
41
- control_index=0,
42
- control_image=load_image('https://huggingface.co/InstantX/SD3-Controlnet-Pose/resolve/main/pose.jpg'),
43
- control_weight=0.7,
44
- control_pooled_projections='zeros'
45
- )
46
- ]
47
- # infer
48
  image = pipe(
49
- prompt=prompt,
50
- negative_prompt=n_prompt,
51
- controlnet_conditioning=controlnet_conditioning,
52
- num_inference_steps=28,
53
- guidance_scale=7.0,
54
- height=1024,
55
- width=1024,
56
  ).images[0]
 
57
  ```
 
3
 
4
 
5
 
6
+ | control image | weight=0.0 | weight=0.3 | weight=0.5 | weight=0.7 | weight=0.9 |
7
+ |:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|
8
+ |<img src="./pose.jpg" width = "400" /> | <img src="./demo_0.jpg" width = "400" /> | <img src="./demo_3.jpg" width = "400" /> | <img src="./demo_5.jpg" width = "400" /> | <img src="./demo_7.jpg" width = "400" /> | <img src="./demo_9.jpg" width = "400" /> |
9
 
10
 
11
  # Install Diffusers-SD3-Controlnet
 
21
  # Demo
22
  ```python
23
  import torch
24
+ from diffusers import StableDiffusion3ControlNetPipeline
25
+ from diffusers.models import SD3ControlNetModel, SD3MultiControlNetModel
26
  from diffusers.utils import load_image
 
 
 
27
 
28
  # load pipeline
29
+ controlnet = SD3ControlNetModel.from_pretrained("InstantX/SD3-Controlnet-Pose")
30
+ pipe = StableDiffusion3ControlNetPipeline.from_pretrained(
31
+ "stabilityai/stable-diffusion-3-medium-diffusers",
32
+ controlnet=controlnet
33
  )
34
+ pipe.to("cuda", torch.float16)
35
+
36
+ # config
37
+ control_image = load_image("https://huggingface.co/InstantX/SD3-Controlnet-Pose/resolve/main/pose.jpg")
38
  prompt = 'Anime style illustration of a girl wearing a suit. A moon in sky. In the background we see a big rain approaching. text "InstantX" on image'
39
  n_prompt = 'NSFW, nude, naked, porn, ugly'
 
 
 
 
 
 
 
 
 
 
40
  image = pipe(
41
+ prompt,
42
+ negative_prompt=n_prompt,
43
+ control_image=pose_image,
44
+ controlnet_conditioning_scale=0.5,
 
 
 
45
  ).images[0]
46
+ image.save('image.jpg')
47
  ```