🚀 Anything V3.1
Anything V3.1是一個基於潛在擴散模型的第三方延續版本,它在Anything V3.0的基礎上進行了優化。該模型通過修復VAE模型和CLIP位置ID鍵,被認為是Anything V3.0的改進版本。它能夠根據文本提示生成和修改動漫主題的圖像。
🚀 快速開始
你可以選擇使用Automatic1111's Stable Diffusion Webui
或者🧨 diffusers
來使用這個模型。具體使用方法如下:
✨ 主要特性
- 優化升級:基於Anything V3.0,修復了VAE模型和CLIP位置ID鍵,CLIP參考自Stable Diffusion V1.5。
- 多源數據訓練:在從多個來源收集的數據集上進行微調,其中1/4為合成數據集。
- 支持Danbooru標籤:和其他動漫風格的Stable Diffusion模型一樣,支持使用Danbooru標籤來生成圖像。
📦 安裝指南
使用🧨 diffusers
運行模型
你需要安裝以下依賴才能運行模型:
pip install diffusers transformers accelerate scipy safetensors
💻 使用示例
基礎用法
運行以下代碼來生成圖像(如果不更換調度器,將使用默認的DDIM,此示例中我們將其更換為DPMSolverMultistepScheduler):
import torch
from torch import autocast
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
model_id = "cag/anything-v3-1"
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 = "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"
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")
📚 詳細文檔
#how-to-use
- 下載
Anything V3.1
點擊此處,或者下載Anything V3.2
點擊此處,所有模型均為.safetensors
格式。
- 你需要使用美學標籤調整提示詞以獲得更好的結果,你可以使用任何通用的負面提示詞,或者使用以下建議的負面提示詞來引導模型生成高美學的圖像:
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, illustration, beautiful detailed, finely detailed, dramatic light, intricate details
🧨Diffusers
此模型的使用方法與其他Stable Diffusion模型相同。更多信息請參考Stable Diffusion。你還可以將模型導出為ONNX、MPS和/或FLAX/JAX。預訓練模型目前基於Anything V3.1。
🔧 技術細節
- CLIP和VAE處理:CLIP參考自Stable Diffusion V1.5,VAE使用Kohya的merge - vae腳本進行替換,CLIP使用Arena的stable - diffusion - model - toolkit webui擴展進行修復。
- 微調參數:當前模型在從多個來源收集的數據集上進行微調,學習率為2.0e - 6,訓練50個週期,批量大小為4。
- 數據集預處理:使用Aspect Ratio Bucketing Tool對數據集進行預處理,以便可以將其轉換為潛在變量並在非正方形分辨率下進行訓練。
📄 許可證
該模型採用CreativeML OpenRAIL - M許可證,此許可證規定:
- 你不能使用該模型故意生成或分享非法或有害的輸出或內容。
- 作者對您生成的輸出不主張任何權利,你可以自由使用它們,但需對其使用負責,且使用不得違反許可證中的規定。
- 你可以重新分發模型權重,並將模型用於商業用途或作為服務使用。如果你這樣做,請確保包含與許可證中相同的使用限制,並向所有用戶分享一份CreativeML OpenRAIL - M許可證副本。
請在此處閱讀完整許可證
侷限性
- 過擬合問題:即使修復了文本編碼器,該模型仍然存在過擬合問題,不能很好地遵循提示詞,導致在輸入提示詞時比較受限,只有輸入“1girl”時才能獲得較好的結果。
- 性別偏向:該模型基於動漫風格,偏向於生成動漫女性角色,在不提供特定提示詞的情況下,很難生成具有陽剛之氣的男性角色。
- 改進有限:與Anything V3.0基礎模型相比,變化不大,僅涉及更換VAE和CLIP模型,然後在小規模數據集上微調50個週期。
示例
以下是一些精心挑選的樣本以及可用模型之間的比較:

鳴謝
此項目屬於公共領域。
模型信息表格