
初音ミクのAIイラストってどうやって生成できるの?
初音ミクの画像生成をしたい場合は、CIVITAIのモデル配布サイトからダウンロードして使用することで生成出来ます。
数十以上と豊富にあるので厳選して初音ミクのおすすめモデルを紹介していきます。
この記事では、Google Colabを使って初音ミクを生成する方法について解説します。
Checkpointモデルは「AnyLora」を使用しているので参考にしてみてください。
記事の最後に、ここで紹介した全ての初音ミクのモデルを使用するためのコードを記載しているので、コードが分からない人はコピペして使用してみてください。
【初音ミクのおすすめモデル4選】

Hatsune Miku 初音ミク | 23 Outfits | Character Lora 9289
1つ目のおすすめモデルは「Hatsune Miku 初音ミク | 23 Outfits | Character Lora 9289」になります。
以下のURLからダウンロードすることが可能なのでアクセスしてください。
右側にある「Download」にマウスカーソルを合わせて右クリックしてください。

Google Chromeの場合は、「リンクのアドレスをコピー」をクリックしてダウンロードURLをコピーしてください。

Google Colabにコードを追加する
Google Colabにアクセスしてください。
「ファイル」をクリックしてから「ノートブックを新規作成」を押してください。

「編集」をクリックしてから「ノートブックの設定」を押してください。

ハードウェアアクセラレータの項目で「GPU」を選択して「保存」をクリックしてください。

先ほどコピーしたダウンロードURLを以下の赤字になっている(ダウンロードURL)にペーストすることで初音ミクのモデルを使用することが出来ます。
!wget (ダウンロードURL) -O /content/stable-diffusion-webui/models/Lora/hatsune-miku-or-23-outfits-or-character-lora-9289.safetensors
ペースト後は以下のようになります。
・Google Colab用コード
#Hatsune Miku 初音ミク | 23 Outfits | Character Lora 9289 【LORA】
!wget https://civitai.com/api/download/models/85767 -O /content/stable-diffusion-webui/models/Lora/hatsune-miku-or-23-outfits-or-character-lora-9289.safetensors
上記のコードを入れる前に、Loraモデルのファイルを入れるためのディレクトリ(フォルダ)を作成するコードを入れないとエラーが起きるので以下のコードを追加してください。
#Loraモデルを入れるためのディレクトリの作成
%mkdir -p /content/stable-diffusion-webui/models/Lora/

数十分後くらいにコードの一番下付近に「gradio.live」のURLが表示されるのでクリックしてStable Diffusion Web UIを起動してください。

Loraモデルを使用して画像生成する
Stable Diffusion Web UIを起動したらプロンプト内を一度クリックしてから「花札」アイコンを押してください。

「Lora」をクリックしてから追加した初音ミクのLoraモデルをクリックしてください。

プロンプト内にLoraモデルが追加されていると使用することが出来ます。

右側の数値を変更するとLoraモデルの要素を弱くしたり強くしたりすることが出来ます。
推奨値は「1.4」以下になります。
「1.5」以上ですと、モデルによりますがクオリティが悪くなりやすい傾向にあります。

プロンプトとネガティブプロンプトを入力してください。

プロンプトには「hatsune miku」の呪文を入れると、より初音ミクが生成されるのでおすすめです。
全て入力したら「Generate」ボタンを押すことで画像生成することが出来ます。

こちらが生成した結果になります。
紹介する2つ目以降のモデルも同様な手順を行うことで生成することができるので参考にしてみてください。

[AIMIKU] Hatsune Miku

・Google Colab用コード
#[AIMIKU] Hatsune Miku 【LORA】
https://civitai.com/models/56121/aimiku-hatsune-miku
!wget https://civitai.com/api/download/models/60530 -O /content/stable-diffusion-webui/models/Lora/aimiku-hatsune-miku.safetensors

Hatsune Miku (Project Sekai.ver) 初音ミク / VOCALOID

