🚀 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 許可證。