🚀 Hitokomoru Diffusion V2
Hitokomoru Diffusion V2 是一个基于文本生成图像的模型,它在日本艺术家的作品上进行训练,能够根据文本提示生成高质量的动漫风格图像,支持使用 Danbooru 标签来生成特定风格的图像。
🚀 快速开始
Hitokomoru Diffusion 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 标签来生成图像。
例如:1girl, white hair, golden eyes, beautiful eyes, detail, flower meadow, cumulonimbus clouds, lighting, detailed sky, garden

✨ 主要特性
📦 安装指南
使用 Automatic1111's Stable Diffusion Webui
使用 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")
高级用法
在使用时,需要根据 官方 Waifu Diffusion 1.4 发布说明 调整提示词,以获得更高质量的图像。
理想的负提示词示例:
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
📚 详细文档
模型详情
示例图像的提示词和设置
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)
示例图像

🔧 技术细节
该模型基于 waifu-diffusion-1-4 (wd-1-4-anime_e2.ckpt
) 进行微调,学习率为 2.0e-6
,训练步数为 15000,批量大小为 4,使用从 Danbooru 收集的 257 幅艺术作品
进行训练。数据集使用 Aspect Ratio Bucketing Tool 进行了预处理,以便可以转换为潜在空间并在非方形分辨率下进行训练。
📄 许可证
该模型是开放访问的,所有人都可以使用,采用 CreativeML OpenRAIL-M 许可证进一步规定了权利和使用方式。
CreativeML OpenRAIL 许可证规定:
- 不得使用该模型故意生成或分享非法或有害的输出或内容。
- 作者对生成的输出不主张任何权利,用户可以自由使用这些输出,并对其使用负责,且使用不得违反许可证中的规定。
- 可以重新分发模型权重,并将模型用于商业用途和/或作为服务使用。如果这样做,请务必包含与许可证中相同的使用限制,并向所有用户分享一份 CreativeML OpenRAIL-M 许可证副本(请完整仔细阅读许可证)。
请在此处阅读完整许可证
致谢