AI Frontier Post
Tutorials

FLUX.1 [dev]: generate images on your own GPU — hands-on with Black Forest Labs' open-weights model

In September we compared Midjourney, GPT Image 2.5, and Flux — and Flux came out ahead on photorealistic lighting and detail. The catch: the Flux that won that comparison, Flux 2, only runs through an API, and Flux 3, launched in October, is API-only too, with open weights promised in the coming weeks. FLUX.1 [dev] is the exception: a 12-billion-parameter model from Black Forest Labs with open weights you can download and run on your own GPU, free, with no per-image bill. This guide runs it end to end with Hugging Face diffusers — install, first image, tuning, the fast variant, and the low-VRAM path.

TL;DR: FLUX.1 [dev] is Black Forest Labs' 12-billion-parameter open-weights image model, and it runs on your own GPU with Hugging Face diffusers. Install diffusers, accept the model's license on Hugging Face, and generate 1024×1024 images with the model card's sample code. A 24GB GPU runs it in VRAM; CPU offload and an FP8 path cover smaller cards.
  • Who: FLUX.1 [dev], by Black Forest Labs — black-forest-labs/FLUX.1-dev on Hugging Face. The official inference repo is black-forest-labs/flux (26,042 GitHub stars, Apache-2.0 license).
  • What: a 12-billion-parameter rectified flow transformer that generates images from text descriptions. Open weights under the FLUX.1 [dev] Non-Commercial License.
  • Defaults: the model card's sample code generates a 1024×1024 image at guidance_scale=3.5, 50 inference steps, max_sequence_length=512, seed 0.
  • Hardware: about 24GB of bfloat16 weights — a 24GB GPU (RTX 4090 class) runs it in VRAM. enable_model_cpu_offload() trades speed for lower VRAM, and the diffusers docs show an FP8 path under 16GB.
  • Fast variant: FLUX.1 [schnell] is timestep-distilled, Apache 2.0, and needs just 4 steps at guidance_scale=0 and max_sequence_length=256.
  • Status: Flux 2 and Flux 3 are API products for now — Flux 3 launched October 2 with open weights promised in the coming weeks. FLUX.1 [dev] is the open-weights Flux you can run locally today.

If you read our September comparison of Midjourney, GPT Image 2.5, and Flux, you know Flux won on photorealistic lighting and detail — this is the hands-on sequel: run the winning model on your own machine. Six steps: accept the license, install diffusers, generate a first image with the model card's own code, tune the three knobs that matter, switch to the fast [schnell] variant for iteration, and squeeze the model onto a smaller GPU. Nothing here needs an API key or a subscription — the only account is a free Hugging Face login, and the only bill is electricity.

What you'll need

  • A machine with Python 3.10 or newer and an NVIDIA GPU. A 24GB card (RTX 4090 class) runs the model in VRAM comfortably; smaller cards work with CPU offload in Step 6, slower.
  • About 25GB of free disk for the model weights, plus room for PyTorch and the two text encoders.
  • A free Hugging Face account. FLUX.1 [dev] is gated: you accept its Non-Commercial license on the model page before the download works.

Step 1: Accept the license and log in to Hugging Face

Open the FLUX.1 [dev] model page, sign in, and accept the license. The weights are gated behind that click — the download below fails without it. Then log in from your terminal so the download can use your account:

huggingface-cli login

Paste a read token from your Hugging Face settings when prompted. If you would rather not store a login, set the HF_TOKEN environment variable to the same token instead — either way, the token only ever goes to Hugging Face.

Step 2: Install diffusers and PyTorch

Make a virtual environment and install diffusers. The model card's own instructions are one line:

python3 -m venv flux-env
source flux-env/bin/activate
pip install -U diffusers

That pulls in PyTorch, transformers, and accelerate as dependencies — no separate install needed. Confirm the install and that your GPU is visible:

python -c "import diffusers, torch; print(diffusers.__version__, torch.__version__, torch.cuda.is_available())"

You want True at the end. If it prints False, your PyTorch build has no CUDA support — install the CUDA build from PyTorch's own install page for your driver version and try again.

Step 3: Generate your first image

This is the model card's sample code, unchanged. It loads the pipeline in bfloat16, offloads to CPU where needed, and generates a 1024×1024 image from a prompt:

import torch
from diffusers import FluxPipeline

pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)

pipe.enable_model_cpu_offload() #save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power

prompt = "A cat holding a sign that says hello world"
image = pipe(
    prompt,
    height=1024,
    width=1024,
    guidance_scale=3.5,
    num_inference_steps=50,
    max_sequence_length=512,
    generator=torch.Generator("cpu").manual_seed(0)
).images[0]

image.save("flux-dev.png")

Save it as flux.py and run python flux.py. The first run downloads roughly 24GB of weights, so it takes a while; later runs reuse the cache. Generation itself takes a few minutes on an offloaded setup, well under a minute with the model fully in VRAM. The result is flux-dev.png — and the prompt is a deliberate test: a cat holding a sign with legible text. Readable in-image text is one of the things Flux is known for, and it is the fastest way to tell a good run from a bad one.

