CyberRealistic V4.1

29 years old beautiful female Japanese IT Professional in a plain beige oversized T shirt with light brown short choppy hair at a coffee shop, high quality, pink tiny lips, small nose, full body, holding a cup, along counter, dim light, thin arms, looking straight, sister
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 925bd947d7, Model: CyberRealistic_V4.1_FP32, Version: v1.7.0

とりあえず子どものGaming PCでやっていたStable Diffusionの画像生成はできるようになりました。上の画像は前回の”29 years old beautiful female Japanese IT Professional”のプロンプトをCyberRealisticというモデルで処理してみたものです。悪くないけどやや目を強調しすぎ(プリクラの影響?)かな?512×512のイメージだと1枚1秒くらいで生成するので楽勝です。


すぐにバージョンが変わって情報が古くなるので、ちゃんとしたセットアップ・ガイドを提供するつもりはないんですが、いちおうやったことの概略をここにメモしておきます。

  1. Ubuntu 24.04.3 LTSをインストールする。英語でインストールしました。設定のほとんどはデフォルトのままですが、”Install third-party software for graphics and WiFi hardware and additional media formats”というのにはチェックを入れました。
  2. リブートして、ターミナルで nvidia-smi コマンドというのをたたいてやると、ドライバーのバージョンが出る。ここで、ぼくの場合、ディスプレイドライバーのバージョンが”535″、CUDAのバージョンが”12.2″と表示されました。きょう現在(2024-02-17) CUDAのバージョンが12.1以下じゃないと、パッケージ済みのPyTorch(これがStable DiffusionのUIとなるwebuiというやつを動かすのに必要)をインストールできないので、これをダウングレードしなければいけない。
  3. そんなわけで、ここのページに紹介されている手順でいったんインストールしたドライバーをアンインストールする。
  4. 先のステップの最後で ubuntu-drivers devices というコマンドでおすすめのドライバーのバージョンを表示させて、そのおすすめバージョンをインストールしろということになっているけど、それは無視して、”525″というバージョンをインストールする。つまり、
    sudo apt install libnvidia-common-525 libnvidia-gl-525 nvidia-driver-525 -y
  5. インストールが終了したら、リブートして、また nvidia-smi コマンドを打つ。ここで、ディスプレイドライバーのバージョンが”525″、CUDAのバージョンが”12.0″と表示されていればOK。
  6. つぎのステップの準備として西川和久さんが紹介されている方法でMinicondaをインストールしてPython 3.10.6のconda環境をつくってactivateしておく。
  7. Ubuntuにはデフォルトで git がインストールされないようなので、sudo apt install git でインストールする。
  8. ワークディレクトリをつくって、git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git でwebui のリポジトリをcloneする。
  9. なにかモデルがないといかんので、とりあえずStable Diffusion 2.1のベースモデル v2-1_512-nonema-pruned.safetensors というのをHugging Face からダウンロードして、webuiをcloneしたディレクトリの下のmodels/Stable-diffusionにmoveする。
  10. ここでwebuiをcloneしたディレクトリにあるwebui.shを動かしてやる ( ./webui.sh )と必要なライブラリ(PyTorchとか)をダウンロードして、webuiが立ち上がる(はず)。うまく行ったら、
    Calculating sha256 for /home/tami/git/AUTOMATIC1111/stable-diffusion-webui/models/Stable-diffusion/v2-1_512-nonema-pruned.safetensors: Running on local URL: http://127.0.0.1:7860
    というようなメッセージが出る。
  11. で、ブラウザで http://127.0.0.1:7860 を開けたら Stable Diffusionがつかえるようになっているはず。
  12. このままでも動くんですが、Cannot find TCMalloc (improves CPU memory usage) というメッセージが赤色で表示されてちょっと気になるので、しらべてみたら、 sudo apt-get install google-perftools でメッセージが消えるみたいです。
  13. あと前にWSLで動かしたときに見たページにあったシェルスクリプトをStable Diffusion立ち上げ用に作っておくと便利です。こんな感じ:
#!/bin/bash

# Function to handle cleanup actions
cleanup() {
    # Perform cleanup actions here
    echo "Performing cleanup..."
    # Remove files named tmp*.png in /tmp folder
    rm -f /tmp/tmp*.png
    # Remove files named tmp*.jpg in /tmp folder
    rm -f /tmp/tmp*.jpg
    # Remove gradio folder if it exists
    rm -rf /tmp/gradio
    # Remove tmp* folders within /tmp directory
    rm -rf /tmp/tmp*
}

