Update README.md
Browse files
README.md
CHANGED
@@ -66,20 +66,36 @@ Please follow the instructions in [mit-han-lab/nunchaku](https://github.com/mit-
|
|
66 |
|
67 |
```python
|
68 |
import torch
|
69 |
-
from diffusers import
|
|
|
|
|
70 |
|
71 |
from nunchaku.models.transformer_flux import NunchakuFluxTransformer2dModel
|
72 |
|
73 |
-
transformer = NunchakuFluxTransformer2dModel.from_pretrained("mit-han-lab/svdq-int4-flux.1-dev")
|
74 |
-
|
75 |
-
|
|
|
|
|
|
|
76 |
).to("cuda")
|
77 |
-
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
```
|
80 |
|
81 |
### Comfy UI
|
82 |
-
|
|
|
83 |
|
84 |
## Limitations
|
85 |
|
|
|
66 |
|
67 |
```python
|
68 |
import torch
|
69 |
+
from diffusers import FluxControlPipeline
|
70 |
+
from diffusers.utils import load_image
|
71 |
+
from image_gen_aux import DepthPreprocessor
|
72 |
|
73 |
from nunchaku.models.transformer_flux import NunchakuFluxTransformer2dModel
|
74 |
|
75 |
+
transformer = NunchakuFluxTransformer2dModel.from_pretrained("mit-han-lab/svdq-int4-flux.1-depth-dev")
|
76 |
+
|
77 |
+
pipe = FluxControlPipeline.from_pretrained(
|
78 |
+
"black-forest-labs/FLUX.1-Depth-dev",
|
79 |
+
transformer=transformer,
|
80 |
+
torch_dtype=torch.bfloat16,
|
81 |
).to("cuda")
|
82 |
+
|
83 |
+
prompt = "A robot made of exotic candies and chocolates of different kinds. The background is filled with confetti and celebratory gifts."
|
84 |
+
control_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/robot.png")
|
85 |
+
|
86 |
+
processor = DepthPreprocessor.from_pretrained("LiheYoung/depth-anything-large-hf")
|
87 |
+
control_image = processor(control_image)[0].convert("RGB")
|
88 |
+
|
89 |
+
image = pipe(
|
90 |
+
prompt=prompt, control_image=control_image, height=1024, width=1024, num_inference_steps=30, guidance_scale=10.0
|
91 |
+
).images[0]
|
92 |
+
image.save("flux.1-depth-dev.png")
|
93 |
+
|
94 |
```
|
95 |
|
96 |
### Comfy UI
|
97 |
+
|
98 |
+
Work in progress. Stay tuned!
|
99 |
|
100 |
## Limitations
|
101 |
|