Upload lora-scripts/train_by_toml.ps1 with huggingface_hub
Browse files
lora-scripts/train_by_toml.ps1
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# LoRA train script by @Akegarasu
|
2 |
+
|
3 |
+
$config_file = "./config/default.toml" # config file | ʹ�� toml �ļ�ָ��ѵ������
|
4 |
+
$sample_prompts = "./config/sample_prompts.txt" # prompt file for sample | ���� prompts �ļ�, ���������ò�������
|
5 |
+
|
6 |
+
$sdxl = 0 # train sdxl LoRA | ѵ�� SDXL LoRA
|
7 |
+
$multi_gpu = 0 # multi gpu | ���Կ�ѵ�� �ò����������Կ��� >= 2 ʹ��
|
8 |
+
|
9 |
+
# ============= DO NOT MODIFY CONTENTS BELOW | �������·����� =====================
|
10 |
+
|
11 |
+
# Activate python venv
|
12 |
+
.\venv\Scripts\activate
|
13 |
+
|
14 |
+
$Env:HF_HOME = "huggingface"
|
15 |
+
$Env:PYTHONUTF8 = 1
|
16 |
+
|
17 |
+
$ext_args = [System.Collections.ArrayList]::new()
|
18 |
+
$launch_args = [System.Collections.ArrayList]::new()
|
19 |
+
|
20 |
+
if ($multi_gpu) {
|
21 |
+
[void]$launch_args.Add("--multi_gpu")
|
22 |
+
[void]$launch_args.Add("--num_processes=2")
|
23 |
+
}
|
24 |
+
|
25 |
+
# run train
|
26 |
+
$script_name = if ($sdxl) { "sdxl_train_network.py" } else { "train_network.py" }
|
27 |
+
python -m accelerate.commands.launch $launch_args --num_cpu_threads_per_process=8 "./sd-scripts/$script_name" `
|
28 |
+
--config_file=$config_file `
|
29 |
+
--sample_prompts=$sample_prompts `
|
30 |
+
$ext_args
|
31 |
+
|
32 |
+
Write-Output "Train finished"
|
33 |
+
Read-Host | Out-Null
|