Update README.md
Browse files
README.md
CHANGED
@@ -10,4 +10,51 @@ pipeline_tag: image-to-image
|
|
10 |
tags:
|
11 |
- controlnet
|
12 |
- Controlnet
|
13 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
tags:
|
11 |
- controlnet
|
12 |
- Controlnet
|
13 |
+
---
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
this is a debug trainning result for diffusers training script
|
18 |
+
|
19 |
+
related issue https://github.com/huggingface/diffusers/issues/11181
|
20 |
+
|
21 |
+
related wandb log https://wandb.ai/wuuutiiing/flux_train_controlnet/overview
|
22 |
+
|
23 |
+
related script https://github.com/huggingface/diffusers/blob/main/examples/controlnet/train_controlnet_flux.py
|
24 |
+
|
25 |
+
|
26 |
+
# test script
|
27 |
+
```
|
28 |
+
|
29 |
+
|
30 |
+
from diffusers import FluxControlNetModel, FluxControlNetPipeline
|
31 |
+
import torch
|
32 |
+
from PIL import Image
|
33 |
+
|
34 |
+
validation_image = Image.open("a_control_image_like_fill50k.png").convert("RGB")
|
35 |
+
|
36 |
+
control_path = "wuutiing2/flux_controlnet_training_example"
|
37 |
+
flux_path = "black-forest-labs/FLUX.1-dev"
|
38 |
+
|
39 |
+
flux_controlnet = FluxControlNetModel.from_pretrained(
|
40 |
+
control_path, torch_dtype=torch.bfloat16
|
41 |
+
)
|
42 |
+
pipeline = FluxControlNetPipeline.from_pretrained(
|
43 |
+
flux_path,
|
44 |
+
controlnet=flux_controlnet,
|
45 |
+
torch_dtype=torch.bfloat16,
|
46 |
+
)
|
47 |
+
pipeline.to("cuda")
|
48 |
+
|
49 |
+
image = pipeline(
|
50 |
+
prompt="aqua circle with light pink background",
|
51 |
+
control_image=validation_image,
|
52 |
+
num_inference_steps=28,
|
53 |
+
controlnet_conditioning_scale=1,
|
54 |
+
guidance_scale=3.5,
|
55 |
+
generator=torch.manual_seed(19),
|
56 |
+
).images[0]
|
57 |
+
|
58 |
+
image.save("output.png")
|
59 |
+
|
60 |
+
```
|