CodeWithGPU | 能复现才是好算法CodeWithGPU | GitHub AI算法复现社区,能复现才是好算法https://www.codewithgpu.com/i/Akegarasu/lora-scripts/lora-trainstable-diffusion打造自己的lora模型(使用lora-scripts)-CSDN博客文章浏览阅读1.1k次。accelerate config这个命令进入之后,对于多项选择的可以用上下键,或者使用(0,1,2...)去选择相关的选项,yes or no的直接输入然后回车,大部分配置项选择默认就可以了,我这里没有使用DeepSpeed,所以这一项,我选择的No,根据自己的实际情况去选就行了,不知道啥意思的可以挨个查下。比如要训练一个自己头像的模型,就可以拍一些自己的照片(20-50张,最少15张),要求画质清晰,脸部轮廓清楚,背景较为简单的照片。方式一,直接修改train.ps1文件,修改以下配置。_lora-scriptshttps://blog.csdn.net/weixin_50516745/article/details/132434104Stable Diffusion:使用XYZ脚本生成对比图进行LoRA模型测试教程 - 知乎如下图,我们先来看下Stable Diffusion生成的对比图。 这种对比图的制作离不开XYZ plot脚本,有时候我们需要根据不同的权重来生成一系列图来进行对比测试,以此来发现最优解,这时候我们就需要用到XYZ plot脚本。 ...https://zhuanlan.zhihu.com/p/634901715直接秋叶的lora-scripts,做的非常专业。
1.wd 1.4打标
- 标签编辑器
主要就是把其中识别错误的tag做一些替换。
3.训练
配置一下数据集和模型
3.1 实验
Lion优化器,V100不支持bitsandbytes,用AdamW8bit会有问题,因此用Lion。
V1:
wd 1.4 tagger 达标,加了提示词,做了简单修改,模型rev122
snlion\\\(ip\\\), solo, white background, simple background, crewmate \(among us\), outline
python
pretrained_model_name_or_path = "/home/image_team/image_team_docker_home/lgd/e_commerce_sd/stable-diffusion-webui/models/Stable-diffusion/revAnimated_v122.safetensors"
train_data_dir = "/home/image_team/image_team_docker_home/lgd/e_commerce_sd/data/sn/lion_lora_scripts/lion_v1/"
resolution = "512,512"
enable_bucket = true
min_bucket_reso = 256
max_bucket_reso = 1024
output_name = "lion"
output_dir = "/home/image_team/image_team_docker_home/lgd/e_commerce_sd/outputs/lion_rev_v1/"
save_model_as = "safetensors"
save_every_n_epochs = 2
max_train_epochs = 20
train_batch_size = 4
network_train_unet_only = false
network_train_text_encoder_only = false
learning_rate = 0.0001
unet_lr = 0.0001
text_encoder_lr = 1e-5
lr_scheduler = "cosine_with_restarts"
optimizer_type = "Lion"
lr_scheduler_num_cycles = 1
network_module = "networks.lora"
network_dim = 32
network_alpha = 32
logging_dir = "./logs"
caption_extension = ".txt"
shuffle_caption = true
keep_tokens = 0
max_token_length = 255
seed = 1337
prior_loss_weight = 1
clip_skip = 2
mixed_precision = "fp16"
save_precision = "fp16"
xformers = false
cache_latents = true
persistent_data_loader_workers = true
lr_warmup_steps = 0
anything_v5
revanimated
V2:
进一步修改提示词,增加blip的结果,
snlion\\\(ip\\\),a lion in a pot with some veggies and utensils, frying pan, food, solo, fire, open mouth, no humans, cooking, tongue, white background, apron, fruit, simple background
V3:
只保留了触发词,其他描述均无。
snlion\\\(ip\\\)
V4:
V1的修改版本,但是没有添加blip描述,对tagger14里面的标签进行了修改和优化,去掉了dog等一些词。
准备一组测评用的prompt:
snlion\\(ip\\),<lora:lionv2:1> ->
lying in bed
The little lion lifted its head, holding a toy in its left hand and a phone in its right hand.
V1:
v2:
v3:
v4: