当前位置:AIGC资讯 > AIGC > 正文

Stable Diffusion WebUI 集成 LoRA模型,给自己做一张壁纸 Ubuntu22.04 rtx2060 6G

LoRA概念

LoRA的全称是LoRA: Low-Rank Adaptation of Large Language Models,可以理解为stable diffusion(SD)模型的一种插件,和hyper-network,controlNet一样,都是在不修改SD模型的前提下,利用少量数据训练出一种画风/IP/人物,实现定制化需求,所需的训练资源比训练SD模要小很多,非常适合社区使用者和个人开发者。

下载模型

基础模型

chilloutmix_Ni.safetensors官方版下载丨最新版下载丨绿色版下载丨APP下载-123云盘

cp ~/Downloads/ai/chilloutmix_Ni.safetensors models/Stable-diffusion/chilloutmix_Ni.safetensors

LoRA模型

yeqiang@yeqiang-MS-7B23:~/Downloads/ai/stable-diffusion-webui$ ls models/Lora/
chunmomoLora_v11.safetensors	 HinaIAmYoung22_zny10.safetensors    raidenShogunRealistic_raidenshogun.safetensors  taiwanDollLikeness_v10.safetensors		yorBriarSpyFamily_lykonV1.safetensors
hf2ming-beta-020601.safetensors  koreanDollLikeness_v15.safetensors  styleJelly_v10.safetensors			     yaeMikoRealistic_yaemikoMixed.safetensors

角色模型

到参考资料链接下载所有模型

出图

正向提示词

best quality, ultra high res, (photorealistic:1.4), 1girl, full body,  <lora:koreanDollLikeness_v15:1> ,<lora:yaeMikoRealistic_yaemikoMixed:1>,

反向提示词

paintings, sketches, (worst quality:2),(low quality:2),(normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glans,{{{bad_hands}}},badhand, bad_feet,

故障

OutOfMemoryError

OutOfMemoryError: CUDA out of memory. Tried to allocate 450.00 MiB (GPU 0; 5.79 GiB total capacity; 3.13 GiB already allocated; 422.62 MiB free; 3.60 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

Time taken: 33.77s

Torch active/reserved: 3948/4000 MiB, Sys VRAM: 5796/5927 MiB (97.79%)

显卡内存顶不住了,缩小图片尺寸。说明:显存大小比显卡性能重要,显存不够直接崩溃,显卡性能差点顶多慢点。

Failed to match keys when loading Lora

原来这玩意是基础模型,把这种基础模型移动到models/Stable-diffusion/ 目录下

mv models/Lora/chilloutmix_Ni.safetensors models/Stable-diffusion/

模型目录状态

在图形界面上选择该基础模型

参考资料

什么是LoRA模型,如何使用和训练LoRA模型?你想要的都在这! - 知乎

LORA模型使用教程及模型下载 Stable Diffusion WebUI - openAI

更新时间 2024-01-15