From f40daee65e1e94ee6d61a6dde56c2b5be2a6e6e6 Mon Sep 17 00:00:00 2001 From: Akegarasu Date: Fri, 30 Aug 2024 19:45:48 +0800 Subject: [PATCH] change to scripts --- .gitmodules | 3 --- install-cn.ps1 | 2 +- install.bash | 2 +- install.ps1 | 2 +- interrogate.ps1 | 2 +- mikazuki/app/api.py | 12 ++++++------ mikazuki/process.py | 2 +- resize.ps1 | 2 +- tagger.ps1 | 2 +- tagger.sh | 2 +- train.ps1 | 4 ++-- train.sh | 4 ++-- train_by_toml.ps1 | 2 +- train_by_toml.sh | 2 +- 14 files changed, 20 insertions(+), 23 deletions(-) diff --git a/.gitmodules b/.gitmodules index 5c4e04d..a8e75f1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "sd-scripts"] - path = sd-scripts - url = https://github.com/Akegarasu/sd-scripts.git [submodule "frontend"] path = frontend url = https://github.com/hanamizuki-ai/lora-gui-dist diff --git a/install-cn.ps1 b/install-cn.ps1 index 9f2dd35..286bcde 100644 --- a/install-cn.ps1 +++ b/install-cn.ps1 @@ -27,7 +27,7 @@ if (!(Test-Path -Path "venv")) { .\venv\Scripts\activate Check "激活虚拟环境失败。" -Set-Location .\sd-scripts +Set-Location .\scripts Write-Output "安装程序所需依赖 (已进行国内加速,若在国外或无法使用加速源请换用 install.ps1 脚本)" $install_torch = Read-Host "是否需要安装 Torch+xformers? [y/n] (默认为 y)" if ($install_torch -eq "y" -or $install_torch -eq "Y" -or $install_torch -eq ""){ diff --git a/install.bash b/install.bash index c975d3d..5876d1b 100644 --- a/install.bash +++ b/install.bash @@ -60,7 +60,7 @@ else fi echo "Installing deps..." -cd "$script_dir/sd-scripts" || exit +cd "$script_dir/scripts" || exit pip install --upgrade -r requirements.txt diff --git a/install.ps1 b/install.ps1 index f98eb0a..9c75fa8 100644 --- a/install.ps1 +++ b/install.ps1 @@ -7,7 +7,7 @@ if (!(Test-Path -Path "venv")) { .\venv\Scripts\activate 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 -U -I --no-deps xformers==0.0.27.post2 pip install --upgrade -r requirements.txt diff --git a/interrogate.ps1 b/interrogate.ps1 index 35f4567..77f4d09 100644 --- a/interrogate.ps1 +++ b/interrogate.ps1 @@ -18,7 +18,7 @@ if ($v2) { } # 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 ` --model=$model ` --batch_size=$batch_size ` diff --git a/mikazuki/app/api.py b/mikazuki/app/api.py index 58dd640..8efcc35 100644 --- a/mikazuki/app/api.py +++ b/mikazuki/app/api.py @@ -35,12 +35,12 @@ avaliable_scripts = [ avaliable_schemas = [] trainer_mapping = { - "sd-lora": "./sd-scripts/train_network.py", - "sdxl-lora": "./sd-scripts/sdxl_train_network.py", - "sd3-lora": "./sd-scripts/sd3_train_network.py", - "flux-lora": "./sd-scripts/flux_train_network.py", - "sd-dreambooth": "./sd-scripts/train_db.py", - "sdxl-finetune": "./sd-scripts/sdxl_train.py", + "sd-lora": "./scripts/train_network.py", + "sdxl-lora": "./scripts/sdxl_train_network.py", + "sd3-lora": "./scripts/sd3_train_network.py", + "flux-lora": "./scripts/flux_train_network.py", + "sd-dreambooth": "./scripts/train_db.py", + "sdxl-finetune": "./scripts/sdxl_train.py", } diff --git a/mikazuki/process.py b/mikazuki/process.py index 7ec10ef..8d77f41 100644 --- a/mikazuki/process.py +++ b/mikazuki/process.py @@ -11,7 +11,7 @@ from mikazuki.launch_utils import base_dir_path 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, cpu_threads: Optional[int] = 2): log.info(f"Training started with config file / 璁粌寮濮嬶紝浣跨敤閰嶇疆鏂囦欢: {toml_path}") diff --git a/resize.ps1 b/resize.ps1 index 859cb82..7684cb7 100644 --- a/resize.ps1 +++ b/resize.ps1 @@ -29,7 +29,7 @@ if ($dynamic_param) { } # 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 ` --new_rank=$new_rank ` --model=$model ` diff --git a/tagger.ps1 b/tagger.ps1 index cb227a6..e386d28 100644 --- a/tagger.ps1 +++ b/tagger.ps1 @@ -63,7 +63,7 @@ if ($frequency_tags) { } # 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 ` --thresh=$thresh ` --caption_extension .txt ` diff --git a/tagger.sh b/tagger.sh index 23d0356..e92ac20 100644 --- a/tagger.sh +++ b/tagger.sh @@ -63,7 +63,7 @@ fi # 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 \ --thresh=$thresh \ --caption_extension .txt \ diff --git a/train.ps1 b/train.ps1 index 384cc01..abd6f33 100644 --- a/train.ps1 +++ b/train.ps1 @@ -75,14 +75,14 @@ $Env:XFORMERS_FORCE_DISABLE_TRITON = "1" $ext_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") { [void]$ext_args.Add("--clip_skip=$clip_skip") } elseif ($model_type -eq "sd2.0") { [void]$ext_args.Add("--v2") } elseif ($model_type -eq "sdxl") { - $trainer_file = "./sd-scripts/sdxl_train_network.py" + $trainer_file = "./scripts/sdxl_train_network.py" } if ($multi_gpu) { diff --git a/train.sh b/train.sh index 05182e2..31c5b17 100644 --- a/train.sh +++ b/train.sh @@ -74,14 +74,14 @@ export TF_CPP_MIN_LOG_LEVEL=3 extArgs=() launchArgs=() -trainer_file="./sd-scripts/train_network.py" +trainer_file="./scripts/train_network.py" if [ $model_type == "sd1.5" ]; then ext_args+=("--clip_skip=$clip_skip") elif [ $model_type == "sd2.0" ]; then ext_args+=("--v2") elif [ $model_type == "sdxl" ]; then - trainer_file="./sd-scripts/sdxl_train_network.py" + trainer_file="./scripts/sdxl_train_network.py" fi if [[ $multi_gpu == 1 ]]; then diff --git a/train_by_toml.ps1 b/train_by_toml.ps1 index dcd9ca5..b99ed9e 100644 --- a/train_by_toml.ps1 +++ b/train_by_toml.ps1 @@ -24,7 +24,7 @@ if ($multi_gpu) { # run train $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 ` --sample_prompts=$sample_prompts ` $ext_args diff --git a/train_by_toml.sh b/train_by_toml.sh index c242134..bc95498 100644 --- a/train_by_toml.sh +++ b/train_by_toml.sh @@ -28,7 +28,7 @@ else script_name="train_network.py" 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" \ --sample_prompts="$sample_prompts" \ "${extArgs[@]}"