はいどうもこんにちわのぶっちです。StreamDiffusionのローカルインストールの仕方になります。
StreamDiffusion ローカルインストールの仕方
“StreamDiffusion”は、リアルタイム画像生成を実現するために最適化された新しいパイプラインです。この新しいアプローチは、従来の画像生成パイプラインに比べて非常に高速な処理を提供しています。
StreamDiffusion
https://github.com/cumulo-autumn/StreamDiffusion
Step0: リポジトリのクローン
gitをインストールしているかたはホーム画面でGIT bashでinstallできます。
git clone https://github.com/cumulo-autumn/StreamDiffusion.git
Step1: 仮想環境構築
pipを用いる場合
python -m venv .venv .\.venv\Scripts\activate
Step2: 仮想環境を有効化
./.venv/Scripts/activate
作成した仮想環境をアクティベートするために ./.venv/Scripts/activate
を実行します。これにより、そのターミナルセッションでのPythonの実行やパッケージのインストールが、この仮想環境内で行われるようになります。
Step3: PyTorchのインストール
cudaのバージョンを「nvcc –version」で確認し PyTorchのインストールしてください。
CUDA 12.1
pip3 install torch==2.1.0 torchvision==0.16.0 xformers --index-url https://download.pytorch.org/whl/cu121
Step3: StreamDiffusionのインストール
ユーザー向けなのでこちらをいんすとーるをします。[tensorrt]なしでもいけますが、
pip install git+https://github.com/cumulo-autumn/StreamDiffusion.git@main#egg=streamdiffusion[tensorrt]
TensorRT と pywin32 をwinインストール
python -m streamdiffusion.tools.install-tensorrt pip install pywin32
StreamDiffusion クイックスタート
ターミナルから「cd examples」から試すことができます。
screen
cd examplesから先に以下をインストール
pip install -r screen/requirements.txt
そのまま以下を実行でつかえます。
python screen/main.py
高速にする場合
python screen/main.py --acceleration tensorrt
optimal-performance
cd examplesから以下をmultiかsingleを実行
python optimal-performance/multi.py
python optimal-performance/single.py
txt2img
これはうまくいかない場合があります。出来た画像はexamplesのoutputになります
python txt2img/single.py --output output.png --prompt "A cat with a hat"
A cat with a hatを変えてお好きなプロンプトでぞうぞ
「–negative_prompt」で追加も変更になってます