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
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
rem ### frog train benchmark ###
|
| 3 |
+
|
| 4 |
+
rem bypass Install CUDA Toolkit
|
| 5 |
+
rem SET PATH=%PATH%;C:\SD\stable-diffusion-webui\venv\Lib\site-packages\torch\lib
|
| 6 |
+
|
| 7 |
+
rem Path to
|
| 8 |
+
rem SET PYTHON=C:\SD\Python310\Python.exe
|
| 9 |
+
rem SET GIT=C:\SD\PortableGit\bin\git.exe
|
| 10 |
+
SET PYTHON=python
|
| 11 |
+
SET GIT=git
|
| 12 |
+
|
| 13 |
+
rem VERS
|
| 14 |
+
rem 1. torch==1.12.1+cu116 xformers-0.0.14.dev0
|
| 15 |
+
rem 2. torch==1.13.1+cu117 xformers-0.0.16rc425
|
| 16 |
+
SET VERS=1
|
| 17 |
+
|
| 18 |
+
rem MODE
|
| 19 |
+
rem 1. install+train+inference
|
| 20 |
+
rem 2. train+inference
|
| 21 |
+
rem 3. inference
|
| 22 |
+
SET MODE=1
|
| 23 |
+
|
| 24 |
+
rem BATCH_SIZE=2 IF VRAM < 10GB
|
| 25 |
+
SET BATCH_SIZE=4
|
| 26 |
+
|
| 27 |
+
rem #############################
|
| 28 |
+
|
| 29 |
+
if %MODE% == 1 (
|
| 30 |
+
rem latest sd-scripts
|
| 31 |
+
%GIT% clone https://github.com/kohya-ss/sd-scripts.git
|
| 32 |
+
)
|
| 33 |
+
cd sd-scripts
|
| 34 |
+
|
| 35 |
+
if %MODE% == 1 (
|
| 36 |
+
rem frog and SDv1.5
|
| 37 |
+
%GIT% clone https://huggingface.co/aka7774/frog_bench.git
|
| 38 |
+
|
| 39 |
+
%PYTHON% -m venv venv
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
rem venv activate
|
| 43 |
+
SET PYTHON=%cd%\venv\Scripts\Python.exe
|
| 44 |
+
SET PIP=%cd%\venv\Scripts\pip.exe
|
| 45 |
+
SET ACCELERATE=%cd%\venv\Scripts\accelerate.exe
|
| 46 |
+
|
| 47 |
+
if %MODE% == 1 (
|
| 48 |
+
|
| 49 |
+
if %VERS% == 1 (
|
| 50 |
+
"%PYTHON%" -m pip install torch==1.12.1+cu116 torchvision==0.13.1+cu116 --extra-index-url https://download.pytorch.org/whl/cu116
|
| 51 |
+
"%PYTHON%" -m pip install --upgrade -r requirements.txt
|
| 52 |
+
"%PYTHON%" -m pip install -U -I --no-deps https://github.com/C43H66N12O12S2/stable-diffusion-webui/releases/download/f/xformers-0.0.14.dev0-cp310-cp310-win_amd64.whl
|
| 53 |
+
)
|
| 54 |
+
|
| 55 |
+
if %VERS% == 2 (
|
| 56 |
+
"%PYTHON%" -m pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117
|
| 57 |
+
"%PYTHON%" -m pip install --upgrade -r requirements.txt
|
| 58 |
+
"%PYTHON%" -m pip install -U -I --no-deps xformers==0.0.16rc425
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
+
copy /y .\bitsandbytes_windows\*.dll .\venv\Lib\site-packages\bitsandbytes\
|
| 62 |
+
copy /y .\bitsandbytes_windows\cextension.py .\venv\Lib\site-packages\bitsandbytes\cextension.py
|
| 63 |
+
copy /y .\bitsandbytes_windows\main.py .\venv\Lib\site-packages\bitsandbytes\cuda_setup\main.py
|
| 64 |
+
)
|
| 65 |
+
|
| 66 |
+
if %MODE% leq 2 (
|
| 67 |
+
|
| 68 |
+
call :GetStartTime
|
| 69 |
+
|
| 70 |
+
%ACCELERATE% launch ^
|
| 71 |
+
--num_cpu_threads_per_process 4 ^
|
| 72 |
+
--num_processes 1 ^
|
| 73 |
+
--num_machines 1 ^
|
| 74 |
+
--dynamo_backend no ^
|
| 75 |
+
--mixed_precision fp16 ^
|
| 76 |
+
train_network.py ^
|
| 77 |
+
--pretrained_model_name_or_path=frog_bench/model/v1-5-pruned-pruned-fp16.safetensors ^
|
| 78 |
+
--train_data_dir=frog_bench/train ^
|
| 79 |
+
--reg_data_dir=frog_bench/reg ^
|
| 80 |
+
--prior_loss_weight=1.0 ^
|
| 81 |
+
--resolution 512 ^
|
| 82 |
+
--output_dir=lora_output ^
|
| 83 |
+
--output_name=cjgg_frog ^
|
| 84 |
+
--train_batch_size=%BATCH_SIZE% ^
|
| 85 |
+
--learning_rate=1e-4 ^
|
| 86 |
+
--max_train_epochs 4 ^
|
| 87 |
+
--use_8bit_adam ^
|
| 88 |
+
--xformers ^
|
| 89 |
+
--mixed_precision=fp16 ^
|
| 90 |
+
--save_precision=fp16 ^
|
| 91 |
+
--seed 42 ^
|
| 92 |
+
--save_model_as=safetensors ^
|
| 93 |
+
--max_data_loader_n_workers=1 ^
|
| 94 |
+
--network_module=networks.lora ^
|
| 95 |
+
--network_dim=4 ^
|
| 96 |
+
--training_comment="activate by usu frog"
|
| 97 |
+
|
| 98 |
+
call :GetEndTime
|
| 99 |
+
|
| 100 |
+
)
|
| 101 |
+
|
| 102 |
+
%PYTHON% gen_img_diffusers.py ^
|
| 103 |
+
--ckpt frog_bench/model/v1-5-pruned-pruned-fp16.safetensors ^
|
| 104 |
+
--n_iter 1 ^
|
| 105 |
+
--scale 7.5 ^
|
| 106 |
+
--steps 40 ^
|
| 107 |
+
--outdir txt2img ^
|
| 108 |
+
--xformers ^
|
| 109 |
+
--W 512 ^
|
| 110 |
+
--H 512 ^
|
| 111 |
+
--fp16 ^
|
| 112 |
+
--sampler k_euler_a ^
|
| 113 |
+
--network_module networks.lora ^
|
| 114 |
+
--network_weights lora_output\cjgg_frog.safetensors ^
|
| 115 |
+
--network_mul 1.0 ^
|
| 116 |
+
--max_embeddings_multiples 3 ^
|
| 117 |
+
--clip_skip 1 ^
|
| 118 |
+
--batch_size 1 ^
|
| 119 |
+
--images_per_prompt 1 ^
|
| 120 |
+
--prompt "usu flog"
|
| 121 |
+
|
| 122 |
+
if %MODE% leq 2 (
|
| 123 |
+
call :PutTime
|
| 124 |
+
)
|
| 125 |
+
|
| 126 |
+
pause >nul
|
| 127 |
+
goto EOL
|
| 128 |
+
|
| 129 |
+
:GetStartTime
|
| 130 |
+
set T=%TIME: =0%
|
| 131 |
+
set H=%T:~0,2%
|
| 132 |
+
set M=%T:~3,2%
|
| 133 |
+
set S=%T:~6,2%
|
| 134 |
+
set C=%T:~9,2%
|
| 135 |
+
set /a H=1%H%-100,M=1%M%-100,S=1%S%-100,C=1%C%-100
|
| 136 |
+
exit /b 0
|
| 137 |
+
|
| 138 |
+
:GetEndTime
|
| 139 |
+
set T1=%TIME: =0%
|
| 140 |
+
set H1=%T1:~0,2%
|
| 141 |
+
set M1=%T1:~3,2%
|
| 142 |
+
set S1=%T1:~6,2%
|
| 143 |
+
set C1=%T1:~9,2%
|
| 144 |
+
set /a H1=1%H1%-100,M1=1%M1%-100,S1=1%S1%-100,C1=1%C1%-100
|
| 145 |
+
|
| 146 |
+
set /a H2=H1-H,M2=M1-M
|
| 147 |
+
if %M2% LSS 0 set /a H2=H2-1,M2=M2+60
|
| 148 |
+
set /a S2=S1-S
|
| 149 |
+
if %S2% LSS 0 set /a M2=M2-1,S2=S2+60
|
| 150 |
+
set /a C2=C1-C
|
| 151 |
+
if %C2% LSS 0 set /a S2=S2-1,C2=C2+100
|
| 152 |
+
if %C2% LSS 10 set C2=0%C2%
|
| 153 |
+
exit /b 0
|
| 154 |
+
|
| 155 |
+
:PutTime
|
| 156 |
+
rem echo %T%
|
| 157 |
+
rem echo %T1%
|
| 158 |
+
echo %H2%h%M2%m%S2%.%C2%s
|
| 159 |
+
echo %H2%h%M2%m%S2%.%C2%s>result.txt
|
| 160 |
+
exit /b 0
|
| 161 |
+
|
| 162 |
+
:EOL
|