Update README.md
Browse files
README.md
CHANGED
|
@@ -1 +1,49 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SD3 Controlnet
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
| control image | weight=0 | weight=0.3 | weight=0.5 | weight=0.7 | weight=0.9 |
|
| 7 |
+
|:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|
|
| 8 |
+
|<img src="./canny.jpg" width = "400" /> | <img src="./raw.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
|
| 12 |
+
|
| 13 |
+
The current [diffusers](https://github.com/instantX-research/diffusers_sd3_control.git) have not been merged into the official code yet.
|
| 14 |
+
|
| 15 |
+
```cmd
|
| 16 |
+
git clone -b sd3_control https://github.com/instantX-research/diffusers_sd3_control.git
|
| 17 |
+
cd diffusers_sd3_control
|
| 18 |
+
pip install -e .
|
| 19 |
+
```
|
| 20 |
+
|
| 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-Tile")
|
| 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-Tile/resolve/main/tile.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=tile_image,
|
| 44 |
+
controlnet_conditioning_scale=0.5,
|
| 45 |
+
).images[0]
|
| 46 |
+
image.save('image.jpg')
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
```
|