Update README.md
#31
by
hlky
HF staff
- opened
README.md
CHANGED
@@ -37,9 +37,10 @@ Also, some generation results with input images are provided in "Files and versi
|
|
37 |
|
38 |
# Inference
|
39 |
|
40 |
-
To try our models, you have
|
41 |
1. Use main.py from our [official repo](https://github.com/XLabs-AI/x-flux)
|
42 |
2. Use our custom nodes for ComfyUI and test it with provided workflows (check out folder /workflows)
|
|
|
43 |
|
44 |
## Instruction for ComfyUI
|
45 |
1. Go to ComfyUI/custom_nodes
|
@@ -51,6 +52,38 @@ To try our models, you have 2 options:
|
|
51 |
7. Use `Flux Load IPAdapter` and `Apply Flux IPAdapter` nodes, choose right CLIP model and enjoy your genereations.
|
52 |
8. You can find example workflow in folder workflows in this repo.
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
If you get bad results, try to set true_gs=2
|
55 |
|
56 |
### Limitations
|
|
|
37 |
|
38 |
# Inference
|
39 |
|
40 |
+
To try our models, you have 3 options:
|
41 |
1. Use main.py from our [official repo](https://github.com/XLabs-AI/x-flux)
|
42 |
2. Use our custom nodes for ComfyUI and test it with provided workflows (check out folder /workflows)
|
43 |
+
3. Diffusers 🧨
|
44 |
|
45 |
## Instruction for ComfyUI
|
46 |
1. Go to ComfyUI/custom_nodes
|
|
|
52 |
7. Use `Flux Load IPAdapter` and `Apply Flux IPAdapter` nodes, choose right CLIP model and enjoy your genereations.
|
53 |
8. You can find example workflow in folder workflows in this repo.
|
54 |
|
55 |
+
## Diffusers 🧨
|
56 |
+
1. Install Diffusers 🧨 `pip install -U diffusers`
|
57 |
+
2. Run the example
|
58 |
+
|
59 |
+
```python
|
60 |
+
import torch
|
61 |
+
from diffusers import FluxPipeline
|
62 |
+
from diffusers.utils import load_image
|
63 |
+
|
64 |
+
pipe: FluxPipeline = FluxPipeline.from_pretrained(
|
65 |
+
"black-forest-labs/FLUX.1-dev",
|
66 |
+
torch_dtype=torch.bfloat16,
|
67 |
+
).to("cuda")
|
68 |
+
|
69 |
+
image = load_image("assets_statue.jpg").resize((1024, 1024))
|
70 |
+
|
71 |
+
pipe.load_ip_adapter("XLabs-AI/flux-ip-adapter", weight_name="ip_adapter.safetensors", image_encoder_pretrained_model_name_or_path="openai/clip-vit-large-patch14")
|
72 |
+
pipe.set_ip_adapter_scale(1.0)
|
73 |
+
|
74 |
+
image = pipe(
|
75 |
+
width=1024,
|
76 |
+
height=1024,
|
77 |
+
prompt='wearing sunglasses',
|
78 |
+
negative_prompt="",
|
79 |
+
true_cfg=4.0,
|
80 |
+
generator=torch.Generator().manual_seed(4444),
|
81 |
+
ip_adapter_image=image,
|
82 |
+
).images[0]
|
83 |
+
|
84 |
+
image.save('flux_ipadapter_4444.jpg')
|
85 |
+
```
|
86 |
+
|
87 |
If you get bad results, try to set true_gs=2
|
88 |
|
89 |
### Limitations
|