効率的とは
Devices that everyone in the future will have
未来のみんながつけているデバイス
StableDiffusionより、トレーニング時間も推論時間も短くて済むらしい。
効率的なアーキテクチャを使っているらしい。
コンパクトな潜在表現により、最終的なパフォーマンスを損なうことなく、2 倍以上の速度で推論を実行できるようになり、最先端 (SOTA) 拡散モデルの通常のコストと二酸化炭素排出量を大幅に削減できます。
【二酸化炭素排出量を大幅に削減できます。】というのが2024年っぽい。
ちなみにA100GPUで11秒かかった。速いのかはちょっとわからない。
使用方法
インストール
GitHubリポジトリでもサンプルノートブックがアップされているが、うまくいかなかったのでdiffuserからインストールする。
pip install git+https://github.com/kashif/diffusers.git@a3dc21385b7386beb3dab3a9845962ede6765887
HuggingFaceには
pip install git+https://github.com/kashif/diffusers.git@wuerstchen-v3
とあったけど、壊れていたので過去のコミットを参照した。
実行
import torch
from diffusers import StableCascadeDecoderPipeline, StableCascadePriorPipeline
device = "cuda"
num_images_per_prompt = 2
prior = StableCascadePriorPipeline.from_pretrained("stabilityai/stable-cascade-prior", torch_dtype=torch.bfloat16).to(device)
decoder = StableCascadeDecoderPipeline.from_pretrained("stabilityai/stable-cascade", torch_dtype=torch.float16).to(device)
prompt = "Clothes that make you popular"
negative_prompt = "illustration"
prior_output = prior(
prompt=prompt,
height=1024,
width=1024,
negative_prompt=negative_prompt,
guidance_scale=4.0,
num_images_per_prompt=num_images_per_prompt,
num_inference_steps=20
)
decoder_output = decoder(
image_embeddings=prior_output.image_embeddings.half(),
prompt=prompt,
negative_prompt=negative_prompt,
guidance_scale=0.0,
output_type="pil",
num_inference_steps=10
).images
#Now decoder_output is a list with your PIL images
for i,image in enumerate(decoder_output):
image.save(f"{i}.jpg")
Clothes that make you popular
モテモテになる服
🐣
フリーランスエンジニアです。
AIについて色々記事を書いていますのでよかったらプロフィールを見てみてください。
もし以下のようなご要望をお持ちでしたらお気軽にご相談ください。
AIサービスを開発したい、ビジネスにAIを組み込んで効率化したい、AIを使ったスマホアプリを開発したい、
ARを使ったアプリケーションを作りたい、スマホアプリを作りたいけどどこに相談したらいいかわからない…
いずれも中間コストを省いたリーズナブルな価格でお請けできます。
お仕事のご相談はこちらまで
rockyshikoku@gmail.com
機械学習やAR技術を使ったアプリケーションを作っています。
機械学習/AR関連の情報を発信しています。