# Trap SIGINT signal (Ctrl+C) and call cleanup function
trap cleanup SIGINT

# Change directory
cd /home/tami/git/AUTOMATIC1111/stable-diffusion-webui 

# Run webui.sh script
./webui.sh

# Cleanup actions after Python script termination
cleanup

以上です。インストールをやり直したりしてちゃんとこの手順だけでインストールできるかどうか確認してないので、必要なステップが抜けてたらすみません。


Seedを固定していくつか他のモデルも試してみたので載せておきます。個人的にはRealisticVisionが好きですが、けっこうベースモデルもいいのではないかとおもいます。あんまり美人・美少女に特化しちゃうとリアリティが失われてしまう、ということかな。


Stable Diffusion 2.1ベースモデル

29 years old beautiful female Japanese IT Professional in a plain beige oversized T shirt with light brown short choppy hair at a coffee shop, high quality, pink tiny lips, small nose, full body, holding a cup, along counter, dim light, thin arms, looking straight, sister
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: fc4f9fe752, Model: v2-1_512-nonema-pruned, Version: v1.7.0

BeautifulRealistic

29 years old beautiful female Japanese IT Professional in a plain beige oversized T shirt with light brown short choppy hair at a coffee shop, high quality, pink tiny lips, small nose, full body, holding a cup, along counter, dim light, thin arms, looking straight, sister
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 1a17bcd93d, Model: beautifulRealistic_v7, Version: v1.7.0

majicmixRealistic

29 years old beautiful female Japanese IT Professional in a plain beige oversized T shirt with light brown short choppy hair at a coffee shop, high quality, pink tiny lips, small nose, full body, holding a cup, along counter, dim light, thin arms, looking straight, sister
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 33c9f6dfcb, Model: majicmixRealistic_v5, Version: v1.7.0

RealisticVision (前回のやつ)

29 years old beautiful female Japanese IT Professional in a plain beige oversized T shirt with light brown short choppy hair at a coffee shop, high quality, pink tiny lips, small nose, full body, holding a cup, along counter, dim light, thin arms, looking straight, sister
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 00445494c8, Model: Realistic_Vision_V5.1, Version: v1.7.0

Agelesnate (これも前回のやつ)

29 years old beautiful female Japanese IT Professional in a plain beige oversized T shirt with light brown short choppy hair at a coffee shop, high quality, pink tiny lips, small nose, full body, holding a cup, along counter, dim light, thin arms, looking straight, sister
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 870d7132aa, Model: agelesnate_v3, Version: v1.7.0

MeinaMix

29 years old beautiful female Japanese IT Professional in a plain beige oversized T shirt with light brown short choppy hair at a coffee shop, high quality, pink tiny lips, small nose, full body, holding a cup, along counter, dim light, thin arms, looking straight, sister
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: eac6c08a19, Model: Meina V9 – baked VAE, Version: v1.7.0

Stable Diffusion 2.0ベースモデル

29 years old beautiful female Japanese IT Professional in a plain beige oversized T shirt with light brown short choppy hair at a coffee shop, high quality, pink tiny lips, small nose, full body, holding a cup, along counter, dim light, thin arms, looking straight, sister
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: ab800444cd, Model: 512-base-ema, Version: v1.7.0

AbsoluteReality

29 years old beautiful female Japanese IT Professional in a plain beige oversized T shirt with light brown short choppy hair at a coffee shop, high quality, pink tiny lips, small nose, full body, holding a cup, along counter, dim light, thin arms, looking straight, sister
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 463d6a9fe8, Model: absolutereality_v181, Version: v1.7.0

epiCRealism

29 years old beautiful female Japanese IT Professional in a plain beige oversized T shirt with light brown short choppy hair at a coffee shop, high quality, pink tiny lips, small nose, full body, holding a cup, along counter, dim light, thin arms, looking straight, sister
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 84d76a0328, Model: epicrealism_naturalSinRC1VAE, Version: v1.7.0

Chasing Shadows

じゃあ昨日の彼女

29 years old female Japanese IT Professional in a plain beige T shirt with short brown hair at a coffee shop, high quality, pink lips
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 870d7132aa, Model: agelesnate_v3, Version: v1.7.0

