Files
brahianrosswill-ComfyUI_SDX…/scripts/finetune.bat
T
2026-02-15 11:04:13 +05:00

85 lines
2.0 KiB
Batchfile

@echo off
chcp 65001 >nul 2>&1
setlocal EnableDelayedExpansion
title SDXL Position Fine-Tuner
set "PYTHON=..\python_embeded\python.exe"
set "SCRIPT=finetune_positions.py"
set "CKPT_DIR=..\ComfyUI\models\checkpoints"
:: Input: PCA-converted checkpoint
set "INPUT_NAME=FernflowerAI-2D_long248.safetensors"
:: Output: fine-tuned checkpoint
set "OUTPUT_NAME=FernflowerAI-2D_long248_tuned.safetensors"
:: Training parameters
set "STEPS=500"
set "LR=0.001"
echo.
echo ================================================================
echo SDXL Position Embedding Fine-Tuner
echo Trains positions 77-247 using self-supervised optimization
echo All model weights FROZEN — only positions are optimized
echo Requires GPU with 8+ GB VRAM
echo ================================================================
echo.
if not exist "%PYTHON%" (
echo [X] Python not found: %PYTHON%
goto :fail
)
if not exist "%SCRIPT%" (
echo [X] Script not found: %SCRIPT%
goto :fail
)
if not exist "%CKPT_DIR%\%INPUT_NAME%" (
echo [X] Checkpoint not found: %INPUT_NAME%
echo.
echo Available:
for %%F in ("%CKPT_DIR%\*.safetensors") do echo %%~nxF
goto :fail
)
:: Check transformers
%PYTHON% -c "import transformers" >nul 2>&1
if errorlevel 1 (
echo Installing transformers...
%PYTHON% -m pip install transformers
)
echo Input: %INPUT_NAME%
echo Output: %OUTPUT_NAME%
echo Steps: %STEPS%
echo LR: %LR%
echo.
%PYTHON% %SCRIPT% ^
--input "%CKPT_DIR%\%INPUT_NAME%" ^
--output "%CKPT_DIR%\%OUTPUT_NAME%" ^
--steps %STEPS% ^
--lr %LR% ^
--device cuda
if errorlevel 1 goto :fail
echo.
echo ================================================================
echo DONE!
echo.
echo Output: %OUTPUT_NAME%
echo.
echo Run analyze.bat on the result to verify quality.
echo ================================================================
echo.
pause
exit /b 0
:fail
echo.
echo [X] Error! Check output above.
echo.
pause
exit /b 1