・Google Colab用コード
#Hatsune Miku (Project Sekai.ver) 初音ミク / VOCALOID 【LORA】
https://civitai.com/models/95994/hatsune-miku-project-sekaiver-vocaloid
!wget https://civitai.com/api/download/models/102528 -O /content/stable-diffusion-webui/models/Lora/hatsune-miku-project-sekaiver-vocaloid.safetensors

HatsuneMiku NT(初音ミクNT)

・Google Colab用コード
#HatsuneMiku NT(初音ミクNT) 【LORA】
https://civitai.com/models/61462/hatsunemiku-ntnt
!wget https://civitai.com/api/download/models/65951 -O /content/stable-diffusion-webui/models/Lora/hatsunemiku-ntnt.safetensors

【桜ミクのモデル】
桜ミクの場合はプロンプト内に「sakura miku」と入力して、桜ミクのLoraモデルを組み合わせて使用すると生成できるようになります。
もう1つの方法として、「hatsune miku , pink hair , cherry ornament」と入力しても桜ミクを生成することが出来ます。
Sakura Miku (Cherry Blossom Hatsune Miku) (Character)

・Google Colab用コード
#Sakura Miku (Cherry Blossom Hatsune Miku) (Character)
https://civitai.com/models/86941/sakura-miku-cherry-blossom-hatsune-miku-character
!wget https://civitai.com/api/download/models/92495 -O /content/stable-diffusion-webui/models/Lora/sakura-miku-cherry-blossom-hatsune-miku-character.safetensors

Sakura Miku | LoRA
このモデルでは、「sakura miku」のみでは生成できません。
「sakura miku , pink hair , cherry ornament」と入力することで桜ミクが生成できるのでプロンプト内に追加しましょう。

・Google Colab用コード
#Sakura Miku | LoRA 【LORA】
https://civitai.com/models/93025/sakura-miku-or-lora
!wget https://civitai.com/api/download/models/100698 -O /content/stable-diffusion-webui/models/Lora/sakura-miku-or-lora.safetensors

【雪ミクのモデル】
Yuki Miku | LoRA
雪ミクを生成する場合は、プロンプト内に「yuki miku」と入力することで生成しやすいので追加しておくことを推奨します。

・Google Colab用コード
#Yuki Miku | LoRA
https://civitai.com/models/94308/yuki-miku-or-lora
!wget https://civitai.com/api/download/models/100602 -O /content/stable-diffusion-webui/models/Lora/yuki-miku-or-lora.safetensors

Snowmiku 2019

・Google Colab用コード
#Snowmiku 2019
https://civitai.com/models/13165/snowmiku-2019
!wget https://civitai.com/api/download/models/134852 -O /content/stable-diffusion-webui/models/Lora/snowmiku_2019.safetensors

【アペンドミクのモデル】
「Hatsune Miku Append / 初音ミクAppend」のLoraモデルを使用するとアペンドミクに特化した画像生成をすることが出来ます。
プロンプト内には「mikuappend , bridal gauntlets , white necktie , center opening , navel」を入れるとよりアペンドミクを生成することが出来ます。

・Google Colab用コード
#Hatsune Miku Append / 初音ミクAppend
https://civitai.com/models/105906/hatsune-miku-append-append
!wget https://civitai.com/api/download/models/113716 -O /content/stable-diffusion-webui/models/Lora/hatsune-miku-append-append.safetensors

【ナース服のミクモデル】
「Nurse Miku LORA」のLoraモデルを使用すると、可愛いナース服をつけた初音ミクを生成することが出来ます。
少しだけリアル寄りなナースミクを生成したい人は、このモデルを使用するといいです。
モデルによりますが、Loraモデルの数値を1に設定するとクオリティーが落ちる場合があるので、「0.3」くらいの設定にするといいでしょう。

・Google Colab用コード
#Nurse Miku LORA
https://civitai.com/models/126583/nurse-miku-lora
!wget https://civitai.com/api/download/models/138435 -O /content/stable-diffusion-webui/models/Lora/nurse-miku-lora.safetensors