…のモデルをRealistic Visionに替えてやれば、写真みたいなイメージになるんじゃないの?とおもい、とうぜんやってみた。

29 years old female Japanese IT Professional in a plain beige T shirt with short brown hair at a coffee shop, high quality, pink lips
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 00445494c8, Model: Realistic_Vision_V5.1, Version: v1.7.0

プロンプトで書かれていることは再現されてるんだけど、もうちょっともとのイメージに近い絵柄にできないものか。

それで、プロンプトをいじってみました。ほんとうは試行錯誤しながらやったのですが、わかりやすくするために、最終形(?)に至るまで、少しずつことばを足して途中経過をみていきましょう。

まずは”beautiful”。なにをもって美しい顔とするのかはひとそれぞれでしょうが、これがAIが考える”beautiful”みたいです。

29 years old beautiful female Japanese IT Professional in a plain beige T shirt with short brown hair at a coffee shop, high quality, pink lips
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 00445494c8, Model: Realistic_Vision_V5.1, Version: v1.7.0

つぎは”full body”を加えて全身を写すようにする。

29 years old beautiful female Japanese IT Professional in a plain beige T shirt with short brown hair at a coffee shop, high quality, pink lips, full body
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 00445494c8, Model: Realistic_Vision_V5.1, Version: v1.7.0

“holding a cup”で手にカップを持ってもらおう。

29 years old beautiful female Japanese IT Professional in a plain beige T shirt with short brown hair at a coffee shop, high quality, pink lips, full body, holding a cup
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 00445494c8, Model: Realistic_Vision_V5.1, Version: v1.7.0

なんか顔の感じが変わったみたい。それはともかく、カウンターの横に立ってるイメージにしたいので、”along counter”を足してみる。

29 years old beautiful female Japanese IT Professional in a plain beige T shirt with short brown hair at a coffee shop, high quality, pink lips, full body, holding a cup, along counter
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 00445494c8, Model: Realistic_Vision_V5.1, Version: v1.7.0

このTシャツはちゃんとフィットした女性用のものですが、もとのイメージはだぶだぶのTシャツを着ているようなので、”oversized”ということばを足してみよう。

29 years old beautiful female Japanese IT Professional in a plain beige oversized T shirt with short brown hair at a coffee shop, high quality, pink lips, full body, holding a cup, along counter
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 00445494c8, Model: Realistic_Vision_V5.1, Version: v1.7.0

変わったのかな(笑)。

顔の感じを似させるために、くちびるを”pink tiny lips”として、鼻を”small nose”と表現してみる。

29 years old beautiful female Japanese IT Professional in a plain beige oversized T shirt with short brown hair at a coffee shop, high quality, pink tiny lips, small nose, full body, holding a cup, along counter
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 00445494c8, Model: Realistic_Vision_V5.1, Version: v1.7.0

ちょっと目が変(笑)。Tシャツに柄が入ってるし。

明かりをすこし暗めにするために”dim light”を加える。

29 years old beautiful female Japanese IT Professional in a plain beige oversized T shirt with short brown hair at a coffee shop, high quality, pink tiny lips, small nose, full body, holding a cup, along counter, dim light
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 00445494c8, Model: Realistic_Vision_V5.1, Version: v1.7.0

Tシャツの柄がなくなったのはいいけど、あとは背景の照明が丸くなっただけのような気がします。

この段階で腕が細いのはわかるけど、”thin arms”を足してみる。

29 years old beautiful female Japanese IT Professional in a plain beige oversized T shirt with short brown hair at a coffee shop, high quality, pink tiny lips, small nose, full body, holding a cup, along counter, dim light, thin arms
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 00445494c8, Model: Realistic_Vision_V5.1, Version: v1.7.0

ほとんど間違い探しレベルで違いがわかりませんな。

目線を変更するために”looking straight”を足してみます。

29 years old beautiful female Japanese IT Professional in a plain beige oversized T shirt with short brown hair at a coffee shop, high quality, pink tiny lips, small nose, full body, holding a cup, along counter, dim light, thin arms, looking straight
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 00445494c8, Model: Realistic_Vision_V5.1, Version: v1.7.0

ここで髪型を”short brown hair”から”light brown short choppy hair”に変えてみたんですが、ほとんど変化はなかった。

