atonyxu commited on
Commit
ceef0c1
1 Parent(s): 3c76825

Upload furry/bailin/bailin_loha/ with huggingface_hub

Browse files
furry/bailin/bailin_loha/bailin_loha-000001.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:287b8ceef27ed144c3e2b196a68580fc8825393c2f9eba880b422cfb75d49142
3
+ size 103753527
furry/bailin/bailin_loha/bailin_loha-000002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:63e7c6c85500f64a75649f1fcd4e0e9d08c43ec70c2591ef93fbcfaca196897e
3
+ size 103753527
furry/bailin/bailin_loha/bailin_loha-000003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e649fac66111110f82c644fc527a259cebefb6e7ece305d778914e4a1419bed3
3
+ size 103753527
furry/bailin/bailin_loha/bailin_loha-000004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ccfec594bdf9dd7835d23e9ff1c64b3f4cba169356b36eefd9830795bb673263
3
+ size 103753527
furry/bailin/bailin_loha/bailin_loha-000005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1931e0dca30e2e87b0ce7bdf5f51f6b49572ee37feca0887cc75e9afa9708d83
3
+ size 103753526
furry/bailin/bailin_loha/bailin_loha-000006.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:165e51dcd6ae89322f4ee38afc3da32078c12e9f56d017b793dab9fb0452cc6b
3
+ size 103753527
furry/bailin/bailin_loha/bailin_loha-000007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5ded2c489bc90156950bf0d6dd983685ba0d7d54a02819be2d926404a00c967b
3
+ size 103753526
furry/bailin/bailin_loha/bailin_loha-000008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0e319261b4f3c36b5965540e393317869defb5e99375275a39537b4dcd041596
3
+ size 103753527
furry/bailin/bailin_loha/bailin_loha-000009.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e065c29ad5392468054f70afec98af37ec286b13857f21653236cc5e5594b4d8
3
+ size 103753527
furry/bailin/bailin_loha/bailin_loha-000010.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b7481e95b3233a90f8ca5efda1b6ab11d9512b8151b0247b8d518b0b94408cc
3
+ size 103753526
furry/bailin/bailin_loha/bailin_loha-000011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b331fc12cf9a8af8931f3ab601d67466e65ae37808f3c83ee4b0efa69e7c8c33
3
+ size 103753527
furry/bailin/bailin_loha/bailin_loha-000012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3abe0d8090a864d297cb7d8323221e53b48b83e01e66b9ca4f8d1ae7e5b8e1d2
3
+ size 103753528
furry/bailin/bailin_loha/bailin_loha-000013.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4e1c374900188422a40343b9a2f06575021f6b2176e26cbc3efa90634d895520
3
+ size 103753528
furry/bailin/bailin_loha/bailin_loha-000014.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c520edccb2118dfa6eed962940066b94ea707e99c7bd4fb44ff18cfbd2f0b9a6
3
+ size 103753527
furry/bailin/bailin_loha/bailin_loha.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:18349079b9f8483287a9e70998c067299cf05fb0d877f09dfc20e11e9e8822d3
3
+ size 103753528
furry/bailin/bailin_loha/logs/bailin_loha20230405153937/network_train/events.out.tfevents.1680709265.945762cc88a5.4588.0 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:865bf87c4d3571ba9b5d2daa3986833c663f199cf63d59f536c164291ca65b52
3
+ size 108792
furry/bailin/bailin_loha/train.sh ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # LoRA train script by @Akegarasu
3
+
4
+ # Train data path | 设置训练用模型、图片
5
+ pretrained_model="/content/lora-scripts/sd-models/Animefull-final-pruned.ckpt" # base model path | 底模路径
6
+ train_data_dir="/content/lora-scripts/train/aki/" # train dataset path | 训练数据集路径
7
+ reg_data_dir="" # directory for regularization images | 正则化数据集路径,默认不使用正则化图像。
8
+
9
+ # Network settings | 网络设置
10
+ network_module="lycoris.kohya" # 在这里将会设置训练的网络种类,默认为 networks.lora 也就是 LoRA 训练。如果你想训练 LyCORIS(LoCon、LoHa) 等,则修改这个值为 lycoris.kohya
11
+ network_weights="" # pretrained weights for LoRA network | 若需要从已有的 LoRA 模型上继续训练,请填写 LoRA 模型路径。
12
+ network_dim=32 # network dim | 常用 4~128,不是越大越好
13
+ network_alpha=16 # network alpha | 常用与 network_dim 相同的值或者采用较小的值,如 network_dim的一半 防止下溢。默认值为 1,使用较小的 alpha 需要提升学习率。
14
+
15
+ # Train related params | 训练相关参数
16
+ resolution="512,768" # image resolution w,h. 图片分辨率,宽,高。支持非正方形,但必须是 64 倍数。
17
+ batch_size=3 # batch size
18
+ max_train_epoches=15 # max train epoches | 最大训练 epoch
19
+ save_every_n_epochs=1 # save every n epochs | 每 N 个 epoch 保存一次
20
+
21
+ train_unet_only=0 # train U-Net only | 仅训练 U-Net,开启这个会牺牲效果大幅减少显存使用。6G显存可以开启
22
+ train_text_encoder_only=0 # train Text Encoder only | 仅训练 文本编码器
23
+
24
+ noise_offset=0 # noise offset | 在训练中添加噪声偏移来改良生成非常暗或者非常亮的图像,如果启用,推荐参数为0.1
25
+ keep_tokens=1 # keep heading N tokens when shuffling caption tokens | 在随机打乱 tokens 时,保留前 N 个不变。
26
+
27
+ # Learning rate | 学习率
28
+ lr="1.5e-4"
29
+ unet_lr="1.5e-4"
30
+ text_encoder_lr="1e-5"
31
+ lr_scheduler="cosine_with_restarts" # "linear", "cosine", "cosine_with_restarts", "polynomial", "constant", "constant_with_warmup"
32
+ lr_warmup_steps=0 # warmup steps | 仅在 lr_scheduler 为 constant_with_warmup 时需要填写这个值
33
+ lr_restart_cycles=1 # cosine_with_restarts restart cycles | 余弦退火重启次数,仅在 lr_scheduler 为 cosine_with_restarts 时起效。
34
+
35
+ # Output settings | 输出设置
36
+ output_name="bailin_loha" # output model name | 模型保存名称
37
+ save_model_as="safetensors" # model save ext | 模型保存格式 ckpt, pt, safetensors
38
+
39
+ # 其他设置
40
+ min_bucket_reso=256 # arb min resolution | arb 最小分辨率
41
+ max_bucket_reso=1024 # arb max resolution | arb 最大分辨率
42
+ persistent_data_loader_workers=0 # persistent dataloader workers | 容易爆内存,保留加载训练集的worker,减少每个 epoch 之间的停顿
43
+ clip_skip=2 # clip skip | 玄学 一般用 2
44
+
45
+ # 优化器设置
46
+ use_8bit_adam=0 # use 8bit adam optimizer | 使用 8bit adam 优化器节省显存,默认启用。部分 10 系老显卡无法使用,修改为 0 禁用。
47
+ use_lion=1 # use lion optimizer | 使用 Lion 优化器
48
+
49
+ # LyCORIS 训练设置
50
+ algo="loha" # LyCORIS network algo | LyCORIS 网络算法 可选 lora、loha。lora即为locon
51
+ conv_dim=8 # conv dim | 类似于 network_dim,推荐为 4
52
+ conv_alpha=4 # conv alpha | 类似于 network_alpha,可以采用与 conv_dim 一致或者更小的值
53
+
54
+ # ============= DO NOT MODIFY CONTENTS BELOW | 请勿修改下方内容 =====================
55
+ export HF_HOME="huggingface"
56
+ export TF_CPP_MIN_LOG_LEVEL=3
57
+
58
+ extArgs=()
59
+
60
+ if [ $train_unet_only == 1 ]; then extArgs+=("--network_train_unet_only"); fi
61
+
62
+ if [ $train_text_encoder_only == 1 ]; then extArgs+=("--network_train_text_encoder_only"); fi
63
+
64
+ if [ $network_weights ]; then extArgs+=("--network_weights $network_weights"); fi
65
+
66
+ if [ $reg_data_dir ]; then extArgs+=("--reg_data_dir $reg_data_dir"); fi
67
+
68
+ if [ $use_8bit_adam == 1 ]; then extArgs+=("--use_8bit_adam"); fi
69
+
70
+ if [ $use_lion == 1 ]; then extArgs+=("--use_lion_optimizer"); fi
71
+
72
+ if [ $persistent_data_loader_workers == 1 ]; then extArgs+=("--persistent_data_loader_workers"); fi
73
+
74
+ if [ $network_module == "lycoris.kohya" ]; then
75
+ extArgs+=("--network_args conv_dim=$conv_dim conv_alpha=$conv_alpha algo=$algo")
76
+ fi
77
+
78
+ if [ $noise_offset ]; then extArgs+=("--noise_offset $noise_offset"); fi
79
+
80
+ accelerate launch --num_cpu_threads_per_process=8 "./sd-scripts/train_network.py" \
81
+ --enable_bucket \
82
+ --pretrained_model_name_or_path=$pretrained_model \
83
+ --train_data_dir=$train_data_dir \
84
+ --output_dir="/content/drive/MyDrive/Lora/output/bailin_loha" \
85
+ --logging_dir="/content/drive/MyDrive/Lora/output/bailin_loha/logs" \
86
+ --log_prefix=$output_name \
87
+ --resolution=$resolution \
88
+ --network_module=$network_module \
89
+ --max_train_epochs=$max_train_epoches \
90
+ --learning_rate=$lr \
91
+ --unet_lr=$unet_lr \
92
+ --text_encoder_lr=$text_encoder_lr \
93
+ --lr_scheduler=$lr_scheduler \
94
+ --lr_warmup_steps=$lr_warmup_steps \
95
+ --lr_scheduler_num_cycles=$lr_restart_cycles \
96
+ --network_dim=$network_dim \
97
+ --network_alpha=$network_alpha \
98
+ --output_name=$output_name \
99
+ --train_batch_size=$batch_size \
100
+ --save_every_n_epochs=$save_every_n_epochs \
101
+ --mixed_precision="fp16" \
102
+ --save_precision="fp16" \
103
+ --seed="1337" \
104
+ --cache_latents \
105
+ --clip_skip=$clip_skip \
106
+ --prior_loss_weight=0.3 \
107
+ --max_token_length=225 \
108
+ --caption_extension=".txt" \
109
+ --save_model_as=$save_model_as \
110
+ --min_bucket_reso=$min_bucket_reso \
111
+ --max_bucket_reso=$max_bucket_reso \
112
+ --keep_tokens=$keep_tokens \
113
+ --xformers --shuffle_caption ${extArgs[@]}