模型概述
模型特點
模型能力
使用案例
🚀 Animagine XL 2.0
Animagine XL 2.0 是一款先進的潛在文本到圖像擴散模型,旨在創建高分辨率、細節豐富的動漫圖像。它基於 Stable Diffusion XL 1.0 進行微調,使用了高質量的動漫風格圖像數據集。作為 Animagine XL 1.0 的升級版,該模型在捕捉動漫藝術的多樣獨特風格方面表現出色,提供了更高的圖像質量和美學效果。
模型示例展示
示例標題 | 輸入文本 | 輸出圖片 |
---|---|---|
1girl | face focus, cute, masterpiece, best quality, 1girl, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck | 點擊查看 |
1boy | face focus, bishounen, masterpiece, best quality, 1boy, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck | 點擊查看 |
更多示例圖片
圖片描述 | 圖片鏈接 |
---|---|
sample1 | 點擊查看 |
sample2 | 點擊查看 |
sample3 | 點擊查看 |
sample4 | 點擊查看 |
sample1 | 點擊查看 |
sample4 | 點擊查看 |
✨ 主要特性
- 高質量動漫圖像生成:能夠根據文本描述創建詳細且高質量的動漫圖像。
- 支持多種風格:通過 LoRA 適配器可以實現多種獨特的藝術風格。
- 用戶友好接口:可通過 Gradio Web UI 和 Google Colab 進行圖像生成。
📦 安裝指南
確保安裝最新的 diffusers
庫以及其他必要的包:
pip install diffusers --upgrade
pip install transformers accelerate safetensors
💻 使用示例
基礎用法
以下 Python 腳本展示瞭如何使用 Animagine XL 2.0 進行推理。模型配置中的默認調度器是 EulerAncestralDiscreteScheduler
,為了清晰起見,可以顯式定義它。
import torch
from diffusers import (
StableDiffusionXLPipeline,
EulerAncestralDiscreteScheduler,
AutoencoderKL
)
# 加載 VAE 組件
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')
# 定義提示並生成圖像
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]
📚 詳細文檔
提示指南
Animagine XL 2.0 對自然語言描述的圖像生成有較好的響應。例如:
A girl with mesmerizing blue eyes looks at the viewer. Her long, white hair is adorned with blue butterfly hair ornaments.
然而,為了獲得最佳效果,建議在提示中使用 Danbooru 風格的標籤,因為模型是使用這些標籤標記的圖像進行訓練的。例如:
1girl, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck
該模型在數據集處理過程中加入了質量和評級修飾符,根據指定的標準影響圖像生成。
質量修飾符
質量修飾符 | 分數標準 |
---|---|
masterpiece | >150 |
best quality | 100 - 150 |
high quality | 75 - 100 |
medium quality | 25 - 75 |
normal quality | 0 - 25 |
low quality | -5 - 0 |
worst quality | <-5 |
評級修飾符
評級修飾符 | 評級標準 |
---|---|
- | general |
- | sensitive |
nsfw | questionable |
nsfw | explicit |
為了引導模型生成高美學的圖像,可以使用負面提示,如:
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
為了獲得更高質量的結果,可以在提示前加上:
masterpiece, best quality
質量標籤比較
該表格詳細比較了訓練質量標籤對生成結果的顯著影響,展示了各種正負屬性,說明了質量標籤在引導視覺內容生成方面的作用。
對比項 | 詳情 |
---|---|
提示 | "1girl, fu xuan, honkai:star rail, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck" |
正標籤情況1 | - |
正標籤情況2 | masterpiece, best quality |
正標籤情況3 | - |
正標籤情況4 | masterpiece, best quality |
正標籤情況5 | masterpiece, best quality |
負標籤情況1 | - |
負標籤情況2 | - |
負標籤情況3 | worst quality, low quality, normal quality |
負標籤情況4 | worst quality, low quality, normal quality |
負標籤情況5 | 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 |
對比圖片1 | 點擊查看 |
對比圖片2 | 點擊查看 |
對比圖片3 | 點擊查看 |
對比圖片4 | 點擊查看 |
對比圖片5 | 點擊查看 |
多方面分辨率
該模型支持生成以下尺寸的圖像:
尺寸 | 縱橫比 |
---|---|
1024 x 1024 | 1:1 正方形 |
1152 x 896 | 9:7 |
896 x 1152 | 7:9 |
1216 x 832 | 19:13 |
832 x 1216 | 13:19 |
1344 x 768 | 7:4 水平 |
768 x 1344 | 4:7 垂直 |
1536 x 640 | 12:5 水平 |
640 x 1536 | 5:12 垂直 |
示例展示
圖片描述 | 圖片鏈接 | 生成參數詳情 |
---|---|---|
Twilight Contemplation - "Stelle, Amidst Shooting Stars and Mountain Silhouettes" | 點擊查看 | 點擊查看{ "prompt": "cinematic photo (masterpiece), (best quality), (ultra-detailed), stelle, honkai: star rail, official art, 1girl, solo, gouache, starry sky, mountain, long hair, hoodie, shorts, sneakers, yellow eyes, tsurime, sitting on a rock, stargazing, milky way, shooting star, tranquil night., illustration, disheveled hair, detailed eyes, perfect composition, moist skin, intricate details, earrings . 35mm photograph, film, bokeh, professional, 4k, highly detailed", "negative_prompt": "drawing, painting, crayon, sketch, graphite, impressionist, noisy, blurry, soft, deformed, uglylongbody, lowres, bad anatomy, bad hands, missing fingers, pubic hair, extra digit, fewer digits, cropped, worst quality, low quality", "resolution": "832 x 1216", "guidance_scale": 12, "num_inference_steps": 50, "seed": 1082676886, "sampler": "Euler a", "enable_lcm": false, "sdxl_style": "Photographic", "quality_tags": "Heavy", "refine_prompt": false, "use_lora": null, "use_upscaler": { "upscale_method": "nearest-exact", "upscaler_strength": 0.55, "upscale_by": 1.5, "new_resolution": "1248 x 1824" }, "datetime": "2023-11-25 06:42:21.342459"} |
Serenade in Sunlight - "Caelus, immersed in music, strums his guitar in a room bathed in soft afternoon light." | 點擊查看 | 點擊查看{ "prompt": "cinematic photo (masterpiece), (best quality), (ultra-detailed), caelus, honkai: star rail, 1boy, solo, playing guitar, living room, grey hair, short hair, yellow eyes, downturned eyes, passionate expression, casual clothes, acoustic guitar, sheet music stand, carpet, couch, window, sitting pose, strumming guitar, eyes closed., illustration, disheveled hair, detailed eyes, perfect composition, moist skin, intricate details, earrings . 35mm photograph, film, bokeh, professional, 4k, highly detailed", "negative_prompt": "drawing, painting, crayon, sketch, graphite, impressionist, noisy, blurry, soft, deformed, uglylongbody, lowres, bad anatomy, bad hands, missing fingers, pubic hair, extra digit, fewer digits, cropped, worst quality, low quality", "resolution": "1216 x 832", "guidance_scale": 12, "num_inference_steps": 50, "seed": 1521939308, "sampler": "Euler a", "enable_lcm": false, "sdxl_style": "Photographic", "quality_tags": "Heavy", "refine_prompt": true, "use_lora": null, "use_upscaler": { "upscale_method": "nearest-exact", "upscaler_strength": 0.55, "upscale_by": 1.5, "new_resolution": "1824 x 1248" }, "datetime": "2023-11-25 07:08:39.622020"} |
Night Market Glow - "Kafka serves up culinary delights, her smile as bright as the surrounding festival lights." | 點擊查看 | 點擊查看{ "prompt": "cinematic photo (masterpiece), (best quality), (ultra-detailed), 1girl, solo, kafka, enjoying a street food festival, dark purple hair, shoulder length, hair clip, blue eyes, upturned eyes, excited expression, casual clothes, food stalls, variety of cuisines, people, outdoor seating, string lights, standing pose, holding a plate of food, trying new dishes, laughing with friends, experiencing the vibrant food culture., illustration, disheveled hair, detailed eyes, perfect composition, moist skin, intricate details, earrings . 35mm photograph, film, bokeh, professional, 4k, highly detailed", "negative_prompt": "drawing, painting, crayon, sketch, graphite, impressionist, noisy, blurry, soft, deformed, uglylongbody, lowres, bad anatomy, bad hands, missing fingers, pubic hair, extra digit, fewer digits, cropped, worst quality, low quality", "resolution": "1216 x 832", "guidance_scale": 12, "num_inference_steps": 50, "seed": 1082676886, "sampler": "Euler a", "enable_lcm": false, "sdxl_style": "Photographic", "quality_tags": "Heavy", "refine_prompt": false, "use_lora": null, "use_upscaler": { "upscale_method": "nearest-exact", "upscaler_strength": 0.55, "upscale_by": 1.5, "new_resolution": "1824 x 1248" }, "datetime": "2023-11-25 06:51:53.961466"} |
🔧 技術細節
訓練和超參數
- Animagine XL 在配備 80GB 內存的 1x A100 GPU 上進行訓練。訓練過程包括兩個階段:
- 特徵對齊階段:使用 170k 張圖像使模型熟悉基本的動漫概念。
- 美學調整階段:使用 83k 高質量合成數據集來優化模型的藝術風格。
超參數
參數 | 值 |
---|---|
全局輪數 | 20 |
學習率 | 1e-6 |
批量大小 | 32 |
訓練文本編碼器 | True |
圖像分辨率 | 1024 (2048 x 512) |
混合精度 | fp16 |
模型比較(Animagine XL 1.0 與 Animagine XL 2.0)
圖像比較
在第二代(Animagine XL 2.0)中,解決了在“回頭看”和“從後面看”等姿勢中普遍存在的“斷頸”問題。現在,角色默認“看著觀眾”,提高了生成圖像的自然度和準確性。
訓練配置
配置項 | Animagine XL 1.0 | Animagine XL 2.0 |
---|---|---|
GPU | A100 40G | A100 80G |
數據集 | 8000 張圖像 | 170k + 83k 張圖像 |
全局輪數 | 不適用 | 20 |
學習率 | 4e-7 | 1e-6 |
批量大小 | 16 | 32 |
訓練文本編碼器 | False | True |
訓練特殊標籤 | False | True |
圖像分辨率 | 1024 | 1024 |
桶分辨率 | 1024 x 256 | 2048 x 512 |
字幕丟棄率 | 0.5 | 0 |
📚 詳細文檔
直接使用場景
Animagine XL 2.0 模型具有先進的文本到圖像擴散能力,非常通用,可應用於多個領域:
- 藝術與設計:是藝術家和設計師的強大工具,能夠創建獨特且高質量的動漫風格藝術作品。
- 教育:在教育環境中,可用於開發引人入勝的視覺內容,輔助教授與藝術、技術和媒體相關的概念。
- 娛樂與媒體:其生成詳細動漫圖像的能力使其非常適合用於動畫、漫畫小說和其他媒體制作,為講故事提供了新途徑。
- 研究:學者和研究人員可以利用 Animagine XL 2.0 探索人工智能驅動的藝術生成前沿,研究生成模型的複雜性,評估模型的能力和侷限性。
- 個人使用:動漫愛好者可以使用 Animagine XL 2.0 將他們的想象概念變為現實,根據自己喜歡的類型和風格創建個性化的藝術作品。
侷限性
Animagine XL 2.0 模型雖然功能先進,但也有一些用戶應該瞭解的侷限性:
- 風格偏差:由於使用約 80,000 張具有相似美學的圖像進行微調,模型對特定藝術風格存在偏差,可能限制生成圖像風格的多樣性。
- 渲染挑戰:在手或腳的渲染上偶爾會出現不準確的情況,可能無法始終以高保真度描繪。
- 寫實性限制:該模型專注於動漫風格內容,不適合生成寫實圖像。
- 自然語言侷限性:當使用自然語言描述進行提示時,模型可能無法達到最佳性能,因為它更適合特定的動漫術語和風格。
- 數據集範圍:目前,由於數據集的範圍,模型主要在生成與“崩壞”系列和“原神”相關的內容方面有效。計劃在未來的迭代中擴展以包含更多不同的概念。
- NSFW 內容生成:模型在生成 NSFW 內容方面不熟練,因為在訓練過程中沒有將其作為重點,符合促進安全和適當內容生成的意圖。
📄 許可證
該模型遵循 CreativeML Open RAIL++-M 許可證。
致謝
我們感謝以下機構和團隊:
- Chai AI:為我們的研究提供開源資助 (Chai AI)。
- Kohya SS:提供必要的訓練腳本。
- Camenduru Server Community:提供寶貴的見解和支持。
- NovelAI:啟發了質量標籤功能。
- Waifu DIffusion Team:啟發了使用更大數據集的最佳訓練管道。
- Shadow Lilac:提供圖像分類模型 (shadowlilac/aesthetic-shadow),對我們的質量評估過程至關重要。

