change to scripts
parent
b138cc4f8c
commit
f40daee65e
|
|
@ -1,6 +1,3 @@
|
||||||
[submodule "sd-scripts"]
|
|
||||||
path = sd-scripts
|
|
||||||
url = https://github.com/Akegarasu/sd-scripts.git
|
|
||||||
[submodule "frontend"]
|
[submodule "frontend"]
|
||||||
path = frontend
|
path = frontend
|
||||||
url = https://github.com/hanamizuki-ai/lora-gui-dist
|
url = https://github.com/hanamizuki-ai/lora-gui-dist
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ if (!(Test-Path -Path "venv")) {
|
||||||
.\venv\Scripts\activate
|
.\venv\Scripts\activate
|
||||||
Check "激活虚拟环境失败。"
|
Check "激活虚拟环境失败。"
|
||||||
|
|
||||||
Set-Location .\sd-scripts
|
Set-Location .\scripts
|
||||||
Write-Output "安装程序所需依赖 (已进行国内加速,若在国外或无法使用加速源请换用 install.ps1 脚本)"
|
Write-Output "安装程序所需依赖 (已进行国内加速,若在国外或无法使用加速源请换用 install.ps1 脚本)"
|
||||||
$install_torch = Read-Host "是否需要安装 Torch+xformers? [y/n] (默认为 y)"
|
$install_torch = Read-Host "是否需要安装 Torch+xformers? [y/n] (默认为 y)"
|
||||||
if ($install_torch -eq "y" -or $install_torch -eq "Y" -or $install_torch -eq ""){
|
if ($install_torch -eq "y" -or $install_torch -eq "Y" -or $install_torch -eq ""){
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installing deps..."
|
echo "Installing deps..."
|
||||||
cd "$script_dir/sd-scripts" || exit
|
cd "$script_dir/scripts" || exit
|
||||||
|
|
||||||
pip install --upgrade -r requirements.txt
|
pip install --upgrade -r requirements.txt
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ if (!(Test-Path -Path "venv")) {
|
||||||
.\venv\Scripts\activate
|
.\venv\Scripts\activate
|
||||||
|
|
||||||
Write-Output "Installing deps..."
|
Write-Output "Installing deps..."
|
||||||
Set-Location .\sd-scripts
|
Set-Location .\scripts
|
||||||
pip install torch==2.4.0 torchvision==0.19.0 --extra-index-url https://download.pytorch.org/whl/cu121
|
pip install torch==2.4.0 torchvision==0.19.0 --extra-index-url https://download.pytorch.org/whl/cu121
|
||||||
pip install -U -I --no-deps xformers==0.0.27.post2
|
pip install -U -I --no-deps xformers==0.0.27.post2
|
||||||
pip install --upgrade -r requirements.txt
|
pip install --upgrade -r requirements.txt
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ if ($v2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# run interrogate
|
# run interrogate
|
||||||
accelerate launch --num_cpu_threads_per_process=8 "./sd-scripts/networks/lora_interrogator.py" `
|
accelerate launch --num_cpu_threads_per_process=8 "./scripts/networks/lora_interrogator.py" `
|
||||||
--sd_model=$sd_model `
|
--sd_model=$sd_model `
|
||||||
--model=$model `
|
--model=$model `
|
||||||
--batch_size=$batch_size `
|
--batch_size=$batch_size `
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,12 @@ avaliable_scripts = [
|
||||||
avaliable_schemas = []
|
avaliable_schemas = []
|
||||||
|
|
||||||
trainer_mapping = {
|
trainer_mapping = {
|
||||||
"sd-lora": "./sd-scripts/train_network.py",
|
"sd-lora": "./scripts/train_network.py",
|
||||||
"sdxl-lora": "./sd-scripts/sdxl_train_network.py",
|
"sdxl-lora": "./scripts/sdxl_train_network.py",
|
||||||
"sd3-lora": "./sd-scripts/sd3_train_network.py",
|
"sd3-lora": "./scripts/sd3_train_network.py",
|
||||||
"flux-lora": "./sd-scripts/flux_train_network.py",
|
"flux-lora": "./scripts/flux_train_network.py",
|
||||||
"sd-dreambooth": "./sd-scripts/train_db.py",
|
"sd-dreambooth": "./scripts/train_db.py",
|
||||||
"sdxl-finetune": "./sd-scripts/sdxl_train.py",
|
"sdxl-finetune": "./scripts/sdxl_train.py",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ from mikazuki.launch_utils import base_dir_path
|
||||||
|
|
||||||
|
|
||||||
def run_train(toml_path: str,
|
def run_train(toml_path: str,
|
||||||
trainer_file: str = "./sd-scripts/train_network.py",
|
trainer_file: str = "./scripts/train_network.py",
|
||||||
gpu_ids: Optional[list] = None,
|
gpu_ids: Optional[list] = None,
|
||||||
cpu_threads: Optional[int] = 2):
|
cpu_threads: Optional[int] = 2):
|
||||||
log.info(f"Training started with config file / 训练开始,使用配置文件: {toml_path}")
|
log.info(f"Training started with config file / 训练开始,使用配置文件: {toml_path}")
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ if ($dynamic_param) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# run resize
|
# run resize
|
||||||
accelerate launch --num_cpu_threads_per_process=8 "./sd-scripts/networks/resize_lora.py" `
|
accelerate launch --num_cpu_threads_per_process=8 "./scripts/networks/resize_lora.py" `
|
||||||
--save_precision=$save_precision `
|
--save_precision=$save_precision `
|
||||||
--new_rank=$new_rank `
|
--new_rank=$new_rank `
|
||||||
--model=$model `
|
--model=$model `
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ if ($frequency_tags) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# run tagger
|
# run tagger
|
||||||
accelerate launch --num_cpu_threads_per_process=8 "./sd-scripts/finetune/tag_images_by_wd14_tagger.py" `
|
accelerate launch --num_cpu_threads_per_process=8 "./scripts/finetune/tag_images_by_wd14_tagger.py" `
|
||||||
$train_data_dir `
|
$train_data_dir `
|
||||||
--thresh=$thresh `
|
--thresh=$thresh `
|
||||||
--caption_extension .txt `
|
--caption_extension .txt `
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ fi
|
||||||
|
|
||||||
|
|
||||||
# run tagger
|
# run tagger
|
||||||
accelerate launch --num_cpu_threads_per_process=8 "./sd-scripts/finetune/tag_images_by_wd14_tagger.py" \
|
accelerate launch --num_cpu_threads_per_process=8 "./scripts/finetune/tag_images_by_wd14_tagger.py" \
|
||||||
$train_data_dir \
|
$train_data_dir \
|
||||||
--thresh=$thresh \
|
--thresh=$thresh \
|
||||||
--caption_extension .txt \
|
--caption_extension .txt \
|
||||||
|
|
|
||||||
|
|
@ -75,14 +75,14 @@ $Env:XFORMERS_FORCE_DISABLE_TRITON = "1"
|
||||||
$ext_args = [System.Collections.ArrayList]::new()
|
$ext_args = [System.Collections.ArrayList]::new()
|
||||||
$launch_args = [System.Collections.ArrayList]::new()
|
$launch_args = [System.Collections.ArrayList]::new()
|
||||||
|
|
||||||
$trainer_file = "./sd-scripts/train_network.py"
|
$trainer_file = "./scripts/train_network.py"
|
||||||
|
|
||||||
if ($model_type -eq "sd1.5") {
|
if ($model_type -eq "sd1.5") {
|
||||||
[void]$ext_args.Add("--clip_skip=$clip_skip")
|
[void]$ext_args.Add("--clip_skip=$clip_skip")
|
||||||
} elseif ($model_type -eq "sd2.0") {
|
} elseif ($model_type -eq "sd2.0") {
|
||||||
[void]$ext_args.Add("--v2")
|
[void]$ext_args.Add("--v2")
|
||||||
} elseif ($model_type -eq "sdxl") {
|
} elseif ($model_type -eq "sdxl") {
|
||||||
$trainer_file = "./sd-scripts/sdxl_train_network.py"
|
$trainer_file = "./scripts/sdxl_train_network.py"
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($multi_gpu) {
|
if ($multi_gpu) {
|
||||||
|
|
|
||||||
4
train.sh
4
train.sh
|
|
@ -74,14 +74,14 @@ export TF_CPP_MIN_LOG_LEVEL=3
|
||||||
extArgs=()
|
extArgs=()
|
||||||
launchArgs=()
|
launchArgs=()
|
||||||
|
|
||||||
trainer_file="./sd-scripts/train_network.py"
|
trainer_file="./scripts/train_network.py"
|
||||||
|
|
||||||
if [ $model_type == "sd1.5" ]; then
|
if [ $model_type == "sd1.5" ]; then
|
||||||
ext_args+=("--clip_skip=$clip_skip")
|
ext_args+=("--clip_skip=$clip_skip")
|
||||||
elif [ $model_type == "sd2.0" ]; then
|
elif [ $model_type == "sd2.0" ]; then
|
||||||
ext_args+=("--v2")
|
ext_args+=("--v2")
|
||||||
elif [ $model_type == "sdxl" ]; then
|
elif [ $model_type == "sdxl" ]; then
|
||||||
trainer_file="./sd-scripts/sdxl_train_network.py"
|
trainer_file="./scripts/sdxl_train_network.py"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $multi_gpu == 1 ]]; then
|
if [[ $multi_gpu == 1 ]]; then
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ if ($multi_gpu) {
|
||||||
|
|
||||||
# run train
|
# run train
|
||||||
$script_name = if ($sdxl) { "sdxl_train_network.py" } else { "train_network.py" }
|
$script_name = if ($sdxl) { "sdxl_train_network.py" } else { "train_network.py" }
|
||||||
python -m accelerate.commands.launch $launch_args --num_cpu_threads_per_process=8 "./sd-scripts/$script_name" `
|
python -m accelerate.commands.launch $launch_args --num_cpu_threads_per_process=8 "./scripts/$script_name" `
|
||||||
--config_file=$config_file `
|
--config_file=$config_file `
|
||||||
--sample_prompts=$sample_prompts `
|
--sample_prompts=$sample_prompts `
|
||||||
$ext_args
|
$ext_args
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ else
|
||||||
script_name="train_network.py"
|
script_name="train_network.py"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
python -m accelerate.commands.launch "${launchArgs[@]}" --num_cpu_threads_per_process=8 "./sd-scripts/$script_name" \
|
python -m accelerate.commands.launch "${launchArgs[@]}" --num_cpu_threads_per_process=8 "./scripts/$script_name" \
|
||||||
--config_file="$config_file" \
|
--config_file="$config_file" \
|
||||||
--sample_prompts="$sample_prompts" \
|
--sample_prompts="$sample_prompts" \
|
||||||
"${extArgs[@]}"
|
"${extArgs[@]}"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue