跳到正文

正在自动登录…

← 返回项目列表

black-forest-labs/flux-3-image-klein

图像生成图像编辑布局控制

FLUX 3 Image Klein 的参考推理代码,用于文本生成图像、基于最多10张参考图像的编辑以及边界框布局控制,并附带提示词上采样器。适合需要自托管或研究该图像模型的开发者。

AI 中文解读 · 根据仓库描述与 README 生成 · 2026/10/16 15:56:28 · 查看原文

值得看Python应用与服务兼有 研究项目
累计 Stars
129
当前热度
未达当前门槛
仓库创建时间
打开 GitHub ↗项目网站 ↗

选用指南

AI 根据 README 整理 · 2026/10/16 15:56:28

使用方式

通过命令行、Python API 或本地 Demo 使用,支持文本生成图像、图像编辑和边界框布局。

查看 README 依据
> `--no-pup` unless the prompt already is an upsampler caption ([Smaller GPUs](#smaller-gpus)). ### Text to image ```bash python scripts/cli.py "A man walking with his dog, afternoon sun" --model distilled --out out.png --seed 7 ``` Each generated image comes with a `.json` containing the prompt, size, number of steps, guidance value and seed; [examples/README.md](examples/README.md) has the command behind every image in this README. ### Edit an image ```bash python scripts/cli.py "put a red bandana around the dog's neck" --image examples/inputs/3.png --out out.png --seed 22 ```
models = Models({"distilled": str(dit_path("distilled"))}, pup=str(WEIGHTS / "pup"), pup_memory=0.35) image, record = generate(models, "distilled", "a red bicycle leaning on a white wall", images=[], seed=1) image.save("bicycle.png") image, record = generate(models, "distilled", "put a red bandana around the dog's neck", images=[Image.open("examples/inputs/3.png")], seed=22) image.save("bandana.png") ``` `Models` loads once; `generate` also takes `boxes`, `width`, `height`, `steps`, `guidance`, `pup`, `safety`. ## Demo ```bash
python scripts/app.py # http://127.0.0.1:7860; --share for a public link ``` Three tabs: **Layout** (draw boxes, type what goes in each), **Text to image**, **Edit**. `--offload`, `--fp8`, `--nvfp4` and `--no-pup` apply as in the CLI. ## Prompt upsampling The upsampler ([black-forest-labs/flux-3-image-klein-pup](https://huggingface.co/black-forest-labs/flux-3-image-klein-pup), a 9B vision-language model fine-tuned from Qwen3.5-9B) expands a short request into the detailed prompt the model
部署要求

需要 Python 3.12,安装时需指定 PyTorch CUDA 索引;BF16 和 FP8 模式需要 Ada、Hopper 或 Blackwell GPU,NVFP4 需要 Blackwell GPU。

查看 README 依据
![Text-to-image examples](assets/t2i.jpg) ### Editing examples ![editing](assets/editing.jpg) ### Layout examples ![layout](assets/layout.jpg) ### Typography ![typography](assets/typography.jpg) ### Base vs distilled Same prompt, same seed: distilled (16 steps) left, base (50 steps, CFG) right. On one H200 at 1 MP: about 3 s against 12 s per image. ![base vs distilled](assets/base_vs_distilled.jpg) ## Local installation To run FLUX 3 Image Klein in BF16 and FP8: ```bash python3.12 -m venv .venv && . .venv/bin/activate
pip install -e . --extra-index-url https://download.pytorch.org/whl/cu130 ``` To run FLUX 3 Image Klein in BF16, FP8 and NVFP4 (NVFP4 needs a Blackwell GPU): ```bash python3.12 -m venv .venv && . .venv/bin/activate pip install -e '.[nvfp4]' --extra-index-url https://download.pytorch.org/whl/cu130 --extra-index-url https://flashinfer.ai/whl/cu130 ``` The installation was tested on B200; see [Memory](#memory) for other GPUs. ### Weights The fast model with its prompt upsampler, 52 GB: ```bash
![benchmark, distilled](assets/benchmark_distilled.png) ### FLUX 3 Image Klein Base, 50 steps ![benchmark, base](assets/benchmark_base.png) ## Memory Peak GPU memory (nvidia-smi) on a B200 at 1024x1024, text-to-image and an edit with one reference: | | bf16 | `--fp8` | `--nvfp4` | |---|---|---|---| | `cli.py --model distilled --no-pup` | 31 GB | 26 GB | 25 GB | | `cli.py --model base --no-pup` | 31 GB | 29 GB | 26 GB | The upsampler reserves `--pup-memory` of the GPU (default 0.35). `--fp8` needs Ada, Hopper or Blackwell; `--nvfp4`
已知限制

代码没有 int8 路径,在 RTX 30 系列及更老的 GPU 上需使用 ComfyUI 的 int8 文件;提示词上采样器默认启用,禁用会显著降低结果质量。

查看 README 依据
needs Blackwell and the `[nvfp4]` install, not with `--offload`. This code has no int8 path. On GPUs without FP8 (RTX 30 series and older) use the int8 files from [black-forest-labs/flux-3-image-klein-comfy](https://huggingface.co/black-forest-labs/flux-3-image-klein-comfy) in ComfyUI. ## Safety Off by default; `--safety` (CLI) or **Advanced, Safety checks** (demo). Prompts, reference images and outputs are checked for copyrighted characters, brands and public figures (VLM) and for NSFW content (classifier); anything flagged
| Generation and editing, self-hosting | FLUX 3 Image Klein (distilled): the same model in 16 steps without CFG, about 6x faster | | Fine-tuning, LoRA training, research | FLUX 3 Image Klein Base | | An 8 GB GPU (RTX 3070 class) | the int8 files in [ComfyUI](#run-it-elsewhere) | > [!IMPORTANT] > Do not use either model without the [prompt upsampler](#prompt-upsampling). The model is trained on the captions it > writes; a prompt sent as typed gives noticeably weaker results. It is on by default in the CLI, the demo and the > Python API. ### Text-to-image examples

README

正在加载 README…

收录信息

仓库创建时间
2026/10/15 22:50:43
首次达标收录
2026/10/16 15:51:38
统计更新时间
2026/10/22 19:01:03

按创建时长与累计 Stars 判断等级。首次达标收录后,即使未达当前门槛仍保留;累计 Stars 和仓库状态会定期更新。确认只有 README 及辅助文件的仓库会停止公开。

模型评估

值得看加权总分 3.8 / 5

新颖度
3.1
实用价值
4.5
成熟度
4.2
实质含量
3.7

由 Jev 模型根据仓库描述与 README 评估,2026/10/16 15:51:38 生成。评分仅供参考,不是代码、安全或许可证审查;热度等级另按创建时长与累计 Stars 计算。

仓库信息

最近推送
2026/10/17 19:05:36
许可证标识
Apache-2.0
Fork 数
10
当前状态
未归档

收录记录

按创建时长与累计 Stars 首次收录:小火
首次发现项目