ComfyUI で FLUX.2 klein 9B を使う
カテゴリ:deeplearning
Klein はテキストエンコーダーに Qwen 3 8B を使う。dev は Mistral-Small-3.2-24B-Instruct-2506。
目次
必要スペック
最新の ComfyUI は VRAM の量は重要ではなくなっている。なぜなら RAM にモデルをロードして、必要な分を VRAM に転送して処理するようなアルゴリズムになったからだ。画像生成 AI は演算ボトルネックなので、RAM からモデルを転送しつつ推論しても生成速度はほとんど低下しない。
8bit 量子化なら、テキストエンコーダー 8.7 GB、モデル 10 GB なので RAM 32 GB で実行可能。
FLUX.2 dev はテキストエンコーダー 24B、モデル 32B と巨大で、RAM の要求量も大きかった。
モデル
FLUX.2 は精度が高い順に max, pro, flex, dev, klein。
flux-2-klein-9b は4ステップ蒸留モデル。ベースモデルは base がつく(FLUX.2-klein-base-9B)。
| 配置場所 | URL |
|---|---|
| models/unet | unsloth/flux-2-klein-9b-Q8_0.gguf |
| models/text_encoders | Comfy-Org/qwen_3_8b_fp8mixed.safetensors |
| models/vae | diffusion_pytorch_model.safetensors(公式 VAE) 紛らわしいので flux2_vae とかにリネームした方がいい |
ワークフロー
FLUX.2 [klein] 4B & 9B - Fast local image editing and generation からダウンロードできる。
画像を複数枚入力するときは、ReferenceLatent を追加する。klein は最大で4枚の画像入力に対応している。
実行速度
環境
- OS:Win11 24H2
- RAM:DDR4 32GB
- GPU:RTX3050
- VRAM:8 GB
- Python 3.12.9
- torch 2.9.1+cu128
- triton_windows-3.5.1.post23
- SageAttention v2.2.0-windows.post4
入力画像なし
| 出力解像度 | 推論速度 (s/it) |
|---|---|
| 1,024 x 1,024 | 5.9 |
| 1,024 x 1,536 | 8.3 |
入力画像あり
| 入力解像度 | 出力解像度 | 推論速度 (s/it) |
|---|---|---|
| 846 x 1,240 | 846 x 1,240 | 10.8 |
| 846 x 1,240 | 768 x 1,536 | 11.6 |
| 846 x 1,240 | 1,536 x 1,024 | 13.3 |
プロンプト
プロンプトから入力画像を参照するには @image1 や @image2 のように指示する。
作例
# person There are three girls in a room. - left: short red hair and blue eyes. She is sitting on a stool holding a card with the word "左" written on it. - middle: long silver hair and red eyes. She is standing and holding a card with the word "中" written on it in both hands. - right: medium brown hair and green eyes. She is sitting on a stool and holding a card with the word "右" written on it. # background potted plants and a kitchen. # style Anime style.
Remove the hair red and black ornament on her upper head. Remove the waist red and black ornament on her left and right waist. Do not change any irrelevant parts.
Create her reference sheet on a pure white background. Draw following four different angles: - front view on the far left - left view that facing to the left with her entire body on the middle left - right view that facing to the right with her entire body on the middle right - back view on the far right
dskjal/comfyui-text-renderer でテキストを画像としてレンダリングし、入力している。
The illustration of a chibi girl sitting in a chair eating a piece of pizza. There is a table and a window in the indoor room. # speech bubbles There is two speech bubbles in vertical writing. - "日本語の フキダシを ちゃんと縦に 書けるかな?" - "うまく描けない 部分はフキダシで 隠しちゃおう!!"
入力画像は虎ノ門三丁目方面改札を示す矢印(虎ノ門ヒルズ駅)の無料の写真素材 (c) unific。
A young woman is standing on a subway platform in the @image1. She is short black hair, wearing a light gray cap, a light colored cropped top and short black pants. She is holding an iPhone in her left hand. # background There are signs, Braille blocks and blurred figures, with a sense of urban transit in the subway station. There is a sign written "出口" on it. # style japanese manga, line art, pen art, black and white, halftone







