DPM++ 2M Alt Sampler for ComfyUI

詳細

ファイルをダウンロード

モデル説明

ComfyUI用 DPM++ 2M Alt サンプラ

DPM++ 2M Alt Karras サンプラを ComfyUI で動作するように作成しました。

比較:左 DPMPP 2M Karras | 右 DPMPP 2M Alt Karras

注意:フェイスディテイラーで異なるシードを使用しているため、顔部分は正確な比較ではありません。その他の部分は同じシードを使用しています。

クレジット:hallastore、元のスレッド:https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/8457

手順:

ZIP解凍方法:

  1. 重要: 新しいアップデートでサンプラに影響が出た場合に備えて、以下の2つのファイルをバックアップしてください。

    ComfyUI ポータブル版用:

  • ComfyUI_windows_portable\ComfyUI\comfy\samplers.py

  • ComfyUI_windows_portable\ComfyUI\comfy\k_diffusion\sampling.py

    Automatic 1111用:

  • Stable-diffusion-webui\extensions\sd-webui-comfyui\ComfyUI\comfy\samplers.py

  • Stable-diffusion-webui\extensions\sd-webui-comfyui\ComfyUI\comfy\k_diffusion\sampling.py

  1. ZIPを以下のディレクトリに展開します。
  • ComfyUI ポータブル版: ComfyUI_windows_portable\ComfyUI\comfy

  • Automatic 1111のComfyUI拡張機能用: Stable-diffusion-webui\extensions\sd-webui-comfyui\ComfyUI\comfy

  1. ComfyUI内ではこのサンプラの名前は dpmpp_2m_alt です。

手動方法:

  1. 重要: 新しいアップデートでサンプラに影響が出た場合に備えて、以下の2つのファイルをバックアップしてください。

    ComfyUI ポータブル版用:

  • ComfyUI_windows_portable\ComfyUI\comfy\samplers.py

  • ComfyUI_windows_portable\ComfyUI\comfy\k_diffusion\sampling.py

    Automatic 1111用:

  • Stable-diffusion-webui\extensions\sd-webui-comfyui\ComfyUI\comfy\samplers.py

  • Stable-diffusion-webui\extensions\sd-webui-comfyui\ComfyUI\comfy\k_diffusion\sampling.py

    ヒント: 以下の手順は ComfyUI ポータブル版向けですが、Automatic 1111でも同じです。上記のパスに従って *.py ファイルを編集してください。

  1. ComfyUI_windows_portable\ComfyUI\comfy\samplers.py を開きます。

    KSAMPLER_NAMES を検索します。

  2. dpmpp_2m_alt を新しい値として追加し、ファイルを保存してください。カンマとクォーテーションを忘れずに含めてください。

  3. ComfyUI_windows_portable\ComfyUI\comfy\k_diffusion\sampling.py を開きます。

  4. 以下のコードをコピーします。

    @torch.no_grad()
    def sample_dpmpp_2m_alt(model, x, sigmas, extra_args=None, callback=None, disable=None):
        """DPM-Solver++(2M)."""
        extra_args = {} if extra_args is None else extra_args
        s_in = x.new_ones([x.shape[0]])
        sigma_fn = lambda t: t.neg().exp()
        t_fn = lambda sigma: sigma.log().neg()
        old_denoised = None
    
        for i in trange(len(sigmas) - 1, disable=disable):
            denoised = model(x, sigmas[i] * s_in, **extra_args)
            if callback is not None:
                callback({'x': x, 'i': i, 'sigma': sigmas[i], 'sigma_hat': sigmas[i], 'denoised': denoised})
            t, t_next = t_fn(sigmas[i]), t_fn(sigmas[i + 1])
            h = t_next - t
    
            t_min = min(sigma_fn(t_next), sigma_fn(t))
            t_max = max(sigma_fn(t_next), sigma_fn(t))
    
            if old_denoised is None or sigmas[i + 1] == 0:
                x = (t_min / t_max) * x - (-h).expm1() * denoised
            else:
                h_last = t - t_fn(sigmas[i - 1])
    
                h_min = min(h_last, h)
                h_max = max(h_last, h)
                r = h_max / h_min
    
                h_d = (h_max + h_min) / 2
                denoised_d = (1 + 1 / (2 * r)) * denoised - (1 / (2 * r)) * old_denoised
                x = (t_min / t_max) * x - (-h_d).expm1() * denoised_d
    
            old_denoised = denoised
        return x
    
  5. ファイルの最下部に移動し、以下のスクリーンショットのようにコードを貼り付け、保存します。

    1. ComfyUI内ではこのサンプラの名前は dpmpp_2m_alt です。

このモデルで生成された画像

画像が見つかりません。