Install Triton and Sage Attention on Windows with RTX 50XX

詳細

ファイルをダウンロード

モデル説明

皆さん、こんにちは!私はWindows 11上のRTX 5070TiでTritonとSage Attentionを成功裏に設定し、Wan2.1の生成速度を向上させました。このガイドは、WSLを扱ったりLinuxをインストールしたくない人向けです。詳細については以下のリンクを参照してください:

https://github.com/woct0rdho/triton-windows/?tab=readme-ov-file

https://www.reddit.com/r/comfyui/comments/1j298vc/comfyui_not_recognizing_sageattention/

https://github.com/thu-ml/SageAttention/issues/107

  1. 50XXシリーズGPU用の特別なComfyUIバージョンをダウンロードし、展開してrun_nvidia_gpu.batバッチファイルを実行してください。すべての依存関係がインストールされるまで待ちます。https://github.com/comfyanonymous/ComfyUI/releases/download/latest/ComfyUI_cu128_50XX.7z

  2. MSVCとWindows SDKをインストール

  • 手順

    • Visual Studio ダウンロードからVisual Studio 2022をインストールし、「C++によるデスクトップ開発」を選択してください。

    • PATHに追加

      • cl.exeの場所を確認します(例:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.43.34808\bin\Hostx64\x64)。

      • PATHに追加:

        cmd

        set PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.43.34808\bin\Hostx64\x64

      • または、システム > 詳細設定 > 環境変数 > "Path"の編集から永続的に設定してください。

    • テスト

      • PowerShellを開き、clと入力してください。

      • 期待される出力:Microsoft (R) C/C++ Optimizing Compiler Version 19.43.34808 for x64....

  1. vcredistをインストール
  • 手順

    • MicrosoftからVisual C++ Redistributable (2015-2022)をダウンロードしてください。

    • vc_redist.x64.exeを実行し、インストールしてください。

  1. Tritonをインストール
  • 手順

    • Windows用のプレリリースwheelをインストール:

      cmd

      cd ComfyUI_cu128_50XX\python_embeded python.exe -m pip install https://github.com/woct0rdho/triton-windows/releases/download/v3.2.0%2Bgit8f9b005b-windows.post11/triton-3.2.0+git8f9b005b-cp312-cp312-win_amd64.whl

  1. Python 3.12.8をインストールし、ComfyUI埋め込みPythonを設定
  • 理由:ComfyUIの埋め込みPythonは、Triton/Sage Attention用のヘッダファイルとライブラリを必要とします。

  • 手順

    • Python.orgからPython 3.12.8(Windowsインストーラ)をダウンロードしてください。

    • 一時的なパスにインストールします(例:C:\Python312)。

    • includeとlibsをComfyUIの埋め込みPythonにコピー:

      cmd

      xcopy C:\Python312\include C:\Data\ComfyUI_cu128_50XX\python_embeded\include

      xcopy C:\Python312\libs C:\Data\ComfyUI_cu128_50XX\python_embeded\libs

  1. Sage Attention 1.0.6をインストール
  • 手順

    • Sage Attention 1.0.6をダウンロード https://github.com/thu-ml/SageAttention/tree/sageattention-1

    • ComfyUIフォルダに展開し、setup.pyを添付ファイルで置き換えてください。

    • 埋め込みPythonを使ってインストール:

      cmd

      cd C:\Temp\sageattention-1.0.6 \ComfyUI_cu128_50XX\python_embeded\python.exe setup.py install

前後比較結果

  • テスト環境:512x512のi2v動画、30ステップ、41フレーム、20ブロックスワップ、UniPCサンプラーを使用。Kijaiのmasterから取得したI2V 720p 8fpモデル https://huggingface.co/Kijai/WanVideo_comfy/tree/main

  • SDPAアテンション:約27秒/イテレーション!

  • Sage Attention:約14秒/イテレーション。

  • Sage Attention + TeaCache:約8秒/イテレーション!

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

画像が見つかりません。