Skip to content

Latest commit

 

History

History
115 lines (71 loc) · 3.04 KB

README-ja.md

File metadata and controls

115 lines (71 loc) · 3.04 KB

StreamDiffusion Examples

English | 日本語

StreamDiffusion の使用例です。

README.md に書いてある手順で StreamDiffusion 環境構築及びインストールを行ってください。

TensorRT を用いることで最大パフォーマンスとなります。使用する際は TensorRT を使用した上でコマンドに--acceleration tensorrtを付けてください。 xformersがデフォルトで使用されていますが、これは最速ではありません。

screen/

スクリーンキャプチャをリアルタイムで img2img します。Windows でのみ動作します。

スクリプトを実行すると、半透明のウィンドウが出現します。それをキャプチャしたい位置に合わせてエンターキーを押し、キャプチャ範囲を決定してください。

事前に以下のコマンドを実行して依存関係をインストールする必要があります。

pip install -r screen/requirements.txt

使用方法

python screen/main.py

benchmark/

StreamDiffusion のパフォーマンス測定を行います。

benchmark/multi.pyは並列処理を行いますが、benchmark/single.pyは行いません。

使用方法

python benchmark/multi.py
python benchmark/multi.py --acceleration tensorrt

optimal-performance/

TensorRT で最適化された SD-Turbo を用いて txt2img を実行します。

optimal-performance/multi.pyでは RTX4090 に最適化されたバッチ処理を行いますが、optimal-performance/single.pyは単一バッヂでの処理を行います。

使用方法

python optimal-performance/multi.py
python optimal-performance/single.py

img2img/

img2img を実行します。

img2img/multi.pyは複数の画像が入っているディレクトリを引数として取り、別のディレクトリに img2img の結果を出力します。 img2img/single.pyは画像一枚の img2img を行います。

使用方法

画像 1 枚の img2img:

python img2img/single.py --input path/to/input.png --output path/to/output.png

画像複数枚の img2img(ディレクトリを引数に取ります):

python img2img/multi.py --input ./input --output-dir ./output

txt2img/

txt2img/multi.pyはプロンプトから複数の画像を生成し、txt2img/single.pyは一枚の画像を生成します。

使用方法

一枚だけ生成する場合:

python txt2img/single.py --output output.png --prompt "A cat with a hat"

複数の画像を生成する場合:

python txt2img/multi.py --output ./output --prompt "A cat with a hat"

vid2vid/

vid2vid を実行します。

事前に以下のコマンドを実行して依存関係をインストールする必要があります。

pip install -r vid2vid/requirements.txt

使用方法

python vid2vid/main.py --input path/to/input.mp4 --output path/to/output.mp4