A step-by-step guide to installing and using the powerful gated model from Hugging Face.
What is FLUX.1-schnell?
FLUX.1-schnell is a cutting-edge image generation model developed by Black Forest Labs. It builds on Hugging Face’s diffusers
framework and offers high-performance, fast image synthesis — ideal for creatives, researchers, and developers alike.
However, it’s a gated model, which means you need to request access before using it.
How to Get Access
- Visit the model page:
https://huggingface.co/black-forest-labs/FLUX.1-schnell - Click the “Request Access” button (requires a free Hugging Face account)
- Once approved, you’ll see a message confirming access has been granted.
How to Install FLUX.1-schnell Locally
1. Clone the GitHub Repository
git clone https://github.com/black-forest-labs/flux.git
cd flux
2. Set Up a Virtual Environment
sudo apt install python3.10-venv # If needed
python3 -m venv venv
source venv/bin/activate
3. Create and Add Dependencies
Create a requirements.txt
file with the following:
torch
transformers
accelerate
safetensors
sentencepiece
git+https://github.com/huggingface/diffusers.git
Then install:
pip install -r requirements.txt
Generate Your First Image
After installation, create a file named generate_image.py
with the following code:
import torch
from diffusers import FluxPipeline
pipe = FluxPipeline.from_pretrained(
"black-forest-labs/FLUX.1-schnell",
use_auth_token=True, # Uses your Hugging Face CLI login
torch_dtype=torch.bfloat16
)
pipe.enable_model_cpu_offload()
image = pipe(
prompt="A futuristic cityscape at night",
output_type="pil",
num_inference_steps=4,
generator=torch.Generator("cpu").manual_seed(42)
).images[0]
image.save("flux_image.png")
To run the script:
python3 generate_image.py
Tip: Authenticate Hugging Face Access
Run this command once to authenticate with Hugging Face:
pip install huggingface_hub
huggingface-cli login
Paste your token from: huggingface.co/settings/tokens
Result
The script will generate an image like this and save it as flux_image.png
. You can customize the prompt, seed, and steps to create different styles.
Final Thoughts
FLUX.1-schnell is a powerful model that rivals other image generators in speed and quality. While access is gated, setup is straightforward, and the creative potential is huge.
Whether you’re an artist, developer, or AI enthusiast — this model is definitely worth exploring.
Leave a Reply