98 lines
2.7 KiB
Batchfile
98 lines
2.7 KiB
Batchfile
@echo off
|
|
chcp 65001 >nul 2>&1
|
|
setlocal EnableDelayedExpansion
|
|
|
|
title SDXL Long Context Converter v3
|
|
|
|
set "PYTHON=..\python_embeded\python.exe"
|
|
set "SCRIPT=sdxl_long_context_converter.py"
|
|
set "CKPT_DIR=..\ComfyUI\models\checkpoints"
|
|
|
|
:: ============================================================
|
|
:: SETTINGS — Change this to your checkpoint filename
|
|
:: ============================================================
|
|
set "CKPT_NAME=FernflowerAI.safetensors"
|
|
|
|
:: Extension method: pca / svd / extrapolate / decay_repeat / mean_noise / mirror / fourier / zero
|
|
set "METHOD=pca"
|
|
:: ============================================================
|
|
|
|
set "INPUT=%CKPT_DIR%\%CKPT_NAME%"
|
|
for %%A in ("%CKPT_NAME%") do set "BASE=%%~nA"
|
|
set "OUTPUT=%CKPT_DIR%\%BASE%_long248.safetensors"
|
|
|
|
echo.
|
|
echo ================================================================
|
|
echo SDXL Long Context Converter v3
|
|
echo Extend CLIP context: 77 -^> 248 tokens
|
|
echo Method: %METHOD% (PCA structural analysis)
|
|
echo Original positions preserved - short prompts are identical
|
|
echo ================================================================
|
|
echo.
|
|
|
|
if not exist "%PYTHON%" (
|
|
echo [X] Python not found: %PYTHON%
|
|
echo Make sure you run this from the scripts folder
|
|
goto :fail
|
|
)
|
|
if not exist "%SCRIPT%" (
|
|
echo [X] Script not found: %SCRIPT%
|
|
echo Place %SCRIPT% next to this bat file
|
|
goto :fail
|
|
)
|
|
if not exist "%INPUT%" (
|
|
echo [X] Checkpoint not found: %CKPT_NAME%
|
|
echo.
|
|
echo Available checkpoints:
|
|
for %%F in ("%CKPT_DIR%\*.safetensors") do echo %%~nxF
|
|
echo.
|
|
echo Edit CKPT_NAME in this bat file
|
|
goto :fail
|
|
)
|
|
|
|
%PYTHON% -c "import safetensors" >nul 2>&1
|
|
if errorlevel 1 (
|
|
echo Installing safetensors...
|
|
%PYTHON% -m pip install safetensors
|
|
)
|
|
|
|
echo Input: %CKPT_NAME%
|
|
echo Output: %BASE%_long248.safetensors
|
|
echo Method: %METHOD%
|
|
echo.
|
|
|
|
%PYTHON% %SCRIPT% ^
|
|
--input "%INPUT%" ^
|
|
--output "%OUTPUT%" ^
|
|
--target_len 248 ^
|
|
--method %METHOD% ^
|
|
--device cpu
|
|
|
|
if errorlevel 1 goto :fail
|
|
|
|
echo.
|
|
echo ================================================================
|
|
echo DONE!
|
|
echo.
|
|
echo Output: %OUTPUT%
|
|
echo.
|
|
echo Positions 0-76 are IDENTICAL to original.
|
|
echo Prompts up to 77 tokens produce the same result.
|
|
echo Prompts up to 248 tokens now fully supported.
|
|
echo.
|
|
echo Next steps:
|
|
echo 1. Install ComfyUI nodes
|
|
echo 2. Restart ComfyUI
|
|
echo 3. Use "Load Checkpoint (Long 248)" node
|
|
echo ================================================================
|
|
echo.
|
|
pause
|
|
exit /b 0
|
|
|
|
:fail
|
|
echo.
|
|
echo [X] Error! Check output above.
|
|
echo.
|
|
pause
|
|
exit /b 1
|