Instructions to use black-forest-labs/FLUX.1-dev with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use black-forest-labs/FLUX.1-dev with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Inference
- Notebooks
- Google Colab
- Kaggle
- AMD Developer Cloud
- Local Apps Settings
- Draw Things
- DiffusionBee
My version to use Dev and Schnell on a 3090 using quants with a gradio front end.
I added quants to both models on startup. So it takes a few minutes on startup but then I get image generations in under 2 minutes for dev and just a few seconds for schnell.
Here is the github and a video explaining it:
https://github.com/NuclearGeekETH/NuclearGeek-Flux-Capacitor
This makes one hell of a difference in inference speed. I tested with only 28 steps. I quantized the text_encoder_2 version and not the text_encoder.
Ran in 35 seconds flat. nice!! I'm using RTX 4090 so no cpu offloading needed. Result was very good.
Note: If using GPU (without enable_model_cpu_offload()) you should Quantize BEFORE sending the pipeline to device="cuda".
Running transformer freeze DEV
Running text_encoder freeze DEV
seed = 17894334164879757554
100%|ββββββββββ| 28/28 [00:35<00:00, 1.28s/it]