> For the complete documentation index, see [llms.txt](https://unsloth.ai/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unsloth.ai/docs/jp/moderu/flux-3.md).

# FLUX 3 Image：ローカル環境での実行方法

Unsloth FP8とGGUF量子化を使って、FLUX.3 Image Kleinをローカルで実行・ファインチューニングする方法を紹介します。プロンプトの強化、画像編集、LoRAトレーニングにも対応しています。

**FLUX.3 Image Klein** はBlack Forest Labsの5.6Bテキスト・画像生成および画像編集モデルです。Qwen3-VL-4Bテキストエンコーダーと **16ステップ**を使用します。1024 × 1024の画像は、 **3～5秒** で生成できます（40 GBのA100上でUnslothを使用した場合）。

{% columns %}
{% column width="50%" %}
Kleinでは、長く詳細なプロンプトが効果的です。 **プロンプトエンハンサー** を使えば、短いアイデアからプロンプトを作成できます。

量子化モデルには [Unsloth Dynamic](https://unsloth.ai/docs/basics/dynamic-3.0-ggufs)を使用しており、重要なレイヤーは高精度に保たれます。次の環境で実行できます。 [Unsloth](https://unsloth.ai/docs/jp/desktop.md)、stable-diffusion.cppなど。

* FLUX.3 Image Klein： [GGUF](https://huggingface.co/unsloth/flux-3-image-klein-GGUF) • [FP8](https://huggingface.co/unsloth/flux-3-image-klein-FP8)
* FLUX.3 Image Klein Base： [GGUF](https://huggingface.co/unsloth/flux-3-image-klein-base-GGUF) • [FP8](https://huggingface.co/unsloth/flux-3-image-klein-base-FP8)
* プロンプトエンハンサー： [GGUF](https://huggingface.co/unsloth/flux-3-image-klein-pup-GGUF)

NVIDIA A100（40 GB）でUnsloth 2026.11.4を使用してテスト済み。
{% endcolumn %}

{% column width="50%" %}

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FQTjIpy3wMaxquGwfFjXu%2Fflux-3-image-klein-out-lighthouse-enhanced.webp?alt=media" alt="Photo of a white lighthouse with a lit lamp and a keeper&#x27;s cottage on a rocky coast at sunset"><figcaption><p>UD-Q4_K_XL、エンハンサー有効。プロンプト：「黄金色の時間帯、海岸の崖の上に立つ灯台」</p></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

<div><figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FAUr9I8myeHeT9jCPPdV3%2Fflux-3-image-klein-out-bison.webp?alt=media" alt="A bison in a misty geothermal landscape at dawn"><figcaption><p>GGUF UD-Q4_K_XL</p></figcaption></figure> <figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fv7aDDYG13wwm4n2gTUCX%2Fflux-3-image-klein-out-cafe.webp?alt=media" alt="A chalkboard sign that reads Unsloth Coffee outside a cafe"><figcaption><p>FP8リポジトリ、bf16</p></figcaption></figure> <figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FpqnjARNGI1y6IQ7dB6k5%2Fflux-3-image-klein-out-robot.webp?alt=media" alt="A small knitted robot next to a houseplant on a windowsill"><figcaption><p>FP8リポジトリ、INT8</p></figcaption></figure></div>

### KleinとKlein Baseの違い <a href="#klein-or-klein-base" id="klein-or-klein-base"></a>

| モデル                         | ステップ数とガイダンス     | 用途                               |
| --------------------------- | --------------- | -------------------------------- |
| **FLUX.3 Image Klein**      | 16ステップ、ガイダンス1   | 画像の生成と編集。 **まずはこちらから。**          |
| **FLUX.3 Image Klein Base** | 50ステップ、ガイダンス3.5 | [LoRAのトレーニング](#train-a-lora) と研究 |

KleinはBaseから蒸留されています。Unslothは両方のステップ数とガイダンスを設定します。ここでテストしたのはKleinのみです。

### 必要なメモリ <a href="#memory-requirements" id="memory-requirements"></a>

| お使いのハードウェア            | まずは次のモデルをお試しください                                       |
| --------------------- | ------------------------------------------------------ |
| **24 GB以上のGPU**       | **FLUX.3 Image Klein（Fast FP8）**。Unslothが適合する精度を選択します。 |
| **12～16 GBのGPU**      | GGUF **UD-Q4\_K\_XL**。エンハンサーをオフにする必要がある場合があります。        |
| **GPUメモリが8 GB以下**     | GGUF **UD-Q3\_K\_XL** または **UD-Q2\_K\_XL**、エンハンサーオフ    |
| **メモリが16 GB以上のMac**   | GGUF **UD-Q4\_K\_XL**                                  |
| **CPUのみ、RAM 16 GB以上** | GGUF **UD-Q4\_K\_XL** （低速）                             |

その他の行は推定値です。40 GBのA100で測定（`nvidia-smi`、上限値）：

| 読み込んだもの                                 | 使用中のGPUメモリ |
| --------------------------------------- | ---------- |
| GGUF UD-Q4\_K\_XL + INT8テキストエンコーダー、待機状態 | 9.3 GB     |
| 同じ構成にプロンプトエンハンサーを追加                     | 約17 GB     |
| 同じ構成、生成中                                | 約22 GB     |
| 高速FP8構成（bf16ウェイト）+ エンハンサー、編集中           | 約27 GB     |

stable-diffusion.cppで使用したUD-Q4\_K\_XL + Q8\_0テキストエンコーダー + VAE **VRAM 8.0 GB** （L4）。

#### FP8、INT8、GGUF <a href="#fp8-int8-and-gguf" id="fp8-int8-and-gguf"></a>

* **FLUX.3 Image Klein（高速FP8）** をダウンロードします [FP8リポジトリ](https://huggingface.co/unsloth/flux-3-image-klein-FP8) （約17 GB）。bf16、FP8、INT8のウェイトが含まれています。 **Precision** を **Auto**に設定すると、Unslothは適合するものを選びます。40 GBのA100では **bf16**. **INT8** ではINT8-ConvRotファイルを読み込みます。テキストエンコーダーは常にINT8-ConvRotとして実行されました。 **FP8** にはFP8対応GPUが必要です（未テスト）。
* **flux-3-image-klein-GGUF（低速）** 選択した量子化版のみをダウンロードし、MacやCPUでも実行できます。

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FyPEeQllb7XKpoHewivZV%2Fflux-3-image-klein-precision.png?alt=media" alt="The Advanced settings with the Precision menu open, showing Auto, Off, FP8, INT8 and MXFP8" width="352"><figcaption><p>Advanced → Precision（OFF = bf16）</p></figcaption></figure>

| GGUFファイル         | サイズ    | 注記        |
| ---------------- | ------ | --------- |
| **BF16**         | 11 GB  | フル精度      |
| **Q8\_0**        | 6.1 GB | BF16に最も近い |
| **UD-Q5\_K\_XL** | 4.5 GB |           |
| **UD-Q4\_K\_XL** | 3.9 GB | **推奨**    |
| **UD-Q3\_K\_XL** | 3.3 GB | 小型GPU向け   |
| **UD-Q2\_K\_XL** | 2.6 GB | 最小        |

#### ハードウェアに関する注記 <a href="#hardware-notes" id="hardware-notes"></a>

これらを使用するには、Unsloth 2026.11.5以降が必要です。

* **T4など、bf16に対応していないGPUの場合：** KleinとKlein Baseは、INT8重みを使ってfp16で動作します。1024 x 1024で15 GBのColab T4を使用した場合：

  | タスク                          | 画像あたりの時間 |
  | ---------------------------- | -------- |
  | Klein、テキストから画像生成             | 34～38秒   |
  | Klein Base、テキストから画像生成、12ステップ | 約54秒     |
  | Kleinの編集                     | 約96秒     |
  | Klein Baseの編集                | 約130秒    |

  編集時のGPUメモリ使用量は最大で約9.1 GBです。 **デフォルト** 速度モードは、これらのカードで **オフ** にした場合より遅くなることはなくなりました。LoRAの読み込みとレンダリングは問題なく行えます。トレーニングにはbf16対応GPU（Ampere以降）が必要です。T4ではUnslothは「This trainer requires a bfloat16-capable GPU」というエラーを返して処理を拒否します。
* **Linux上のAMD** （Radeon 8060S、gfx1151）：Klein BaseのLoRAトレーニングは、 **bf16** と **nf4** ベースで動作します。再読み込み、KleinでのLoRA適用レンダリング、エクスポートもすべて問題なく行えます。 **int8**, **fp8** と **mxfp8** ベースはNVIDIA専用です。
* **Windows上のAMD** （gfx1151）：LoRAトレーニングは動作します。C++コンパイラーがない場合はtorch.compileを使わずにトレーニングされ、警告が表示されます。以前のビルドではノイズになっていた512 pxのレンダリングも、現在は正しく生成されます。

### クイックスタート <a href="#quickstart" id="quickstart"></a>

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FGg2Q8Jd4doV8TVHuEbdL%2Fflux-3-image-klein-flow.webp?alt=media" alt="Animation: pick FLUX.3 Image Klein (Fast FP8), type a prompt, click Generate and get a lighthouse on a cliff"><figcaption><p>Unslothのワークフローを高速化</p></figcaption></figure>

{% stepper %}
{% step %}

#### Unslothをインストール <a href="#install-unsloth" id="install-unsloth"></a>

次の [Unslothデスクトップアプリ](https://unsloth.ai/docs/jp/desktop.md) を [macOS](https://unsloth.ai/docs/jp/meru/install/mac.md), [Windows](https://unsloth.ai/docs/jp/meru/install/windows-installation.md) または [Linux](https://unsloth.ai/docs/jp/meru/install/linux.md).

<a href="https://unsloth.ai/download" class="button primary" data-icon="down-to-bracket">Unslothをダウンロード</a>

または、ターミナルから実行します。macOS、Linux、WSLの場合:

{% code collapsedlinecount="10" %}

```bash
curl -fsSL https://unsloth.ai/install.sh | sh
```

{% endcode %}

Windows PowerShellの場合:

{% code collapsedlinecount="10" %}

```powershell
irm https://unsloth.ai/install.ps1 | iex
```

{% endcode %}

次にUnslothを起動し、次のURLを開きます: `http://localhost:8888`:

{% code collapsedlinecount="10" %}

```bash
unsloth studio -H 0.0.0.0 -p 8888
```

{% endcode %}
{% endstep %}

{% step %}

#### 画像を開く <a href="#open-images" id="open-images"></a>

サイドバーで **「Images」** を選択します。 **「Create」** はデフォルトで開きます。

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F8VA0qli15m452CIo2DeL%2Fflux-3-image-klein-images-page.png?alt=media" alt="The Unsloth Images page with the Create workflow open and no model loaded"><figcaption><p>「Images」ページ</p></figcaption></figure>
{% endstep %}

{% step %}

#### FLUX.3 Image Kleinを選択 <a href="#pick-flux.3-image-klein" id="pick-flux.3-image-klein"></a>

「Select image model」を **クリックし、**&#x691C;索欄で `flux-3-image-klein` を検索して、次を選択します:

* **FLUX.3 Image Klein（Fast FP8）**：24 GB以上のNVIDIA GPU向け。
* **flux-3-image-klein-GGUF（低速）**：量子化版を選択します。 **UD-Q4\_K\_XL** がおすすめです。

<div><figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F7ld8GwJlyKwIf9n0WXy2%2Fflux-3-image-klein-picker-search.png?alt=media" alt="Model picker search results for flux-3-image-klein with the Fast FP8, GGUF and Base entries"><figcaption><p>検索結果</p></figcaption></figure> <figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FuwZH1ghawU9coIRFFfQE%2Fflux-3-image-klein-gguf-quants.png?alt=media" alt="The GGUF entry expanded to show its quants, with UD-Q4_K_XL marked recommended"><figcaption><p>GGUF量子化版</p></figcaption></figure></div>

初回の読み込み時に、モデル、Qwen3-VL-4Bテキストエンコーダー、VAEがダウンロードされます。

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FpGtiaObZ9zOIVlRFb72x%2Fflux-3-image-klein-download.png?alt=media" alt="Download panel showing unsloth/flux-3-image-klein-FP8 at 16 of 17 GB" width="400"><figcaption><p>Fast FP8を初めてダウンロード</p></figcaption></figure>
{% endstep %}

{% step %}

#### プロンプトエンハンサーをダウンロード <a href="#download-the-prompt-enhancer" id="download-the-prompt-enhancer"></a>

**プロンプトを強化** はデフォルトで有効ですが、エンハンサーは別途ダウンロードが必要です。「 **Download (6.9 GB)**」をクリックしてください。それまでは、入力したとおりにプロンプトが実行されます。

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F3ImhyuNDB6ajCvlyIvHy%2Fflux-3-image-klein-enhance-download.png?alt=media" alt="Enhance prompt switch with the message that the 6.9 GB prompt upsampler is not downloaded and a Download button" width="400"><figcaption><p>エンハンサーはまだダウンロードされていません</p></figcaption></figure>
{% endstep %}

{% step %}

#### プロンプトを入力して生成 <a href="#write-your-prompt-and-generate" id="write-your-prompt-and-generate"></a>

Unslothでは **16ステップ** と **ガイダンス 1**。保持してください。結果を再現するにはシードを設定します。

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FMnY6sWJJfDmxiIVJ4xSq%2Fflux-3-image-klein-settings.png?alt=media" alt="Create panel with the lighthouse prompt, Enhance prompt on, 1024 by 1024 size, 16 steps and guidance 1" width="432"><figcaption><p>Klein のデフォルト設定</p></figcaption></figure>

**プレビュー** 拡張されたプロンプトを表示します。 **プロンプトとして使用** 編集用のボックスにコピーします。

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FYYLjG5FX73Houj4AuVCE%2Fflux-3-image-klein-enhanced-prompt.png?alt=media" alt="The short lighthouse prompt and, below it, the long enhanced prompt written by the prompt enhancer" width="338"><figcaption><p>拡張プロンプトのプレビュー</p></figcaption></figure>

クリック **生成**. **設定内容** を含むすべての設定を表示します。 **拡張プロンプト**.

<div><figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FYBY7Z8KuulG11IHwzyEa%2Fflux-3-image-klein-result.png?alt=media" alt="Finished image of a lighthouse on a rocky coast at sunset, with the enhanced prompt on the left"><figcaption><p>UD-Q4_K_XL、シード 42</p></figcaption></figure> <figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F6pEui5DMl0ErLuhr9aPu%2Fflux-3-image-klein-recipe.png?alt=media" alt="Recipe card showing the prompt, the enhanced prompt, model, GGUF file, size, time, steps, guidance and seed" width="320"><figcaption><p>設定カード</p></figcaption></figure></div>
{% endstep %}
{% endstepper %}

#### プロンプトエンハンサー <a href="#prompt-enhancer" id="prompt-enhancer"></a>

エンハンサーは [flux-3-image-klein-pup](https://huggingface.co/unsloth/flux-3-image-klein-pup-GGUF)です。9Bモデル（UD-Q4\_K\_XL 6.0 GB + vision file 0.9 GB）で、KleinとともにGPU上で動作します。およそ **7.5 GB** のGPUメモリを追加で使用し、画像ごとに数秒かかります。エンハンサーを使った最初の画像の生成には23.5秒かかりました。メモリが足りない場合は、オフにして長めのプロンプトを書きましょう。設定、被写体、動作、光、スタイルを指定します。

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FGY1Tu4gOxIg3INJktImx%2Fflux-3-image-klein-out-lighthouse-plain.webp?alt=media" alt="Simpler photo of a lighthouse at the end of a grassy cliff path at golden hour" width="400"><figcaption><p>同じプロンプトとシード、エンハンサーオフ（4.3秒）</p></figcaption></figure>

### 画像編集 <a href="#image-editing" id="image-editing"></a>

サイドバーで **編集** を選択し、画像をアップロードして指示を入力し、 **生成**をクリックします。ステップ数は16、ガイダンスは1のままにします。 **画像を追加** すると、参照画像を追加できます。 **プロンプトを強化** をオンにすると、エンハンサーは画像も読み取ります。短く具体的な指示が最適です。

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FWnpm5byWe25kaz6AI8ad%2Fflux-3-image-klein-edit.png?alt=media" alt="Edit workflow with the lighthouse image as the source, the instruction to paint red and white stripes and add a sailboat, the enhanced edit prompt and the result"><figcaption><p>高速FP8エントリー（bf16）：エンハンサーを加えて8.9秒</p></figcaption></figure>

<div><figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fbzd0jcFnSE1JWobeV6R4%2Fflux-3-image-klein-edit-before.webp?alt=media" alt="Original image of a white lighthouse on a grassy cliff at golden hour"><figcaption><p>変更前</p></figcaption></figure> <figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FJHm0cjexC7FEH2RcY0g0%2Fflux-3-image-klein-edit-after.webp?alt=media" alt="Edited image where the lighthouse has red and white stripes and a small sailboat is on the sea"><figcaption><p>「灯台を赤と白の縞模様に塗り、海に小さな帆船を追加する」</p></figcaption></figure></div>

### LoRAをトレーニングする <a href="#train-a-lora" id="train-a-lora"></a>

「 [FLUX 3をファインチューニングする](https://unsloth.ai/docs/jp/moderu/flux-3/fine-tune-flux-3.md)

#### 変更前と変更後 <a href="#before-and-after" id="before-and-after"></a>

Kleinで同じプロンプトとシードを使用。LoRAなし（左）とあり（右）： `a trtcrd of a cat sitting on a throne holding a golden cup, "queen of cats"`.

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FWcXrlSDBcGYYD6BVE7Uj%2Fflux-3-image-klein-lora-before-after.webp?alt=media" alt="A photo-style cat on a throne without the LoRA, and a tarot card cat with the LoRA"><figcaption><p>16ステップ、シード42</p></figcaption></figure>

トリガーワードを含まないプロンプトは、変化がかなり少なくなります。Stable-diffusion.cppは、まだFLUX.3 LoRAを読み込めません。

[ファインチューニングガイドに進む](https://unsloth.ai/docs/jp/moderu/flux-3/fine-tune-flux-3.md#before-and-after)

### コードから実行する <a href="#run-from-code" id="run-from-code"></a>

#### Unsloth API <a href="#unsloth-api" id="unsloth-api"></a>

Unslothには、OpenAI互換の `POST /v1/images/generations` エンドポイントがあります。まず「画像」ページでKleinを読み込みます。リクエストでは、 **リクエストごとに画像モデルと動画モデルを切り替える** が **設定 → API**。そこで API キーも作成します（ [Unsloth API](https://unsloth.ai/docs/jp/ji-chu/api.md)を参照）。サンプルでは、キーを次の場所から読み込みます： `UNSLOTH_API_KEY`.

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FaVPPWWZ0eRFi4YI6Lgyb%2Fflux-3-image-klein-api-settings.png?alt=media" alt="Settings, API page with the Images and Video quickstart and the switch for loading models by request" width="563"><figcaption><p>設定 → API</p></figcaption></figure>

&#x20;`openai` (`pip install openai`):

{% code collapsedlinecount="10" %}

```python
import base64
import os

from openai import OpenAI

client = OpenAI(base_url="http://localhost:8888/v1", api_key=os.environ["UNSLOTH_API_KEY"])

result = client.images.generate(
    model="unsloth/flux-3-image-klein-FP8",
    prompt="A lighthouse on a coastal cliff at golden hour",
    size="1024x1024",
    response_format="b64_json",
    extra_body={"steps": 16, "guidance": 1.0, "seed": 42},
)

with open("lighthouse.png", "wb") as f:
    f.write(base64.b64decode(result.data[0].b64_json))
```

{% endcode %}

&#x20;`curl`:

{% code collapsedlinecount="10" %}

```bash
curl -s http://localhost:8888/v1/images/generations \
  -H "Authorization: Bearer $UNSLOTH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "unsloth/flux-3-image-klein-FP8",
    "prompt": "A lighthouse on a coastal cliff at golden hour",
    "size": "1024x1024",
    "response_format": "b64_json",
    "seed": 7
  }' \
  | python3 -c "import sys, json, base64; open('lighthouse-curl.png', 'wb').write(base64.b64decode(json.load(sys.stdin)['data'][0]['b64_json']))"
```

{% endcode %}

`size` は `WIDTHxHEIGHT`（256～2048、16 の倍数）です。 `steps` と `guidance` のデフォルト値は、それぞれ 16 と 1 です。

**API 経由での LoRA の使用** （Unsloth 2026.11.5 以降）：リクエストに `"loras": [{"id": "my-lora", "weight": 1.0}]` を追加します。ここで、 `id` は LoRA リスト内の名前です。LoRA を使用しない場合は `"loras": []` を指定します。指定しない場合は `loras`、FP8およびINT8で読み込んだモデルでは、読み込み時に指定したLoRAが保持されます。たとえば、 **Createにデプロイ**.

FP8およびINT8で読み込んだモデルでは、モデルの読み込み時にのみLoRAが適用されます。このようなモデルへのリクエストでは、読み込み時に指定したLoRAのすべて、または一部を使用できますが、読み込み時に指定していないLoRAを使うと400エラーが返されます。まず、そのLoRAを指定してモデルを読み込みます。Imagesページで選択して、 **再適用**をクリックするか、モデルの読み込み時に `loras` として送信します。bf16で読み込んだモデル（**精度** を **オフ**に設定）では、リクエストごとに任意のLoRAを指定できます。

{% hint style="info" %}
APIではプロンプト拡張機能は実行されません。詳細なプロンプトを送信するか、Imagesページの **プレビュー** を使って作成してください。
{% endhint %}

#### stable-diffusion.cppでGGUFを使う <a href="#gguf-with-stable-diffusion.cpp" id="gguf-with-stable-diffusion.cpp"></a>

GGUFは、 `sd-cli` を使って、 [stable-diffusion.cpp](https://github.com/unslothai/stable-diffusion.cpp) （Unslothが固定したリリース。プロンプト拡張機能はありません）で実行します。

**1.  `sd-cli`** を入手します（Linux、CUDA 13）。 [リリースページ](https://github.com/unslothai/stable-diffusion.cpp/releases/tag/master-982-0518b34-u27b9ddc) には、CUDA 12、Vulkan、CPU、macOS、Windows向けのビルドもあります。

{% code collapsedlinecount="10" %}

```bash
curl -L -o sd.zip https://github.com/unslothai/stable-diffusion.cpp/releases/download/master-982-0518b34-u27b9ddc/sd-master-982-0518b34-u27b9ddc-bin-Linux-Ubuntu-22.04-x86_64-cuda13.zip
unzip -o sd.zip
mv sd-master-982-0518b34-u27b9ddc-bin-Linux-Ubuntu-22.04-x86_64-cuda13 sd
./sd/sd-cli --version
```

{% endcode %}

**2. モデル、テキストエンコーダー、VAEをダウンロードします** （約8.5 GB）：

{% code collapsedlinecount="10" %}

```bash
pip install -U huggingface_hub
hf download unsloth/flux-3-image-klein-GGUF flux-3-image-klein-UD-Q4_K_XL.gguf --local-dir models
hf download unsloth/Qwen3-VL-4B-Instruct-GGUF Qwen3-VL-4B-Instruct-Q8_0.gguf --local-dir models
hf download unsloth/flux-3-image-klein-FP8 vae/diffusion_pytorch_model.safetensors --local-dir models
```

{% endcode %}

**3. 画像を生成します** （A100で14秒、読み込み時間を含む）：

{% code collapsedlinecount="10" %}

```bash
./sd/sd-cli \
  --diffusion-model models/flux-3-image-klein-UD-Q4_K_XL.gguf \
  --llm models/Qwen3-VL-4B-Instruct-Q8_0.gguf \
  --vae models/vae/diffusion_pytorch_model.safetensors \
  -p "A white lighthouse on a grassy coastal cliff at golden hour, waves breaking on the rocks below, warm low sunlight, soft clouds over the sea, detailed landscape photo" \
  --steps 16 --cfg-scale 1.0 --sampling-method euler \
  -W 1024 -H 1024 --diffusion-fa --seed 42 \
  -o lighthouse-sdcpp.png
```

{% endcode %}

**4. 画像を編集します** （24秒）。 `-r`で参照画像を最大10枚渡せます。変更点だけでなく、編集後の画像全体を説明してください。

{% code collapsedlinecount="10" %}

```bash
./sd/sd-cli \
  --diffusion-model models/flux-3-image-klein-UD-Q4_K_XL.gguf \
  --llm models/Qwen3-VL-4B-Instruct-Q8_0.gguf \
  --vae models/vae/diffusion_pytorch_model.safetensors \
  -r lighthouse-sdcpp.png \
  -p "The same lighthouse on the same coastal cliff at golden hour, now painted with bold red and white horizontal stripes, with a small white sailboat on the sea" \
  --steps 16 --cfg-scale 1.0 --sampling-method euler \
  -W 1024 -H 1024 --diffusion-fa --seed 42 \
  -o lighthouse-sdcpp-edit.png
```

{% endcode %}

<div><figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FvzWfsBB5NEx4aj1sJZxK%2Fflux-3-image-klein-sdcpp-lighthouse.webp?alt=media" alt="White lighthouse on a grassy cliff above breaking waves at golden hour, made with sd-cli"><figcaption><p>sd-cli、シード値 42</p></figcaption></figure> <figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FcDFt1OjcIM85yHspkii0%2Fflux-3-image-klein-sdcpp-edit.webp?alt=media" alt="The same lighthouse painted with red and white stripes, with a small sailboat on the sea"><figcaption><p>sd-cli edit</p></figcaption></figure></div>

Mac または CPU では、アプリで GGUF 量子化モデルを使うか、 `Darwin-macOS-arm64` / CPU `sd-cli` ビルドを使用します（当方では未テスト）。

### 推奨設定 <a href="#recommended-settings" id="recommended-settings"></a>

| 設定              | Unsloth（FP8 または GGUF）        | stable-diffusion.cpp      |
| --------------- | ---------------------------- | ------------------------- |
| **ステップ数**       | **16**                       | `--steps 16`              |
| **ガイダンス / CFG** | **1**                        | `--cfg-scale 1.0`         |
| **サンプラー**       | Unsloth によって設定               | `--sampling-method euler` |
| **ネガティブプロンプト**  | 使用しない                        | 使用しない                     |
| **サイズ**         | `1024×1024` から開始し、最大 2048 まで | `-W 1024 -H 1024`         |
| **プロンプトエンハンサー** | 有効（6.9 GB のダウンロード）           | 利用不可                      |
| **シード値**        | 結果を再現するには任意の数値を指定            | `--seed 42`               |

### 出力例 <a href="#example-outputs" id="example-outputs"></a>

A100 40 GB、1024 × 1024、16 ステップ、ガイダンス 1、シード値 42。

| プロンプト                                              | モデル               | エンハンサー  | 時間            |
| -------------------------------------------------- | ----------------- | ------- | ------------- |
| ゴールデンアワーの海岸沿いの崖に立つ灯台                               | GGUF UD-Q4\_K\_XL | オン      | 23.5 秒（最初の画像） |
| ゴールデンアワーの海岸沿いの崖に立つ灯台                               | GGUF UD-Q4\_K\_XL | オフ      | 4.3 秒         |
| 夜明けの霧に包まれた地熱地帯にいるバイソン                              | GGUF UD-Q4\_K\_XL | オフ（API） | 4.5 秒         |
| 小さなカフェの外にある黒板メニュー。「Unsloth Coffee」と書かれ、朝の光が差し込んでいる | Fast FP8、bf16     | オフ（API） | 3.4 秒         |
| 窓辺で観葉植物に水をやる、小さな編みぐるみのロボット                         | Fast FP8、INT8     | オフ（API） | 2.7 秒         |

読み込み後、Fast FP8で最初の画像を生成するときは、Unslothがモデルをコンパイルするため約16秒かかります。

### トラブルシューティング <a href="#troubleshooting" id="troubleshooting"></a>

<details>

<summary>モデル選択メニューにFLUX.3 Image Kleinが表示されない</summary>

[Unslothを更新して](https://unsloth.ai/docs/get-started/install/updating) 再起動してください。モデルが読み込まれている場合、選択メニューは **On Device**が選択された状態で開きます。 **Recommended**.

</details>

<details>

<summary>「Enhance prompt」がオンなのに、プロンプトが拡張されない</summary>

「 **Download** の下にある「 **Enhance prompt**」をクリックしてください。Recipeには、実行された場合に **Enhanced prompt** の行が表示されます。APIでは実行されません。

</details>

<details>

<summary>GPUメモリが不足する</summary>

「 **Enhance prompt** 」をオフにするか、UD-Q3\_K\_XLなど、より小さい量子化モデルを使用してください。

</details>

<details>

<summary>APIが指定したモデルを無視する</summary>

ImagesページでKleinを読み込むか、 **リクエストに応じて画像モデルと動画モデルを切り替える** を **Settings → API**.

</details>

<details>

<summary>sd-cliでlibcudart.so.12またはlibcudart.so.13が見つからないというエラーが表示される</summary>

CUDA 13対応の `cuda13` ZIPファイル、CUDA 12対応の `cuda12` ZIPファイル、またはVulkanビルドを使用してください。

</details>

こちらもご覧ください [画像拡散モデルをローカルで実行する方法](https://unsloth.ai/docs/jp/ji-chu/diffusion-image.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://unsloth.ai/docs/jp/moderu/flux-3.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
