> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-docs-recommend-assets-api.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ByteDance USO ComfyUI ネイティブワークフローの例

> ByteDance の USO モデルを用いた統一スタイル・主体駆動型生成

**USO（Unified Style-Subject Optimized）** は、ByteDance の UXO チームが開発したモデルであり、スタイル駆動型および主体駆動型の生成タスクを統合します。\
FLUX.1-dev アーキテクチャを基盤とし、分離学習（disentangled learning）およびスタイル報酬学習（SRL：Style Reward Learning）により、スタイルの類似性と主体の一貫性の両方を実現しています。

USO は以下の3つの主要なアプローチをサポートします：

* **主体駆動型**：主体を新しいシーンに配置しつつ、そのアイデンティティの一貫性を維持
* **スタイル駆動型**：参照画像に基づいて、新しいコンテンツに芸術的スタイルを適用
* **組み合わせ型**：主体参照画像とスタイル参照画像を同時に使用

**関連リンク**

* [プロジェクトページ](https://bytedance.github.io/USO/)
* [GitHub](https://github.com/bytedance/USO)
* [モデル重み](https://huggingface.co/bytedance-research/USO)

## ByteDance USO ComfyUI ネイティブワークフロー

<Tip>
  <Tabs>
    <Tab title="Portable or self deployed users">
      Make sure your ComfyUI is updated.

      * [Download ComfyUI](https://www.comfy.org/download)
      * [Update Guide](/installation/update_comfyui)

      Workflows in this guide can be found in the [Workflow Templates](/interface/features/template).
      If you can't find them in the template, your ComfyUI may be outdated. (Desktop version's update will delay sometime)

      If nodes are missing when loading a workflow, possible reasons:

      1. You are not using the latest ComfyUI version (Nightly version)
      2. Some nodes failed to import at startup
    </Tab>

    <Tab title="Desktop or Cloud users">
      * The Desktop is base on ComfyUI stable release, it will auto-update when there is a new Desktop stable release available.
      * [Cloud](https://cloud.comfy.org) will update after ComfyUI stable release.

      So, if you find any core node missing in this document, it might be because the new core nodes have not yet been released in the latest stable version. Please wait for the next stable release.
    </Tab>
  </Tabs>
</Tip>

### 1. ワークフローと入力

以下の画像をダウンロードし、ComfyUI にドラッグ＆ドロップして、対応するワークフローを読み込みます。

![ワークフロー](https://raw.githubusercontent.com/Comfy-Org/example_workflows/refs/heads/main/flux/bytedance-uso/bytedance-uso.png)

<a className="prose" target="_blank" href="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/refs/heads/main/templates/flux1_dev_uso_reference_image_gen.json" style={{ display: 'inline-block', backgroundColor: '#0078D6', color: '#ffffff', padding: '10px 20px', borderRadius: '8px', borderColor: "transparent", textDecoration: 'none', fontWeight: 'bold', marginRight: '10px'}}>
  <p className="prose" style={{ margin: 0, fontSize: "0.8rem" }}>JSON ワークフローをダウンロード</p>
</a>

<a className="prose" target="_blank" href="https://cloud.comfy.org/?template=flux1_dev_uso_reference_image_gen&utm_source=docs" style={{ display: 'inline-block', backgroundColor: '#28a745', color: '#ffffff', padding: '10px 20px', borderRadius: '8px', borderColor: "transparent", textDecoration: 'none', fontWeight: 'bold'}}>
  <p className="prose" style={{ margin: 0, fontSize: "0.8rem" }}>Comfy Cloud で実行</p>
</a>

以下の画像を入力画像として使用します。

![入力](https://raw.githubusercontent.com/Comfy-Org/example_workflows/refs/heads/main/flux/bytedance-uso/input.png)

### 2. モデルのダウンロードリンク

**checkpoints**

* [flux1-dev-fp8.safetensors](https://huggingface.co/Comfy-Org/flux1-dev/resolve/main/flux1-dev-fp8.safetensors)

**loras**

* [uso-flux1-dit-lora-v1.safetensors](https://huggingface.co/Comfy-Org/USO_1.0_Repackaged/resolve/main/split_files/loras/uso-flux1-dit-lora-v1.safetensors)

**model\_patches**

* [uso-flux1-projector-v1.safetensors](https://huggingface.co/Comfy-Org/USO_1.0_Repackaged/resolve/main/split_files/model_patches/uso-flux1-projector-v1.safetensors)

**clip\_visions**

* [sigclip\_vision\_patch14\_384.safetensors](https://huggingface.co/Comfy-Org/sigclip_vision_384/resolve/main/sigclip_vision_patch14_384.safetensors)

上記すべてのモデルをダウンロードし、以下のディレクトリ構造に配置してください：

```
📂 ComfyUI/
├── 📂 models/
│   ├── 📂 checkpoints/
│   │   └── flux1-dev-fp8.safetensors
│   ├── 📂 loras/
│   │   └── uso-flux1-dit-lora-v1.safetensors
│   ├── 📂 model_patches/
│   │   └── uso-flux1-projector-v1.safetensors
│   ├── 📂 clip_visions/
│   │   └── sigclip_vision_patch14_384.safetensors
```

### 3. ワークフローの操作手順

<img src="https://mintcdn.com/dripart-docs-recommend-assets-api/H4YF5irXqrzGa2HT/images/tutorial/flux/flux1_uso_reference_image_gen.jpg?fit=max&auto=format&n=H4YF5irXqrzGa2HT&q=85&s=74b319cb065a3e4cdf9e2089bf0128e7" alt="ワークフローの操作手順" width="2000" height="1188" data-path="images/tutorial/flux/flux1_uso_reference_image_gen.jpg" />

1. モデルの読み込み：
   * 1.1 `Load Checkpoint` ノードに `flux1-dev-fp8.safetensors` が正しく読み込まれていることを確認
   * 1.2 `LoraLoaderModelOnly` ノードに `dit_lora.safetensors` が正しく読み込まれていることを確認
   * 1.3 `ModelPatchLoader` ノードに `projector.safetensors` が正しく読み込まれていることを確認
   * 1.4 `Load CLIP Vision` ノードに `sigclip_vision_patch14_384.safetensors` が正しく読み込まれていることを確認
2. コンテンツ参照（主体参照）：
   * 2.1 `Upload` をクリックして、提供済みの入力画像をアップロード
   * 2.2 `ImageScaleToMaxDimension` ノードが入力画像をコンテンツ参照用にスケーリングします。512px ではキャラクターの特徴をより多く保持できますが、入力としてキャラクターの顔のみを使用する場合、出力画像でキャラクターが画面を過剰に占めてしまう（または品質が低下する）問題が生じることがあります。1024px に設定すると、より良好な結果が得られます。
3. この例では、`content reference`（コンテンツ参照）の画像入力のみを使用しています。`style reference`（スタイル参照）の画像入力を使用したい場合は、マーカー付きノードグループを `Ctrl+B` でバイパスできます。
4. プロンプトを自由に記述するか、デフォルトのまま使用
5. 必要に応じて出力画像サイズを設定
6. `EasyCache` ノードは推論速度の向上を目的としていますが、画質およびディテールの一部を犠牲にします。不要な場合は `Ctrl+B` でバイパス可能です。
7. `Run` ボタンをクリックするか、ショートカット `Ctrl(Cmd) + Enter` を使用してワークフローを実行

### 4. 補足情報

1. スタイル参照のみのワークフロー：

同一のワークフロー内に、スタイル参照のみを用いるバージョンも提供しています。

<img src="https://mintcdn.com/dripart-docs-recommend-assets-api/H4YF5irXqrzGa2HT/images/tutorial/flux/flux1_uso_reference_image_gen_style_reference_only.jpg?fit=max&auto=format&n=H4YF5irXqrzGa2HT&q=85&s=9c82e76bdce7a68dd689d503a9ab77ec" alt="ワークフロー" width="4366" height="2498" data-path="images/tutorial/flux/flux1_uso_reference_image_gen_style_reference_only.jpg" />\
唯一の違いは、`content reference` ノードを `Empty Latent Image` ノードに置き換え、必要な画像サイズを生成することです。

2. また、`Style Reference` グループ全体を `Ctrl+B` でバイパスすることで、このワークフローをテキストから画像を生成する（text-to-image）ワークフローとしても利用可能です。つまり、本ワークフローには以下の4種類のバリエーションがあります：

* コンテンツ（主体）参照のみを使用
* スタイル参照のみを使用
* コンテンツ参照とスタイル参照を併用
* テキストから画像を生成する（text-to-image）ワークフローとして使用
