common.title

Docs
Quantum Circuit
TYTAN CLOUD

QUANTUM GAMING


Overview
Contact
Event
Project
Research

Terms of service (Web service)

Terms of service (Quantum and ML Cloud service)

Privacy policy


Sign in
Sign up
common.title

LCM-LoRA + Style-LoRA の組み合わせで速度向上&スタイル変更。RTX6000adaベンチマーク。

Yuichiro Minato

2024/03/20 14:32

LCMを利用すると、推論ステップを減らせます。さらにLCM-LoRAを利用するとさらに推論ステップを減らせます。

今回はそのLCM-LoRAにさらに通常のDMでのStyle-LoRAを組み合わせてみます。

利用するLoRAは、

LCM-LoRA-SDv1.5(高速化LCM-LoRA)

https://huggingface.co/latent-consistency/lcm-lora-sdv1-5

PixelArtRedmond 1.5V- Pixel Art Loras for SD 1.5!(ピクセル化スタイルLoRA)

https://huggingface.co/artificialguybr/pixelartredmond-1-5v-pixel-art-loras-for-sd-1-5

まずはインストール

!pip install -q diffusers accelerate peft

ベースモデルは、LCMでDreamshaperv7の蒸留モデルを利用します。FP32を採用。

import torch
from diffusers import LCMScheduler, StableDiffusionPipeline

model_id = "SimianLuo/LCM_Dreamshaper_v7"

pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32)
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
pipe.to("cuda")

次にLoRAを適用します。今回は両方ともHuggingFaceにありましたので、直接します。

# load and fuse lcm lora
pipe.load_lora_weights("artificialguybr/pixelartredmond-1-5v-pixel-art-loras-for-sd-1-5")
pipe.load_lora_weights("latent-consistency/lcm-lora-sdv1-5")
pipe.fuse_lora()

プロンプトはいつもの例題を

prompt = "portrait photo of a girl, photograph, highly detailed face, depth of field, moody light, golden hour, style by Dan Winters, Russell James, Steve McCurry, centered, extremely detailed, Nikon D850, award winning photography"

推論ステップ2で実行してみますと、

%%time

disable guidance_scale by passing 0

image = pipe(prompt=prompt, num_inference_steps=2, guidance_scale=0).images[0]
image

めちゃくちゃ早いですね。RTX6000ada。0.5秒で終わります。

CPU times: user 752 ms, sys: 102 ms, total: 853 ms
Wall time: 497 ms

試しにLCM-LoRAを切ってみて推論してみました。

絵柄がだいぶ変わりました。LoRAが複数当たっていたことがきちんと確認できました。以上です。

© 2025, blueqat Inc. All rights reserved