ACCC1380 commited on
Commit
645de99
1 Parent(s): 0d48a88

Upload lora-scripts/train_by_toml.sh with huggingface_hub

Browse files
Files changed (1) hide show
  1. lora-scripts/train_by_toml.sh +34 -0
lora-scripts/train_by_toml.sh ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # LoRA train script by @Akegarasu
3
+
4
+ config_file="./config/default.toml" # config file | 使用 toml 文件指定训练参数
5
+ sample_prompts="./config/sample_prompts.txt" # prompt file for sample | 采样 prompts 文件, 留空则不启用采样功能
6
+
7
+ sdxl=0 # train sdxl LoRA | 训练 SDXL LoRA
8
+ multi_gpu=0 # multi gpu | 多显卡训练 该参数仅限在显卡数 >= 2 使用
9
+
10
+ # ============= DO NOT MODIFY CONTENTS BELOW | 请勿修改下方内容 =====================
11
+
12
+ export HF_HOME="huggingface"
13
+ export TF_CPP_MIN_LOG_LEVEL=3
14
+ export PYTHONUTF8=1
15
+
16
+ extArgs=()
17
+ launchArgs=()
18
+
19
+ if [[ $multi_gpu == 1 ]]; then
20
+ launchArgs+=("--multi_gpu")
21
+ launchArgs+=("--num_processes=2")
22
+ fi
23
+
24
+ # run train
25
+ if [[ $sdxl == 1 ]]; then
26
+ script_name="sdxl_train_network.py"
27
+ else
28
+ script_name="train_network.py"
29
+ fi
30
+
31
+ python -m accelerate.commands.launch "${launchArgs[@]}" --num_cpu_threads_per_process=8 "./sd-scripts/$script_name" \
32
+ --config_file="$config_file" \
33
+ --sample_prompts="$sample_prompts" \
34
+ "${extArgs[@]}"