准备工作
请你确保,你已经完成了 StableDiffusion-01
这一节的内容,可以顺利的运行SD,并且可以正常的生成图片。
本节我们就尝试使用LoRA
并生成图片。
介绍 LoRA
Stable Diffusion
中的LoRA(Low-Rank Adaptation,低秩自适应)
是一种针对大型模型微调的技术,旨在加速模型的训练过程并显著减少模型文件的存储成本。这项技术通过冻结原有基础模型的权重层并重新计算,实现了快速的训练速度和较小的模型文件大小,从而提高了训练效率和降低了存储成本。
下载 LoRA
- Liblib模型下载:liblib官方
- Civitai模型下载:Civitai C站官方
这种左上角写:LoRA
的,便是我们要下载的模型,你可以自己挑选喜欢的。
可以在网上下载到关于Lora的模型,相比于实际的模型,它会小很多。
选择 Lora选项卡:
可以看到我们需要把LoRA
放到目录下,目前我下载了:五彩斑斓_1.0.safetensors
把该文件,放到上述的xxx/models/lora
目录下即可
加载LoRA
重启你的服务,这个时候重新选择LoRA选项卡
就可以看到了
使用 LoRA
此时点击该 Lora就会看到,Prompt
提示词中多了:
<lora:新蜡笔:1>
此时,我们继续往提示词中添加内容即可:
<lora:新蜡笔:1>, xxxxx(你的提示词,:1表示占比,可以降低比如:0.7)
按照上一节,我们的配置,生成图片:
测试案例
Prompt
<lora:新蜡笔:1>, Fashion Girl, (height: 1.1) , (color: 0.9) , (masterpiece: 1.2) , extremely complex, best quality, detail, 8k, height, 1 girl, mature female, short hair, real light source, focus person lens, close-up, uP front, subjective perspective, male focus, looking at the audience, solo, medium lens, define 'real' light source, straight line, (above: 0.9) , (over-the-shoulder shot) , (chest: 1.1) , Tall Woman, (crotch: 1.1) , shot from a distance, looking away, gradation of hair, indigo eyes, delicate eyes, shy expression, (a slim woman standing on the observation deck: 1.1) , view from a tall observation tower, (wearing a light-colored Jyoshi Kousei suit: 1.05) , (thick-waisted shirt) , (pleated skirt) , aloof expression, small breasts, outdoor, landscape, trees, plants, lakes, (Blue Sky: 0.3) ,
Negative Prompt
nsfw,yallow,(((pubic))), ((((pubic_hair)))),sketch, duplicate, ugly, huge eyes, text, logo, monochrome, worst face, (bad and mutated hands:1.3), (worst quality:1.7), (low quality:1.7), (blurry:1.7),horror, geometry, bad_prompt, (bad hands), (missing fingers), multiple limbs, bad anatomy, (interlocked fingers:1.2),(interlocked leg:1.2), Ugly Fingers, (extra digit and hands and fingers and legs and arms:1.4), crown braid,, (deformed fingers:1.2), (long fingers:1.2),succubus wings,horn,succubus horn,succubus hairstyle, (bad-artist-anime), bad-artist, bad hand,
其他参数
保持和上一节一致即可,详见 StableDiffusion-01
中的内容。
生成图片
多LoRA
同理,我们下载多个 LoRA
,放到指定的目录,即可看到:
多LoRA案例
调整 LoRA
的占比
LoRA列表,这次选择两个,分别配置占比为1和0.4
Prompt
<lora:新蜡笔:1> <lora:gfzzjl-SDXL:0.4>,girl swims underwater,hyper detailed render style,glow,yellow,blue,brush,surreal oil painting,shiny eyes,head closeup,exaggerated perspective,tyndall effect,water drops,mother of pearl iridescence,holographic white,black background,
Negative Prompt
sketches, (worst quality:2), (low quality:2), (normal quality:2), lowers, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, bad anatomy,DeepNegative,(fat:1.2),facing away, looking away,tilted head, 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,bad feet,cropped,poorly drawn hands,poorly drawn face,mutation,deformed,worst quality,low quality,normal quality,jpeg artifacts,signature,watermark,extra fingers,fewer digits,extra limbs,extra arms,extra legs,malformed limbs,fused fingers,too many fingers,long neck,cross-eyed,mutated hands,bad body,bad proportions,gross proportions,text,error,missing fingers,missing arms,missing legs,extra digit, extra arms, extra leg, extra foot