mirror of
https://www.modelscope.cn/black-forest-labs/FLUX.2-klein-9b-fp8.git
synced 2026-04-02 10:52:54 +08:00
Update README.md (batch 1/1)
This commit is contained in:
59
README.md
59
README.md
@ -21,65 +21,10 @@ library_name: diffusers
|
|||||||

|

|
||||||

|

|
||||||
|
|
||||||
The FLUX.2 [klein] model family are our fastest image models to date. FLUX.2 [klein] unifies generation and editing in a single compact architecture, **delivering state-of-the-art quality with end-to-end inference in as low as under a second**. Built for applications that require real-time image generation without sacrificing quality.
|
`FLUX.2 [klein] 9B` is a 9 billion parameter rectified flow transformer capable of generating images from text descriptions and supports multi-reference editing capabilities.
|
||||||
|
|
||||||
FLUX.2 [klein] 9B is a 9 billion parameter rectified flow transformer capable of generating images from text descriptions and supports multi-reference editing capabilities.
|
|
||||||
|
|
||||||
Our flagship small model. Defines the Pareto frontier for quality vs. latency across text-to-image, single-reference editing, and multi-reference generation. Matches or exceeds models 5x its size—in under half a second. Built on a 9B flow model with 8B Qwen3 text embedder, step-distilled to 4 inference steps.
|
|
||||||
|
|
||||||
This repository holds an FP8 version of FLUX.2 [klein] 9B. The main repository of this model (full BF16 weights) can be found [here](https://huggingface.co/black-forest-labs/FLUX.2-klein-9B).
|
|
||||||
|
|
||||||
For more information, please read our [blog post](https://bfl.ai/blog/flux2-klein-towards-interactive-visual-intelligence).
|
For more information, please read our [blog post](https://bfl.ai/blog/flux2-klein-towards-interactive-visual-intelligence).
|
||||||
|
|
||||||
# **Key Features**
|
This repository holds an [FP8 version](https://huggingface.co/black-forest-labs/FLUX.2-klein-9b-fp8/blob/main/flux-2-klein-9b-fp8.safetensors) of FLUX.2 [klein] 9B. The main repository of this model (full BF16 weights) can be found [here](https://huggingface.co/black-forest-labs/FLUX.2-klein-9B).
|
||||||
|
|
||||||
1. A distilled model for sub-second image generation with outstanding quality.
|
|
||||||
2. Text-to-image and image-to-image multi-reference editing in a single unified model.
|
|
||||||
3. Great for real-time generation and integration into applications.
|
|
||||||
4. Ideal for creative exploration with excellent prompt adherence and output diversity.
|
|
||||||
5. Available for non-commercial use.
|
|
||||||
|
|
||||||
# **Usage**
|
|
||||||
|
|
||||||
We provide a reference implementation of FLUX.2 [klein] 9B, as well as sampling code, in a dedicated [GitHub repository](https://github.com/black-forest-labs/flux2). Developers and creatives looking to build on top of FLUX.2 [klein] 9B are encouraged to use this as a starting point.
|
|
||||||
|
|
||||||
## **API Endpoints**
|
|
||||||
|
|
||||||
The FLUX.2 [klein] 9B model is available via the BFL API:
|
|
||||||
|
|
||||||
- [bfl.ai](https://bfl.ai)
|
|
||||||
|
|
||||||
FLUX.2 [klein] 9B is also available in both [ComfyUI](https://github.com/comfyanonymous/ComfyUI) and [Diffusers](https://github.com/huggingface/diffusers).
|
|
||||||
|
|
||||||
## **Using with Diffusers 🧨**
|
|
||||||
|
|
||||||
To use FLUX.2 [klein] 9B with the 🧨 Diffusers python library, first install or upgrade diffusers:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
pip install -U diffusers
|
|
||||||
```
|
|
||||||
Then you can use Flux2KleinPipeline to run the model:
|
|
||||||
```python
|
|
||||||
import torch
|
|
||||||
from diffusers import Flux2KleinPipeline
|
|
||||||
|
|
||||||
device = "cuda"
|
|
||||||
dtype = torch.bfloat16
|
|
||||||
|
|
||||||
pipe = Flux2KleinPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-9B", torch_dtype=dtype)
|
|
||||||
pipe.enable_model_cpu_offload() # save some VRAM by offloading the model to CPU
|
|
||||||
|
|
||||||
prompt = "A cat holding a sign that says hello world"
|
|
||||||
image = pipe(
|
|
||||||
prompt,
|
|
||||||
height=1024,
|
|
||||||
width=1024,
|
|
||||||
guidance_scale=4.0,
|
|
||||||
num_inference_steps=4,
|
|
||||||
generator=torch.Generator(device=device).manual_seed(0)
|
|
||||||
).images[0]
|
|
||||||
image.save("flux-klein.png")
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
---
|
||||||
Limitations
|
Limitations
|
||||||
|
|||||||
Reference in New Issue
Block a user