add diffusers weights
#1
by
YiYiXu
- opened
- README.md +30 -0
- config.json +21 -0
- diffusion_pytorch_model.safetensors +3 -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 |
|
config.json
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_class_name": "SD3ControlNetModel",
|
3 |
+
"_diffusers_version": "0.32.0.dev0",
|
4 |
+
"attention_head_dim": 64,
|
5 |
+
"caption_projection_dim": 2048,
|
6 |
+
"dual_attention_layers": [],
|
7 |
+
"extra_conditioning_channels": 0,
|
8 |
+
"force_zeros_for_pooled_projection": false,
|
9 |
+
"in_channels": 16,
|
10 |
+
"joint_attention_dim": null,
|
11 |
+
"num_attention_heads": 38,
|
12 |
+
"num_layers": 19,
|
13 |
+
"out_channels": 16,
|
14 |
+
"patch_size": 2,
|
15 |
+
"pooled_projection_dim": 2048,
|
16 |
+
"pos_embed_max_size": null,
|
17 |
+
"pos_embed_type": null,
|
18 |
+
"qk_norm": null,
|
19 |
+
"sample_size": 128,
|
20 |
+
"use_pos_embed": false
|
21 |
+
}
|
diffusion_pytorch_model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:450c51542992407bd2b8c123f70d8958e04129fb1ff471d93fca6e0141a0d42d
|
3 |
+
size 8614110992
|