CivArchive
    ← All articles
    Published April 7, 2025by MM744

    How to install Kohya_SS + PyTorch 2.7.0 (Optional) (Windows)

    3K views7 reactions3 comments on CivitAI15 collected
    1.5resource guidepytorchfluxkohya_sslora trainingsdxlpythoncudnnguide

    1)Prepare

    Requirements:

    1.Python 3.10.11

    2.CUDA 12.4 toolkit or newer

    3.Git

    4.Microsoft Visual C++ Redistributable

    Article - https://civitai.com/articles/8041/installing-running-requirements-for-ai-applications-windows

    2)Install Kohya_SS

    Open Terminal:

    git clone https://github.com/bmaltais/kohya_ss
    cd kohya_ss
    git checkout master
    pip install rich
    setup.bat

    Kohya_ss setup menu:

    1. Install kohya_ss GUI

    5. (Optional) Manually configure Accelerate:

    >This machine

    >No distributed training



    Do you want to run your training on CPU only (even if a GPU / Apple Silicon / Ascend NPU device is available)?

    >No

    Do you wish to optimize your script with torch dynamo?

    >No

    Do you want to use DeepSpeed?

    >No

    What GPU(s) (by id) should be used for training on this machine as a comma-seperated list?

    >All

    Would you like to enable numa efficiency? (Currently only supported on NVIDIA hardware).

    >Yes

    Do you wish to use FP16 or BF16 (mixed precision)?

    >bf16 (If you have a RTX 30/40/50 series video card choose >bf16. If don't have choose >fp16.)

    3)Install PyTorch 2.6.0+ (2.7.0) for Kohya_SS (Optional) (Experimental)

    Run Terminal inside kohya_ss folder:

    pip install requests
    call .\venv\Scripts\activate.bat
    python -m pip install --upgrade pip
    git pull
    git submodule update --init --recursive
    pip uninstall xformers torch torchvision torchaudio --yes
    pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128

    1.Change text in gui.bat file inside kohya_ss folder and to add --noverify to skip check updates reequipments for kohya_gui.py

    @echo off

    set PYTHON_VER=3.10.9

    :: Deactivate the virtual environment

    call .\venv\Scripts\deactivate.bat

    :: Activate the virtual environment

    call .\venv\Scripts\activate.bat

    set PATH=%PATH%;%~dp0venv\Lib\site-packages\torch\lib

    :: If the exit code is 0, run the kohya_gui.py script with the command-line arguments

    if %errorlevel% equ 0 (

    REM Check if the batch was started via double-click

    IF /i "%comspec% /c %~0 " equ "%cmdcmdline:"=%" (

    REM echo This script was started by double clicking.

    cmd /k python.exe kohya_gui.py %* --noverify

    ) ELSE (

    REM echo This script was started from a command prompt.

    python.exe kohya_gui.py %* --noverify

    )

    )

    2.Run Terminal inside kohya_ss folder:

    python -m venv venv
    .\venv\Scripts\activate
    pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu124

    pip install xformers==0.0.29.dev922

    pip3 install torch==2.5.0 torchvision --index-url https://download.pytorch.org/whl/test/cu124

    3.Install cuDNN 9.5.0 for Kohya_SS (Option)

    Run terminal inside kohya_ss folder:

    python -m venv venv

    .\venv\Scripts\activate

    pip install nvidia-cudnn-cu11==9.5.0.50

    3.Install TransformerEngine or MS-AMP for Kohya_SS (In development, Option)

    pip install transformer-engine