🚀 ひとこもる・ディフュージョンV2
この潜在拡散モデルは、日本のアーティスト „Éí„Éà„Åì„ÇÇ„Çã/Hitokomoru の作品を元に学習されています。現在のモデルは、waifu-diffusion-1-4 (wd-1-4-anime_e2.ckpt
) から微調整されており、学習率 2.0e-6
、15000 ステップ、バッチサイズ 4 で、Danbooru から収集した 257 点のアートワーク
を使用して訓練されています。このモデルは、hitokomoru-diffusion の続編として、Anything V3.0 から微調整されたものです。データセットは Aspect Ratio Bucketing Tool を使用して前処理されており、非正方形の解像度で潜在変数に変換して訓練できるようになっています。他のアニメスタイルの Stable Diffusion モデルと同様に、Danbooru タグを使用して画像を生成することもできます。

🚀 クイックスタート
このモデルは、テキストプロンプトに基づいて画像を生成および変更するために使用できます。以下の方法で使用できます。
自動1111のStable Diffusion WebUIを使用する場合
worst quality, low quality, medium quality, deleted, lowres, comic, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, jpeg artifacts, signature, watermark, username, blurry
- また、高いエステティックな結果を得るために、以下の内容をプロンプトの先頭に追加する必要があります。
masterpiece, best quality, high quality, absurdres
Diffusersを使用する場合
このモデルは、他の Stable Diffusion モデルと同じように使用できます。詳細については、Stable Diffusion を参照してください。また、モデルを ONNX、MPS および/または FLAX/JAX にエクスポートすることもできます。
パイプラインを実行するには、以下の依存関係をインストールする必要があります。
pip install diffusers transformers accelerate scipy safetensors
パイプラインを実行するコード例(スケジューラを交換しない場合はデフォルトの DDIM で実行されます。この例では DPMSolverMultistepScheduler に交換しています):
import torch
from torch import autocast
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
model_id = "Linaqruf/hitokomoru-diffusion-v2"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe = pipe.to("cuda")
prompt = "masterpiece, best quality, high quality, 1girl, solo, sitting, confident expression, long blonde hair, blue eyes, formal dress"
negative_prompt = "worst quality, low quality, medium quality, deleted, lowres, comic, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, jpeg artifacts, signature, watermark, username, blurry"
with autocast("cuda"):
image = pipe(prompt,
negative_prompt=negative_prompt,
width=512,
height=728,
guidance_scale=12,
num_inference_steps=50).images[0]
image.save("anime_girl.png")
✨ 主な機能
📦 インストール
自動1111のStable Diffusion WebUIを使用する場合
- こちら から
hitokomoru-v2.ckpt
をダウンロードするか、こちら から safetensors バージョンをダウンロードします。
- こちら から推論設定の .YAML ファイルをダウンロードし、モデルの隣に配置します。
Diffusersを使用する場合
pip install diffusers transformers accelerate scipy safetensors
💻 使用例
基本的な使用法
import torch
from torch import autocast
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
model_id = "Linaqruf/hitokomoru-diffusion-v2"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe = pipe.to("cuda")
prompt = "masterpiece, best quality, high quality, 1girl, solo, sitting, confident expression, long blonde hair, blue eyes, formal dress"
negative_prompt = "worst quality, low quality, medium quality, deleted, lowres, comic, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, jpeg artifacts, signature, watermark, username, blurry"
with autocast("cuda"):
image = pipe(prompt,
negative_prompt=negative_prompt,
width=512,
height=728,
guidance_scale=12,
num_inference_steps=50).images[0]
image.save("anime_girl.png")
📚 ドキュメント
モデル詳細
サンプル画像

サンプル画像のプロンプトと設定
masterpiece, best quality, high quality, 1girl, solo, sitting, confident expression, long blonde hair, blue eyes, formal dress, jewelry, make-up, luxury, close-up, face, upper body.
Negative prompt: worst quality, low quality, medium quality, deleted, lowres, comic, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, jpeg artifacts, signature, watermark, username, blurry
Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 994051800, Size: 512x768, Model hash: ea61e913a0, Model: hitokomoru-v2, Batch size: 2, Batch pos: 0, Denoising strength: 0.6, Clip skip: 2, ENSD: 31337, Hires upscale: 1.5, Hires steps: 20, Hires upscaler: Latent (nearest-exact)
🔧 技術詳細
📄 ライセンス
このモデルはオープンアクセスで、すべての人が利用できます。CreativeML OpenRAIL-M ライセンスによって、権利と使用方法がさらに明確に規定されています。CreativeML OpenRAIL ライセンスには以下のような規定があります。
- モデルを使用して、違法または有害な出力やコンテンツを意図的に生成または共有することはできません。
- 作者は、生成された出力に対して何らの権利も主張しません。ユーザーは自由にそれらを使用できますが、ライセンスに定められた規定に違反しないように責任を負う必要があります。
- 重みを再配布し、モデルを商用および/またはサービスとして使用することができます。ただし、その場合は、ライセンスに記載されている同じ使用制限を含め、CreativeML OpenRAIL-M のコピーをすべてのユーザーに共有する必要があります(ライセンス全体を注意深く読んでください)。
ライセンス全文はこちらをご覧ください
クレジット