🚀 Style Enhancer XL LoRA
Style Enhancer XL LoRA 是一款先进的高分辨率 LoRA(低秩自适应)适配器,旨在增强 Animagine XL 2.0 的功能。该创新模型在微调与优化动漫风格图像方面表现出色,能够生成无与伦比的高质量和细节丰富的图像。它可以无缝集成到 Stable Diffusion XL 框架中,并且独特地支持 Danbooru 标签,以实现精准而富有创意的图像生成。
🚀 快速开始
安装依赖
确保安装最新的 diffusers
库以及其他必要的软件包:
pip install diffusers --upgrade
pip install transformers accelerate safetensors
运行示例代码
以下 Python 脚本展示了如何将 Style Enhancer XL LoRA 与 Animagine XL 2.0 结合使用。默认调度器是 EulerAncestralDiscreteScheduler,但为了清晰起见,可以显式定义。
import torch
from diffusers import (
StableDiffusionXLPipeline,
EulerAncestralDiscreteScheduler,
AutoencoderKL
)
lora_model_id = "Linaqruf/style-enhancer-xl-lora"
lora_filename = "style-enhancer-xl.safetensors"
vae = AutoencoderKL.from_pretrained(
"madebyollin/sdxl-vae-fp16-fix",
torch_dtype=torch.float16
)
pipe = StableDiffusionXLPipeline.from_pretrained(
"Linaqruf/animagine-xl-2.0",
vae=vae,
torch_dtype=torch.float16,
use_safetensors=True,
variant="fp16"
)
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
pipe.to('cuda')
pipe.load_lora_weights(lora_model_id, weight_name=lora_filename)
pipe.fuse_lora(lora_scale=0.6)
prompt = "face focus, cute, masterpiece, best quality, 1girl, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck"
negative_prompt = "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry"
image = pipe(
prompt,
negative_prompt=negative_prompt,
width=1024,
height=1024,
guidance_scale=12,
num_inference_steps=50
).images[0]
pipe.unfuse_lora()
image.save("anime_girl.png")
✨ 主要特性
- 专为增强 Animagine XL 2.0 功能而设计,在微调与优化动漫风格图像方面表现卓越。
- 无缝集成到 Stable Diffusion XL 框架中。
- 独特支持 Danbooru 标签,实现精准且富有创意的图像生成。
- 可帮助用户重现 SD 1.5 的独特“复古”艺术风格。
📦 安装指南
确保安装最新的 diffusers
库以及其他必要的软件包:
pip install diffusers --upgrade
pip install transformers accelerate safetensors
💻 使用示例
基础用法
import torch
from diffusers import (
StableDiffusionXLPipeline,
EulerAncestralDiscreteScheduler,
AutoencoderKL
)
lora_model_id = "Linaqruf/style-enhancer-xl-lora"
lora_filename = "style-enhancer-xl.safetensors"
vae = AutoencoderKL.from_pretrained(
"madebyollin/sdxl-vae-fp16-fix",
torch_dtype=torch.float16
)
pipe = StableDiffusionXLPipeline.from_pretrained(
"Linaqruf/animagine-xl-2.0",
vae=vae,
torch_dtype=torch.float16,
use_safetensors=True,
variant="fp16"
)
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
pipe.to('cuda')
pipe.load_lora_weights(lora_model_id, weight_name=lora_filename)
pipe.fuse_lora(lora_scale=0.6)
prompt = "face focus, cute, masterpiece, best quality, 1girl, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck"
negative_prompt = "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry"
image = pipe(
prompt,
negative_prompt=negative_prompt,
width=1024,
height=1024,
guidance_scale=12,
num_inference_steps=50
).images[0]
pipe.unfuse_lora()
image.save("anime_girl.png")
📚 详细文档
模型详情
📄 许可证
本项目采用 CreativeML Open RAIL++-M 许可证。