|
!pip install omegaconf einops pytorch-lightning==1.6.5 test-tube transformers kornia -e git+https://github.com/CompVis/taming-transformers.git@master |
|
!pip install setuptools==59.5.0 |
|
!pip install pillow==9.0.1 |
|
!pip install torchmetrics==0.6.0 |
|
!pip install -e . |
|
|
|
import torch |
|
from torch import autocast |
|
from diffusers import StableDiffusionPipeline |
|
|
|
model_id = "hakurei/waifu-diffusion" |
|
device = "cuda" |
|
|
|
|
|
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16, revision='fp16') |
|
pipe = pipe.to(device) |
|
|
|
prompt = "touhou hakurei_reimu 1girl solo portrait" |
|
with autocast("cuda"): |
|
image = pipe(prompt, guidance_scale=7.5)["sample"][0] |
|
|
|
image.save("reimu_hakurei.png") |