Instructions to use black-forest-labs/FLUX.1-Kontext-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-Kontext-dev with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Diffusion Single File
How to use black-forest-labs/FLUX.1-Kontext-dev with Diffusion Single File:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Inference
- Notebooks
- Google Colab
- Kaggle
VRAM?
How much VRAM do I need?
How much VRAM do I need?
my 5090 with 32gb is not enough without optimizations. it using 31.5gb vram and around 4-5gb RAM. in this case generation take about 3h lol. but with cpu offloading or fp8/quantization i think 20 gb vram should be enough. maybe even less
I am able to make it run on my 3070 with 8 GB VRAM and 64 GB RAM. A bit slow, but works.
can you share the pipeline as am using the 3060 12gb v ram
i have downloaded the 44gb flux model
For reference, Kontext also runs in full bf16 at ~1.5GB peak VRAM via layer-streaming (loading one transformer layer at a time from disk instead of the whole model into VRAM) — no quantization needed. Slower than a native fit since it's disk-I/O bound, but should work even below your 3070's 8GB. Repo: https://github.com/Jit-Roy/WeeLLM. I have 4gb vram and this works best for me!