Skip to content

Commit

Permalink
添加噪声偏移的设定
Browse files Browse the repository at this point in the history
  • Loading branch information
waterminer authored and Akegarasu committed Mar 5, 2023
1 parent 419ba01 commit 50669c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion train.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ $network_weights = "" # pretrained weights for LoRA network | 若需要从已有
$min_bucket_reso = 256 # arb min resolution | arb 最小分辨率
$max_bucket_reso = 1024 # arb max resolution | arb 最大分辨率
$persistent_data_loader_workers = 0 # persistent dataloader workers | 容易爆内存,保留加载训练集的worker,减少每个 epoch 之间的停顿
$noise_offset = 0 # noise offset | 在训练中添加噪声偏移来改良生成非常暗或者非常亮的图像,推荐参数为0.1

# 优化器设置
$use_8bit_adam = 1 # use 8bit adam optimizer | 使用 8bit adam 优化器节省显存,默认启用。部分 10 系老显卡无法使用,修改为 0 禁用。
Expand Down Expand Up @@ -86,6 +87,10 @@ if ($enable_locon_train) {
[void]$ext_args.Add("conv_alpha=$conv_alpha")
}

if ($noise_offset){
[void]$ext_args.Add("--noise_offset=$noise_offset")
}

# run train
accelerate launch --num_cpu_threads_per_process=8 "./sd-scripts/train_network.py" `
--enable_bucket `
Expand Down Expand Up @@ -119,6 +124,5 @@ accelerate launch --num_cpu_threads_per_process=8 "./sd-scripts/train_network.py
--min_bucket_reso=$min_bucket_reso `
--max_bucket_reso=$max_bucket_reso `
--xformers --shuffle_caption $ext_args

Write-Output "Train finished"
Read-Host | Out-Null ;
3 changes: 3 additions & 0 deletions train.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ network_weights="" # pretrained weights for LoRA network | 若需
min_bucket_reso=256 # arb min resolution | arb 最小分辨率
max_bucket_reso=1024 # arb max resolution | arb 最大分辨率
persistent_data_loader_workers=0 # persistent dataloader workers | 容易爆内存,保留加载训练集的worker,减少每个 epoch 之间的停顿
noise_offset=0 # noise offset | 在训练中添加噪声偏移来改良生成非常暗或者非常亮的图像,推荐参数为0.1

# 优化器设置
use_8bit_adam=1 # use 8bit adam optimizer | 使用 8bit adam 优化器节省显存,默认启用。部分 10 系老显卡无法使用,修改为 0 禁用。
Expand Down Expand Up @@ -69,6 +70,8 @@ if [ $enable_locon_train == 1 ]; then
extArgs+=("--network_args conv_dim=$conv_dim conv_alpha=$conv_alpha")
fi

if [ $noise_offset ]; then extArgs+=("--noise_offset $noise_offset"); fi

accelerate launch --num_cpu_threads_per_process=8 "./sd-scripts/train_network.py" \
--enable_bucket \
--pretrained_model_name_or_path=$pretrained_model \
Expand Down

0 comments on commit 50669c6

Please sign in to comment.