santa hat
deerdeer nosedeer glow
Sign In

SDXL 2D Lora: 20MB is already a sufficient size. SDXL 二次元 Lora:20MB已经是足够的大小

 SDXL 2D Lora: 20MB is already a sufficient size. SDXL 二次元 Lora:20MB已经是足够的大小

2023.12.13: The article has been updated, and the 54M of 8dim is not the smallest, but rather 4dim.

2024.1.7: I'm really happy to train with 4dim. It's enough for single-role situations.

2024.1.20: I rewrote the article again.


Around November 2023, I proposed that 50MB is sufficient for SDXL 2D Lora, and until now, I still believe that it is unnecessary to exceed 50MB (8dim) for training SDXL 2D single characters.

Even for simple characters, 27MB (4dim) is completely sufficient.

At that time, I gave the following example:

Star Rail_XL 星穹铁道 黑塔 Herta 8dim/32dim - Dim32 | Stable Diffusion LoRA | Civitai

Star Rail_XL 星穹铁道 黑塔 Herta 8dim/32dim - Dim8 | Stable Diffusion LoRA | Civitai

For the character "Black Tower," I trained two Loras with different dimensions while keeping other parameters consistent:

The training model used was SDXL1.0 official model.

The testing and inference model used was Kohaku-XL beta - beta5 | Stable Diffusion Checkpoint | Civitai

Among them, "heita_32 to 8" is a process where the 32dim is reduced to 8dim using the supermerger plugin.

Plugin link: hako-mikan/sd-webui-supermerger: model merge extention for stable diffusion web ui (github.com)

It can be observed that the 8dim Lora, compared to the 32dim Lora, does not show any degradation in visual quality. In some cases, it even improves.

Keep in mind that the 32dim Lora is approximately 200MB, while the 8dim Lora is around 50MB. The two differ significantly in volume, and if the effects are similar, people would likely choose the smaller 4dim version.

Similarly, I performed tests on another model:

Star Rail_XL 星穹铁道 布洛妮娅 Bronya 8dim/32dim - Dim32 | Stable Diffusion LoRA | Civitai

Star Rail_XL 星穹铁道 布洛妮娅 Bronya 8dim/32dim - Dim8 | Stable Diffusion LoRA | Civitai

Again, with both 8dim and 32dim versions, it seems that the performance of the 8dim version is better (yet to be verified).

32dim:

ultra-detailed,(best quality),((masterpiece)),(highres),original,extremely,1girl,Bronya,upper body,white hair,very long ha...

8dim:

ultra-detailed,(best quality),((masterpiece)),(highres),original,extremely,1girl,Bronya,upper body,white hair,very long ha...

Furthermore, I trained a batch of 8dim Loras, and in one of the character Loras, I even tried fitting seven sets of clothing:

Azur Lane_XL 碧蓝航线 大凤 多套服装 taihou Multiple sets of clothing - v1.0 | Stable Diffusion LoRA | Civitai

This at least indicates that the information capacity of the 8dim Lora is sufficient.

I continued the practice of training with 8dim for a long time, until one day,kitarz Creator Profile | Civitai Creator Profile | Civitai showed me a batch of Loras, where the characters were trained with 4dim. When I tested them, I found that the characters were highly restored.

Afterward, I thought that perhaps the volume of single-character Loras could be further reduced to 4dim.

On that day, I released my first 4dim Lora:

Link: Genshin_XL|原神可莉 Klee - v1.5 | Stable Diffusion LoRA | Civitai

Since then, I have been using 4dim for training, resulting in Loras with a size of approximately 27MB (I trained the text encoder as well).

In recent tests, I managed to fit six characters in the 4dim space, and they were able to retain their distinctive features effectively.

六合一 SIX IN ONE BanG Dream! It's MyGO!!!!! - v1.0 | Stable Diffusion LoRA | Civitai

Recently, jiayev1 proposed in their model introduction that an 8dim Lora is sufficient for training a realistic Lora. I find this to be an interesting viewpoint:

Link: Ana de Armas - SDXL 8 dim ver: NO MORE HUGE LORAs. - v1.0 | Stable Diffusion LoRA | Civitai

artcles:https://civitai.com/articles/3773/

