| @echo off |
| |
| |
| |
| |
| |
| |
| |
| |
| SET PYTHON=python |
| SET GIT=git |
| |
| |
| |
| |
| SET VERS=1 |
| |
| |
| |
| |
| |
| SET MODE=1 |
| |
| |
| SET BATCH_SIZE=4 |
| |
| |
|
|
| if %MODE% == 1 ( |
| |
| %GIT% clone https://github.com/kohya-ss/sd-scripts.git |
| ) |
| cd sd-scripts |
|
|
| if %MODE% == 1 ( |
| |
| %GIT% clone https://huggingface.co/aka7774/frog_bench.git |
|
|
| %PYTHON% -m venv venv |
| ) |
| |
| |
| SET PYTHON=%cd%\venv\Scripts\Python.exe |
| SET PIP=%cd%\venv\Scripts\pip.exe |
| SET ACCELERATE=%cd%\venv\Scripts\accelerate.exe |
|
|
| if %MODE% == 1 ( |
|
|
| if %VERS% == 1 ( |
| "%PYTHON%" -m pip install torch==1.12.1+cu116 torchvision==0.13.1+cu116 --extra-index-url https://download.pytorch.org/whl/cu116 |
| "%PYTHON%" -m pip install --upgrade -r requirements.txt |
| "%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 |
| ) |
|
|
| if %VERS% == 2 ( |
| "%PYTHON%" -m pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117 |
| "%PYTHON%" -m pip install --upgrade -r requirements.txt |
| "%PYTHON%" -m pip install -U -I --no-deps xformers==0.0.16rc425 |
| ) |
|
|
| copy /y .\bitsandbytes_windows\*.dll .\venv\Lib\site-packages\bitsandbytes\ |
| copy /y .\bitsandbytes_windows\cextension.py .\venv\Lib\site-packages\bitsandbytes\cextension.py |
| copy /y .\bitsandbytes_windows\main.py .\venv\Lib\site-packages\bitsandbytes\cuda_setup\main.py |
| ) |
|
|
| if %MODE% leq 2 ( |
|
|
| call :GetStartTime |
|
|
| %ACCELERATE% launch ^ |
| --num_cpu_threads_per_process 4 ^ |
| --num_processes 1 ^ |
| --num_machines 1 ^ |
| --dynamo_backend no ^ |
| --mixed_precision fp16 ^ |
| train_network.py ^ |
| --pretrained_model_name_or_path=frog_bench/model/v1-5-pruned-pruned-fp16.safetensors ^ |
| --train_data_dir=frog_bench/train ^ |
| --reg_data_dir=frog_bench/reg ^ |
| --prior_loss_weight=1.0 ^ |
| --resolution 512 ^ |
| --output_dir=lora_output ^ |
| --output_name=cjgg_frog ^ |
| --train_batch_size=%BATCH_SIZE% ^ |
| --learning_rate=1e-4 ^ |
| --max_train_epochs 4 ^ |
| --use_8bit_adam ^ |
| --xformers ^ |
| --mixed_precision=fp16 ^ |
| --save_precision=fp16 ^ |
| --seed 42 ^ |
| --save_model_as=safetensors ^ |
| --max_data_loader_n_workers=1 ^ |
| --network_module=networks.lora ^ |
| --network_dim=4 ^ |
| --training_comment="activate by usu frog" |
|
|
| call :GetEndTime |
|
|
| ) |
|
|
| %PYTHON% gen_img_diffusers.py ^ |
| --ckpt frog_bench/model/v1-5-pruned-pruned-fp16.safetensors ^ |
| --n_iter 1 ^ |
| --scale 7.5 ^ |
| --steps 40 ^ |
| --outdir txt2img ^ |
| --xformers ^ |
| --W 512 ^ |
| --H 512 ^ |
| --fp16 ^ |
| --sampler k_euler_a ^ |
| --network_module networks.lora ^ |
| --network_weights lora_output\cjgg_frog.safetensors ^ |
| --network_mul 1.0 ^ |
| --max_embeddings_multiples 3 ^ |
| --clip_skip 1 ^ |
| --batch_size 1 ^ |
| --images_per_prompt 1 ^ |
| --prompt "usu frog" |
|
|
| if %MODE% leq 2 ( |
| call :PutTime |
| ) |
|
|
| pause >nul |
| goto EOL |
|
|
| :GetStartTime |
| set T=%TIME: =0% |
| set H=%T:~0,2% |
| set M=%T:~3,2% |
| set S=%T:~6,2% |
| set C=%T:~9,2% |
| set /a H=1%H%-100,M=1%M%-100,S=1%S%-100,C=1%C%-100 |
| exit /b 0 |
|
|
| :GetEndTime |
| set T1=%TIME: =0% |
| set H1=%T1:~0,2% |
| set M1=%T1:~3,2% |
| set S1=%T1:~6,2% |
| set C1=%T1:~9,2% |
| set /a H1=1%H1%-100,M1=1%M1%-100,S1=1%S1%-100,C1=1%C1%-100 |
|
|
| set /a H2=H1-H,M2=M1-M |
| if %M2% LSS 0 set /a H2=H2-1,M2=M2+60 |
| set /a S2=S1-S |
| if %S2% LSS 0 set /a M2=M2-1,S2=S2+60 |
| set /a C2=C1-C |
| if %C2% LSS 0 set /a S2=S2-1,C2=C2+100 |
| if %C2% LSS 10 set C2=0%C2% |
| exit /b 0 |
|
|
| :PutTime |
| |
| |
| echo %H2%h%M2%m%S2%.%C2%s |
| echo %H2%h%M2%m%S2%.%C2%s>result.txt |
| exit /b 0 |
|
|
| :EOL |
|
|