Colourful buttons on a wooden floor spelling out the word DEV, a FLUX.1 sample image showing legible in-image text
Buttons spelling “DEV” on a wooden floor. Legible in-image text is one of FLUX.1's signature strengths — the model card's own sample grid shows it off. Sample outputs: Black Forest Labs.

Step 4: Tune guidance, steps, and the seed

Three knobs control the output, and the model card's values are the sane defaults:

  • guidance_scale (3.5): how literally the image follows the prompt. Raise it and the image sticks closer to your words; lower it and the model takes more freedom.
  • num_inference_steps (50): how many refinement passes the model makes. The card's 50 is the quality default — fewer steps are faster and rougher.
  • generator=torch.Generator("cpu").manual_seed(0): the seed. Same prompt plus same seed gives the same image, every time. Change the number to explore variations of the same prompt.

Two more worth knowing: max_sequence_length caps how much of a long prompt the text encoder reads (512 by default), and height/width set the aspect — the diffusers docs use 768×1360 for a landscape frame, for example. Change one knob at a time and keep the seed fixed, or you will not know which change did what. If legible text inside images is your main interest rather than general generation, our hands-on guide to MOSS-Image covers a model built specifically for text rendering and layout.

A close-up of a yellow crocheted toy duck with visible yarn texture, a FLUX.1 sample image showing fine material detail
A crocheted duck, down to the yarn. The 12-billion-parameter model holds fine material texture well at 1024×1024 — try a close-up prompt of your own and compare. Sample outputs: Black Forest Labs.

Step 5: Go faster with FLUX.1 [schnell]

Fifty steps is slow when you are iterating on a prompt. FLUX.1 [schnell] is the timestep-distilled sibling: same family, Apache 2.0 license, and it needs just 4 steps. The diffusers docs give its exact recipe — guidance_scale must be 0 and max_sequence_length no more than 256:

import torch
from diffusers import FluxPipeline

pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16)
pipe.enable_model_cpu_offload()

prompt = "A cat holding a sign that says hello world"
image = pipe(
    prompt,
    height=1024,
    width=1024,
    guidance_scale=0.0,
    num_inference_steps=4,
    max_sequence_length=256,
    generator=torch.Generator("cpu").manual_seed(0)
).images[0]

image.save("flux-schnell.png")

Use [schnell] for prompt iteration and [dev] for the final render — that is the practical split. It is a separate download of roughly the same size, so budget the disk.

Step 6: Fit it on a smaller GPU

If your card has less than 24GB, do not try to load the whole pipeline into VRAM. Two moves from the diffusers docs cover it. First, keep enable_model_cpu_offload() from Step 3 — it is already in the code. For tighter cards, switch to sequential offload and let the VAE work in tiles:

pipe.enable_sequential_cpu_offload()
pipe.vae.enable_slicing()
pipe.vae.enable_tiling()

That is the documented low-VRAM path: slower, but it runs. The docs also show an FP8 path using the optimum-quanto library that fits the model under 16GB. Expect minutes per image on these paths, not seconds — the model is 12 billion parameters, and there is no free lunch, only trade-offs between memory, speed, and quality.

What you built

A local image generator: a prompt in, a PNG out, no account beyond Hugging Face, no per-image bill, and reproducible results from fixed seeds. You have the quality path ([dev], 50 steps), the fast path ([schnell], 4 steps), and the low-VRAM path (offload plus tiling) — the same three choices you will reach for in every local image project after this one.

Honest limitations

Four things to know before you build on this. First, the license: the weights are under a Non-Commercial license, so running the model inside a commercial product needs a license from Black Forest Labs — check the license on the model page before you ship anything. Second, it is heavy: a ~24GB download and minutes per image on offloaded hardware. Third, this is not Flux 2 or Flux 3 — their multi-step region editing and 4K outputs are API-only for now; if you need those, the API is the only route, and Flux 3's launch is where we covered them. Fourth, prompt following is not perfect — the model card itself warns outputs may not match the prompt, so iterate with seeds rather than trusting the first render. And the usual model-card caveat applies: as a statistical model trained on internet-scale data, it can amplify existing biases.

Frequently asked questions

Can I use FLUX.1 [dev] in a commercial product?

Not under the weights' license alone. FLUX.1 [dev] is released under a Non-Commercial license, so running the model as part of a commercial product needs a license from Black Forest Labs. Images you generate can be used for personal, scientific, and commercial purposes as described in that license — read it on the model page before you rely on it. The [schnell] variant is the exception: it is Apache 2.0.

How much GPU memory do I need to run FLUX.1 [dev]?

A 24GB card (RTX 4090 class) runs the model in VRAM comfortably — the bfloat16 weights alone are about 24GB. On smaller cards, enable_model_cpu_offload() trades speed for lower VRAM, sequential offload with VAE slicing and tiling goes further, and the diffusers docs show an FP8 path with optimum-quanto that fits under 16GB.

FLUX.1 [dev] or FLUX.1 [schnell] — which should I use?

Use [dev] for final renders and [schnell] for iterating. [dev] is guidance-distilled and runs 50 steps at guidance_scale 3.5 for the best quality; [schnell] is timestep-distilled, needs just 4 steps at guidance_scale 0, and is Apache 2.0 licensed. Same prompt, same seed, different trade-off — that is the whole difference.