PromptZone - AI Prompts, Guides and Tools for Builders

Cover image for FLUX.1 Local Installation Guide: Schnell and Dev in Python
Shreya Alvarez
Shreya Alvarez

Posted on Edited on

FLUX.1 Local Installation Guide: Schnell and Dev in Python

To run FLUX.1 locally, choose the schnell or dev weights and follow the corresponding Diffusers or ComfyUI workflow. These Black Forest Labs text-to-image models use different sampling settings and licenses; the Python example below starts with schnell's documented four-step configuration. 1, 2, 3, 4

Check the FLUX licensing guide when choosing the variant for your intended use.

What are the key facts about running FLUX.1 locally?

Fact Verified detail
Developer Black Forest Labs. 1
Released FLUX.1 launched August 1, 2024. 1
Type Text-to-image flow models; schnell and dev are the local variants covered here. 1, 2
Size or parameters 12 billion parameters for each of schnell and dev. 3, 4
License and access Schnell: Apache 2.0; dev: non-commercial weight license with a separate commercial licensing route. 2
Where it runs Local reference Python code, Diffusers, and ComfyUI. 2, 3, 4

Why start a local FLUX.1 setup with schnell?

Schnell is distilled for generation in one to four inference steps. Its model card provides an explicit pipeline recipe, including zero guidance and a fixed seed example. 3

That makes it a useful installation baseline: you can start from a published configuration and ask whether your environment executes the documented path. The step count does not establish elapsed time on your hardware.

Dev is guidance-distilled and has its own published inference example. Use that configuration when evaluating dev, with its corresponding license and model identifier. 4

Local inference also exposes the selected checkpoint and software configuration. BFL's repository supplies runnable code for its open-weight models, while ComfyUI documents workflows with explicit component loaders. 2, 5

Save that first successful example. Include the model identifier, installed software versions, dimensions, and sampling settings so you have a reference when you later change the environment.

What hardware and model limits affect local FLUX.1?

There is no single memory requirement established by the cited documentation for every local FLUX.1 configuration. Diffusers describes offloading and device placement because large pipelines may exceed available GPU memory. 6

CPU offloading moves model components between CPU and GPU; it does not mean the example runs entirely on the CPU. Diffusers also cautions that even model offloading may leave a component too large for one GPU. 6

Treat a successful run as evidence for that configuration. It does not establish that a larger image, different precision, or another model will run within the same memory budget.

Both model cards warn about prompt-following failures and an inability to provide factual information. Check the scene itself, including object counts and written text, after confirming that the software runs. 3, 4

Schnell and dev have different model licenses. Downloading a checkpoint through a public repository does not make the variants interchangeable for commercial deployment. 2

How do you install and run FLUX.1 locally with Python?

Prepare an isolated environment

BFL's reference installation uses a Python 3.10 virtual environment. Create and activate that environment first, then install a PyTorch build appropriate to your GPU and platform inside it, following the installation link in the Diffusers documentation. 2, 7

python3.10 -m venv .venv
source .venv/bin/activate
Enter fullscreen mode Exit fullscreen mode

After installing PyTorch in the active environment, install the remaining libraries and authenticate with Hugging Face. 7, 8

python -m pip install -U diffusers transformers accelerate huggingface_hub
hf auth login
Enter fullscreen mode Exit fullscreen mode

The activation command above uses a POSIX shell. Hugging Face documents the library installation and CLI authentication; review any access conditions displayed by the selected model repository before downloading. 3, 7, 8

Generate a first image with schnell

Save the following as generate.py and run it with python generate.py. It adapts the official schnell model-card example while keeping its guidance, step count, and sequence-length settings. 3

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()
image = pipe(
    "A yellow kettle on a dark wooden table, soft window light",
    guidance_scale=0.0,
    num_inference_steps=4,
    max_sequence_length=256,
    generator=torch.Generator("cpu").manual_seed(0),
).images[0]
image.save("local-flux.png")
Enter fullscreen mode Exit fullscreen mode

This recipe uses GPU inference with CPU offloading. Follow the Diffusers memory documentation if your hardware needs a different loading strategy; the example is not a promise that all components fit your device. 6

Diagnose the stage that failed

If a model download is denied, check authentication and the repository's access conditions. Use hf auth whoami to confirm the account used by your command-line environment. 8

If loading or inference fails with a memory error, identify which stage raised it. Compare the configuration with Diffusers' documented offloading options before changing several settings at once. 6

Record the error message and the smallest script that triggers it. That gives you a focused case to investigate and avoids mixing a download problem with a sampling or image-quality problem.

Try dev or move to ComfyUI

For dev, use its own model-card example after accepting the repository conditions. It specifies its own guidance and inference-step settings; changing only the model identifier in a schnell recipe is insufficient. 4

For ComfyUI, import the official FLUX.1 workflow and install its listed diffusion model, CLIP/T5 encoders, and VAE. The ComfyUI pillar explains how those nodes fit together. 5

After the baseline works, add your required workflow changes incrementally. Keep a copy of the working version so a later failure does not erase your known starting point.

How do local schnell and dev compare with hosted FLUX?

Option Main deployment distinction
FLUX.1 schnell Downloadable Apache 2.0 model with a few-step generation recipe. 3
FLUX.1 dev Downloadable model with separate sampling settings and non-commercial weight terms. 4
FLUX pro services Hosted inference; BFL describes pro-tier models as having no open weights. 2

What should you check before running FLUX.1 locally?

Can I install FLUX.1 locally?

FLUX.1 schnell and dev have downloadable weights and supported local implementations in Diffusers, ComfyUI, and BFL's reference code. Follow the selected model's documentation and license. 2

Does CPU offloading remove the need for a GPU?

Diffusers CPU offloading for the FLUX.1 example moves model components between CPU and GPU. It reduces GPU residency but still uses GPU inference in this example. 6

Are schnell and dev the same download?

FLUX.1 schnell and dev are separate checkpoints with different sampling recipes and licenses. Use the corresponding repository and example for each model. 3, 4

How long will generation take on my computer?

Measure FLUX.1 model loading and image generation separately on your computer. Record the checkpoint, hardware, precision, image dimensions, and inference steps with each timing.

Sources

Top comments (0)