【紹介した全ての初音ミクモデルのコード】

以下は今回紹介した全ての初音ミクのモデルが入ったコードになります。
checkpointモデルのAnyLoraを入れて11モデルと多く、起動できるまで時間がかかりますので気長に待ちましょう。
!apt -y install -qq aria2 libcairo2-dev pkg-config python3-dev
!pip install -q torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1+cu118 torchtext==0.15.1 torchdata==0.6.0 --extra-index-url https://download.pytorch.org/whl/cu118 -U
!pip install -q xformers==0.0.19 triton==2.0.0 -U
#automatic1111 stable diffusion web uiのダウンロード
!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
%cd /content/stable-diffusion-webui
#AnyLoRA - Checkpoint
!wget https://civitai.com/api/download/models/29792 -O /content/stable-diffusion-webui/models/Stable-diffusion/anylora.safetensors
#Loraモデルを入れるためのディレクトリの作成
%mkdir -p /content/stable-diffusion-webui/models/Lora/
#Hatsune Miku 初音ミク | 23 Outfits | Character Lora 9289 【LORA】
!wget https://civitai.com/api/download/models/85767 -O /content/stable-diffusion-webui/models/Lora/hatsune-miku-or-23-outfits-or-character-lora-9289.safetensors
#[AIMIKU] Hatsune Miku 【LORA】
!wget https://civitai.com/api/download/models/60530 -O /content/stable-diffusion-webui/models/Lora/aimiku-hatsune-miku.safetensors
#Hatsune Miku (Project Sekai.ver) 初音ミク / VOCALOID 【LORA】
!wget https://civitai.com/api/download/models/102528 -O /content/stable-diffusion-webui/models/Lora/hatsune-miku-project-sekaiver-vocaloid.safetensors
#HatsuneMiku NT(初音ミクNT) 【LORA】
!wget https://civitai.com/api/download/models/65951 -O /content/stable-diffusion-webui/models/Lora/hatsunemiku-ntnt.safetensors
#Sakura Miku (Cherry Blossom Hatsune Miku) (Character) 【LORA】
!wget https://civitai.com/api/download/models/92495 -O /content/stable-diffusion-webui/models/Lora/sakura-miku-cherry-blossom-hatsune-miku-character.safetensors
#Sakura Miku | LoRA 【LORA】
!wget https://civitai.com/api/download/models/100698 -O /content/stable-diffusion-webui/models/Lora/sakura-miku-or-lora.safetensors
#Yuki Miku | LoRA 【LORA】
!wget https://civitai.com/api/download/models/100602 -O /content/stable-diffusion-webui/models/Lora/yuki-miku-or-lora.safetensors
#Snowmiku 2019 【LORA】
!wget https://civitai.com/api/download/models/134852 -O /content/stable-diffusion-webui/models/Lora/snowmiku_2019.safetensors
#Hatsune Miku Append / 初音ミクAppend 【LORA】
!wget https://civitai.com/api/download/models/113716 -O /content/stable-diffusion-webui/models/Lora/hatsune-miku-append-append.safetensors
#Nurse Miku LORA 【LORA】
!wget https://civitai.com/api/download/models/138435 -O /content/stable-diffusion-webui/models/Lora/nurse-miku-lora.safetensors
#stable diffusion web uiの起動
!python launch.py --share --xformers --enable-insecure-extension-access
まとめ

以上で初音ミクのおすすめモデルを紹介しました。
初音ミクのAIイラストを生成する場合は、CivitAIからモデルをダウンロードして使用することで生成出来ます。
通常の初音ミクではプロンプト内に「hatsune miku」の呪文を入れてLoraモデルと組み合わせると生成しやすくなります。
桜ミクでは「sakura miku , pink hair , cherry blossom ornament」を入れるといいです。
雪ミクでは「snow miku」を入れることで生成可能になります。
紹介したモデルを参考にして初音ミクを生成してみてください!