To all SDXL trainers, why can't we further reduce the volume of SDXL Loras, making it more convenient for our users and more disk-space friendly?

2023.12.13:文章已经更新,8dim的54M不是最小的,而是4dim

2024.1.7:使用4dim训练真开心,单角色时候4dim就够了

2024.1.20:重新把文章写了一遍

_______

大概2023年11月的时候,我提出对于SDXL 二次元lora来说,50M已经是足够的大小,直至现在,我也认为,如果是训练SDXL二次元单角色的话,实在没有必要超过50M(8dim)。

甚至,如果是简单的角色的话,27M(4dim)也是完全足够的

当时举出的例子是这个:

Star Rail_XL 星穹铁道 黑塔 Herta 8dim/32dim - Dim32 | Stable Diffusion LoRA | Civitai

Star Rail_XL 星穹铁道 黑塔 Herta 8dim/32dim - Dim8 | Stable Diffusion LoRA | Civitai

针对黑塔这个角色,我分别训练了两个lora,处理dim不同,其他参数都保持一致:

训练的模型为SDXL1.0官模。

测试推理的模型为Kohaku-XL beta - beta5 | Stable Diffusion Checkpoint | Civitai

其中,heita_32 to 8是将32dim通过supermerger插件将dim值从32降到8。

插件链接:hako-mikan/sd-webui-supermerger: model merge extention for stable diffusion web ui (github.com)

可以看到,8dim的lora对比32dim的lora,在画面效果上并没有劣化,某种程度上,反而变好了。

要知道32dim的lora,大概为200M,而8dim的lora,大概为50M,二者在体积上相差巨大,如果效果相差不大,我相信人们还是会选择体积更小的4dim版本。

无独有偶,我还拿另一个模型做了测试:

Star Rail_XL 星穹铁道 布洛妮娅 Bronya 8dim/32dim - Dim32 | Stable Diffusion LoRA | Civitai

Star Rail_XL 星穹铁道 布洛妮娅 Bronya 8dim/32dim - Dim8 | Stable Diffusion LoRA | Civitai

同样是8dim版本和32dim版本,似乎在8dim版本中,lora的表现更优(待验证)。

32dim:

ultra-detailed,(best quality),((masterpiece)),(highres),original,extremely,1girl,Bronya,upper body,white hair,very long ha...

8dim:

ultra-detailed,(best quality),((masterpiece)),(highres),original,extremely,1girl,Bronya,upper body,white hair,very long ha...

在后面,我也训练了一批8dim的lora,再某个角色lora里面,我还尝试往里面塞了7套衣服:

Azur Lane_XL 碧蓝航线 大凤 多套服装 taihou Multiple sets of clothing - v1.0 | Stable Diffusion LoRA | Civitai

在这个lora里面,我往里面塞了7套衣服:

这至少说明,8dim的可以容纳的信息量是足够的。

8dim的训练习惯一直持续了好久,直至有一天,kitarz Creator Profile | Civitai

向我展示一批lora,里面的角色使用4dim训练,然后我测试了一下,发现角色的还原度都很高。

后面我觉得,也许,单角色的体积还能再降,降到4dim。

在这一天,我发布了我的第一个4dim的lora:

链接:Genshin_XL|原神可莉 Klee - v1.5 | Stable Diffusion LoRA | Civitai

再后面,我就一直使用4dim训练,这样训练出来的lora,大概是27M(我训练了文本编码器)。

在最近的测试中,我在4dim中塞进了6个角色,并且都能很好的还原各自的特征。

六合一 SIX IN ONE BanG Dream! It's MyGO!!!!! - v1.0 | Stable Diffusion LoRA | Civitai

最近,jiayev1 在他的模型简介中提出了,8dim就可以训练一个真人lora,我觉得是一个很有意思的观点:

链接:Ana de Armas - SDXL 8 dim ver: NO MORE HUGE LORAs. - v1.0 | Stable Diffusion LoRA | Civitai

artcles:https://civitai.com/articles/3773/

诸位SDXL的训练师们,为什么我们不能把SDXL的lora体积更降一些呢,更方便我们的用户,对我们的磁盘空间更友好一点呢?

42

Comments