Views
No views yet
![FLUX.1 [dev] Grid](./teaser.png)
FLUX.1 Kontext [dev] is a 12 billion parameter rectified flow transformer capable of editing images based on text instructions.
For more information, please read our blog post and our technical report. You can find information about the [pro] version in here.FLUX.1 Kontext [dev] more efficient.FLUX.1 Kontext [dev], as well as sampling code, in a dedicated github repository.
Developers and creatives looking to build on top of FLUX.1 Kontext [dev] are encouraged to use this as a starting point.1# Install diffusers from the main branch until future stable release
2pip install git+https://github.com/huggingface/diffusers.git1import torch
2from diffusers import FluxKontextPipeline
3from diffusers.utils import load_image
4
5pipe = FluxKontextPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", torch_dtype=torch.bfloat16)
6pipe.to("cuda")
7
8input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png")
9
10image = pipe(
11 image=input_image,
12 prompt="Add a hat to the cat",
13 guidance_scale=2.5
14).images[0]1import torch
2import numpy as np
3from flux.content_filters import PixtralContentFilter
4
5integrity_checker = PixtralContentFilter(torch.device("cuda"))
6image_ = np.array(image) / 255.0
7image_ = 2 * image_ - 1
8image_ = torch.from_numpy(image_).to("cuda", dtype=torch.float32).unsqueeze(0).permute(0, 3, 1, 2)
9if integrity_checker.test_image(image_):
10raise ValueError("Your image has been flagged. Choose another prompt/image or try again.")1@misc{labs2025flux1kontextflowmatching,
2 title={FLUX.1 Kontext: Flow Matching for In-Context Image Generation and Editing in Latent Space}, Add commentMore actions
3 author={Black Forest Labs and Stephen Batifol and Andreas Blattmann and Frederic Boesel and Saksham Consul and Cyril Diagne and Tim Dockhorn and Jack English and Zion English and Patrick Esser and Sumith Kulal and Kyle Lacey and Yam Levi and Cheng Li and Dominik Lorenz and Jonas Müller and Dustin Podell and Robin Rombach and Harry Saini and Axel Sauer and Luke Smith},
4 year={2025},
5 eprint={2506.15742},
6 archivePrefix={arXiv},
7 primaryClass={cs.GR},
8 url={https://arxiv.org/abs/2506.15742},
9}