SYSTEM NOTICE

Auto translation by AI. Be sure, accuracy, nuances and authorial intent may not be fully reflected.
見出し画像

Getting Started with Waifu Diffusion v1.3 on Google Colab

I tried out "Waifu Diffusion v1.3". The changes are in the diffusers version and the default pipeline settings provided by the official source.

・Diffusers v0.4.1
・Waifu Diffusion v1.3

1. Waifu Diffusion v1.3

"Waifu Diffusion v1.3" is the latest version of an image generation AI created by fine-tuning "Stable Diffusion" on a dataset of 2D illustrations.

2. Execution on Colab

The steps for execution on Colab are as follows.

(1) Open a new Colab notebook and select "GPU" from the menu under "Edit -> Notebook settings".

(2) Install the packages.
The diffusers version is now 0.4.1.

# パッケージのインストール
!pip install --upgrade diffusers==0.4.1 transformers scipy

(3) Prepare the StableDiffusion pipeline.
Specify "hakurei/waifu-diffusion" as the model name.

import torch
from diffusers import StableDiffusionPipeline

# StableDiffusionパイプラインの準備
pipe = StableDiffusionPipeline.from_pretrained(
    "hakurei/waifu-diffusion",
    torch_dtype=torch.float32,
).to('cuda')

(4) Generate images from text.
This time, I tried generating an image of a cute cat ear maid.

# テキストからの画像生成
prompt = "cute cat ear maid"
with autocast("cuda"):
    images = pipe(prompt, guidance_scale=7.5).images  
images[0].save("output.png")

(5) Check the generated image.
Display the file list using the folder icon on the far left and double-click output.png.



いいなと思ったら応援しよう!