BentoDiffusion
1.0.0
このリポジトリには、一連のBENTOML例プロジェクトが含まれており、テキストプロンプトに基づいて画像またはビデオクリップの生成と操作に特化した、安定した拡散(SD)ファミリーにさまざまなモデルを展開する方法を示しています。
Bentomlの例プロジェクトの完全なリストについては、こちらをご覧ください。
次のガイドでは、SDXLターボを例として使用しています。
ローカルでサービスをテストしたい場合は、少なくとも12GB VRAMのNVIDIA GPUを使用することをお勧めします。
git clone https://github.com/bentoml/BentoDiffusion.git
cd BentoDiffusion/sdxl-turbo
# Recommend Python 3.11
pip install -r requirements.txtservice.pyのBentomlサービスを定義しました。プロジェクトディレクトリでbentoml serveを実行して、サービスを開始します。
$ bentoml serve .
2024 - 01 - 18 T18 : 31 : 49 + 0800 [ INFO ] [ cli ] Starting production HTTP BentoServer from "service:SDXLTurboService" listening on http : // localhost : 3000 ( Press CTRL + C to quit )
Loading pipeline components ...: 100 %サーバーは、http:// localhost:3000でアクティブになりました。 Swagger UIまたは他の異なる方法でそれを使用することができます。
カール
curl -X ' POST '
' http://localhost:3000/txt2img '
-H ' accept: image/* '
-H ' Content-Type: application/json '
-d ' {
"prompt": "A cinematic shot of a baby racoon wearing an intricate italian priest robe.",
"num_inference_steps": 1,
"guidance_scale": 0
} 'Pythonクライアント
import bentoml
with bentoml . SyncHTTPClient ( "http://localhost:3000" ) as client :
result = client . txt2img (
prompt = "A cinematic shot of a baby racoon wearing an intricate italian priest robe." ,
num_inference_steps = 1 ,
guidance_scale = 0.0
)サービスコードの詳細な説明については、安定した拡散XLターボを参照してください。
サービスの準備ができたら、より良い管理とスケーラビリティを得るために、アプリケーションをBentocloudに展開できます。 Bentocloudアカウントを持っていない場合はサインアップしてください。
Bentocloudにログインしていることを確認してから、次のコマンドを実行して展開します。
bentoml deploy .アプリケーションがBentocloudで稼働していると、露出したURLを介してアクセスできます。
注:独自のインフラストラクチャでのカスタム展開については、BENTOMLを使用してOCI準拠の画像を生成します。
別の拡散モデルを展開するには、このリポジトリの対応するサブディレクトリに移動します。