YiYiXu commited on
Commit
a33cfc2
1 Parent(s): 9c92c49

add readme

Browse files
Files changed (1) hide show
  1. README.md +30 -0
README.md CHANGED
@@ -91,6 +91,36 @@ Which should give you an image like below:
91
 
92
  ![A duck riding a tidal wave](sample_result.png)
93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
 
95
  ### Preprocessing
96
 
 
91
 
92
  ![A duck riding a tidal wave](sample_result.png)
93
 
94
+ ### Using Controlnets in Diffusers
95
+
96
+ Make sure you upgrade to the latest version of diffusers: `pip install -U diffusers`. And then you can run:
97
+
98
+ ```python
99
+ import torch
100
+ from diffusers import StableDiffusion3ControlNetPipeline,SD3ControlNetModel
101
+ from diffusers.utils import load_image
102
+
103
+ controlnet = SD3ControlNetModel.from_pretrained("stabilityai/stable-diffusion-3.5-large-controlnet-blur", torch_dtype=torch.float16)
104
+ pipe = StableDiffusion3ControlNetPipeline.from_pretrained(
105
+ "stabilityai/stable-diffusion-3.5-large",
106
+ controlnet=controlnet,
107
+ torch_dtype=torch.float16
108
+ ).to("cuda")
109
+
110
+ control_image = load_image("https://huggingface.co/datasets/diffusers/diffusers-images-docs/resolve/main/blur.png")
111
+ prompt = "generated ai art, a tiny, lost rubber ducky in an action shot close-up, surfing the humongous waves, inside the tube, in the style of Kelly Slater"
112
+
113
+ generator = torch.Generator(device="cpu").manual_seed(0)
114
+ image = pipe(
115
+ prompt,
116
+ control_image=control_image,
117
+ guidance_scale=3.5,
118
+ num_inference_steps=60,
119
+ generator=generator,
120
+ max_sequence_length=77,
121
+ ).images[0]
122
+ image.save('blur-8b.jpg')
123
+ ```
124
 
125
  ### Preprocessing
126