Rename nothing to README.MD
Browse files- nothing → README.MD +18 -8
nothing → README.MD
RENAMED
|
@@ -14,15 +14,25 @@ library_name: diffusers
|
|
| 14 |
---
|
| 15 |
|
| 16 |
```py
|
| 17 |
-
from diffusers import AutoPipelineForText2Image
|
| 18 |
import torch
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
).images[0]
|
| 27 |
-
image
|
| 28 |
```
|
|
|
|
| 14 |
---
|
| 15 |
|
| 16 |
```py
|
|
|
|
| 17 |
import torch
|
| 18 |
+
from diffusers import FluxPipeline
|
| 19 |
|
| 20 |
+
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16) # can replace schnell with dev
|
| 21 |
+
# to run on low vram GPUs (i.e. between 4 and 32 GB VRAM)
|
| 22 |
+
pipe.enable_sequential_cpu_offload()
|
| 23 |
+
pipe.vae.enable_slicing()
|
| 24 |
+
pipe.vae.enable_tiling()
|
| 25 |
+
|
| 26 |
+
pipe.to(torch.float16) # casting here instead of in the pipeline constructor because doing so in the constructor loads all models into CPU memory at once
|
| 27 |
+
|
| 28 |
+
prompt = "A cat holding a sign that says hello world"
|
| 29 |
+
out = pipe(
|
| 30 |
+
prompt=prompt,
|
| 31 |
+
guidance_scale=4,
|
| 32 |
+
height=768,
|
| 33 |
+
width=1024,
|
| 34 |
+
num_inference_steps=4,
|
| 35 |
+
max_sequence_length=256,
|
| 36 |
).images[0]
|
| 37 |
+
out.save("image.png")
|
| 38 |
```
|