29 years old beautiful female 29 years old beautiful female Japanese IT Professional in a plain beige oversized T shirt with light brown short choppy hair at a coffee shop, high quality, pink tiny lips, small nose, full body, holding a cup, along counter, dim light, thin arms, looking straight
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 00445494c8, Model: Realistic_Vision_V5.1, Version: v1.7.0

で、最後に「妹属性」を追加するために、”sister”というのを足してみたけど、背景のライトが変わっただけかも。

29 years old beautiful female Japanese IT Professional in a plain beige oversized T shirt with light brown short choppy hair at a coffee shop, high quality, pink tiny lips, small nose, full body, holding a cup, along counter, dim light, thin arms, looking straight, sister
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 00445494c8, Model: Realistic_Vision_V5.1, Version: v1.7.0

いちおうこれを最終形とします。もとのイメージとはちょっと違う雰囲気の女性だし、背景もぜんぜん違う。でも、これでいいことにします。なにをいいことにするのかわからんけど。

慣れてきたら、もうちょい自由に画像をあやつることができるんでしょうね。


(付記)Agelesnate V3の出力に似たイメージをRealistic Visionで出力するためにプロンプトを修正してきたわけですが、最終形のプロンプトをもう一度Agelesnate V3で処理させたらどうなるか?やってみました。

29 years old beautiful female Japanese IT Professional in a plain beige oversized T shirt with light brown short choppy hair at a coffee shop, high quality, pink tiny lips, small nose, full body, holding a cup, along counter, dim light, thin arms, looking straight, sister
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 870d7132aa, Model: agelesnate_v3, Version: v1.7.0

ちょっとヤバい方向にむかっているような気がします(笑)。

More Agelesnate V3 Samples

週末になったので、引き続きStable Diffusionで遊んでます。前回の29歳の女性をもっと魅力的にできないものかちょっとプロンプトをいじってみました。

前回と全く同じではないんですが、これをベースに使います。

29 years old female Japanese IT Professional in T shirt with short brown hair at a coffee shop
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 870d7132aa, Model: agelesnate_v3, Version: v1.7.0

これで十分かわいいと思うんですが、Tシャツの模様がじゃまに思える。ほんとうならもっといい服を着てもらいたいのだけれど、ファッション系のボキャブラリーがないので、女性の服を英語でどう表現するのかわからん。しょうがないので、白のふつうのTシャツを着てもらおう。

29 years old female Japanese IT Professional in a plain white T shirt with short brown hair at a coffee shop
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 870d7132aa, Model: agelesnate_v3, Version: v1.7.0

なんかちょっと雰囲気が変わって、”IT Professional”というよりはサーファーみたいですが、これはこれでいいでしょう。

ちょっと線が太くてデッサンぽいのが気になる。しらべてみると”high quality”というのをプロンプトに加えて、”low quality”というのをネガティブ・プロンプトに入れてやるといいらしいので、それをやってみたら、これが効果抜群。

29 years old female Japanese IT Professional in a plain white T shirt with short brown hair at a coffee shop, high quality
Negative prompt: low quality
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 870d7132aa, Model: agelesnate_v3, Version: v1.7.0

一般的にインターネットで出回っているAIで生成された女性の画像はどれも胸が強調されすぎていてリアリティに欠けるな、という印象を持っていたのですが、インターネットでサーチすると同じようなことをおもっているひとがほかにもいて、それを回避するためにはネガティブ・プロンプトに”big breast”というのを入れればいいことがわかったのでやってみた。

29 years old female Japanese IT Professional in a plain white T shirt with short brown hair at a coffee shop, high quality
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 870d7132aa, Model: agelesnate_v3, Version: v1.7.0

微妙な違いですが、こっちの方がいいのではないでしょうか(個人の感想です)。

これで完成としてもいいけど、どうせだから、ちょっと変化をつけることにして、Tシャツを白からベージュのものに変えて、”pink lips”というのもプロンプトに入れてみよう。

29 years old female Japanese IT Professional in a plain beige T shirt with short brown hair at a coffee shop, high quality, pink lips
Negative prompt: low quality, big breast
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 1757170746, Size: 512×512, Model hash: 870d7132aa, Model: agelesnate_v3, Version: v1.7.0

ほんとうにくちびるの色変わったの?ともおもうけど、化粧はちょっと濃くなった印象がある(頬とか)。やってるとキリがないし、きょうのところはここまでにしておくことにしようか。