AIGC笔记
常用Prompts
prompt: (masterpiece, ultra-detailed, illustration, best quality:1.2)
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
LoRA和Dreambooth到底是什么关系?有什么区别?对应哪些微调技巧?
它们代表的是微调模型的不同技巧,本质都是为了解决如何去微调模型的问题。因为,微调大模型很难,具体难在:
- 全量微调(微调所有参数)占用的显卡内存非常大
- 全量微调时产生的模型文件占用的磁盘空间非常大
- 微调后的模型难以准确生成特定目标的外观(比如,仅用几张图片生成电子龙)
- 微调后的模型会灾难性遗忘之前的能力(比如,只会生成电子龙,忘记什么是龙了) LoRA解决了1和2,Dreambooth解决了3和4。一般都是同时使用它们提供的方法来进行大模型微调的。
所以你们是什么关系 LoRA和Dreambooth并不是“二选一”的关系,而是互相帮助,互相成全的关系,一般它们的微调技巧会被同时使用。
所以你们有什么区别 LoRA主要解决模型全量训练的一些弊端,Dreambooth主要解决模型个性化目标重现和防止灾难性遗忘的问题。然而: LoRA论文中没有使用Dreambooth(可能发生关键性遗忘) Dreambooth论文中没有使用LoRA(意味着它是全量微调) 在训练AI时,单独使用LoRA则会面临被Dreambooth所解决的问题,反之也是。
所以你们对应哪些微调技巧 LoRA ≈ 低秩矩阵近似 + 旁路结构重参数化 Dreambooth ≈ 自创词&标识词策略 + 历史记忆加入正则项
实际使用时,不要在意这个方法到底LoRA还是Dreambooth,而是要搞清楚自己面临什么问题: 如果你有足够的时间、显存和硬盘来全量训练模型,那就没必要用LoRA 如果你的微调模型已经能很好地生成你的目标,那就没必要用Dreambooth的”自创词&标识词策略” 如果你不需要模型记住以前的记忆而是专注于你的目标,没有过拟合,那么就没必要使用Dreambooth的”正则项图像”
没有正则化图像,他就叫直接微调,有正则化图像,他才叫Dreambooth。
那LoRA又在哪里?LoRA的全称是:LoRA: Low-Rank Adaptation of Large Language Models、他是为了解决大语言模型太大了(以亿计的参数)才出现的,AI绘画是拿过来借用的。 LoRA,他只是一种为了简化微调超级大模型需要巨多算力、传大模型麻烦而产生的算法,本质上,还是上面两种微调方法:直接微调、Dreambooth方法。
WebUI中Clip Skip和VAE项设置到首页
找到webui的设置Settings,展示所有页Show all pages,然后搜索Quicksettings list项,把内容修改成sd_model_checkpoint,CLIP_stop_at_last_layers,sd_vae。 之后点Apply Settings,再点Reload UI,就可以在首页展示clip skip和VAE了。 这里的参数可以在目录下的config.json中找到。
How can I load LoRA weights (in ckpt or safetensors)? How can use ControlNet / T2I-Adapter in diffusers instead of stable-diffusion-webui? Now, we give you a solution. Quite simple, check them out!
(1) [LoRA for diffusers]: https://github.com/haofanwang/Lora-for-Diffusers
(2) [ControlNet for diffusers]: https://github.com/haofanwang/ControlNet-for-Diffusers
(3) [T2I-Adapter for diffusers]: https://github.com/haofanwang/T2I-Adapter-for-Diffusers
博客文章
- Fine-tuning with LoRA: create your own avatars & styles!
- Stable Diffusion Tutorial Part 1: Run Dreambooth in Gradient Notebooks
- Stable Diffusion Tutorial Part 2: Using Textual Inversion Embeddings to gain substantial control over your generated images
- 使用 LoRA 进行 Stable Diffusion 的高效参数微调
- 精通Stable Diffusion画图,理解LoRA、Dreambooth、Hypernetworks四大模型差异
- Dreambooth风格训练指南和训练参数原理解读
- Dreambooth微调Stable Diffusion实现txt2img个性化生成
- 文生图模型之Stable Diffusion
- What I Learned About Fine-tuning Stable Diffusion
- How to Fine-tune Stable Diffusion using LoRA
- 【AI画画教程】无整合包使用LoRA和Dreambooth训练全流程详解(Linux)
- 【AI绘画】训练lora模型,画出自己想要的人物图片
- [AI达人特训营第三期] 使用Lora技术用Dreambooth训练国潮风格模型
- 使用 🧨 Diffusers 实现 ControlNet 高速推理
- 使用 diffusers 训练你自己的 ControlNet 🧨
- ControlNet and T2I-Adapter, the icebreaker solution for precise control of AI image generation
- 精确控制 AI 图像生成的破冰方案,ControlNet 和 T2I-Adapter
- 适配Diffusers框架的全套教程来了!从T2I-Adapter到大热ControlNet
- ImageReward:文生图RLHF的全面解决方案——文本到图像生成中的人类偏好学习
参考脚本
- https://github.com/cloneofsimo/lora
- https://github.com/bmaltais/kohya_ss
- https://github.com/kohya-ss/sd-scripts
- https://github.com/Akegarasu/lora-scripts
- https://github.com/derrian-distro/LoRA_Easy_Training_Scripts
- https://github.com/haofanwang/Lora-for-Diffusers
- https://github.com/harrywang/finetune-sd.git
- https://github.com/Sanster/lama-cleaner
- https://github.com/fishslot/video_loopback_for_webui
- https://github.com/timothybrooks/instruct-pix2pix