CivArchive
    ← All articles
    Published November 3, 2024by MM744

    How install Kohya_SS to Ubuntu WSL 2 under Windows 11 (Updated)

    379 views0 reactions0 comments on CivitAI3 collected
    tool guidefluxinstallation guidelora trainingsdxl 1.0 basewindows 11sd3ubuntulorakohya_ss1.5

    How to install Kohya_SS to Ubuntu WSL 2 under Windows 11

    1)Prepare:

    1.Check CPU virtualization on Windows > Task Manager > Perfomance > CPU > Virtualization: Enabled or Disabled.

    If Disabled - Access the UEFI (or BIOS). The way the UEFI (or BIOS) appears depends on your PC manufacturer. https://support.microsoft.com/en-us/windows/enable-virtualization-on-windows-c5578302-6e43-4b4b-a449-8ced115f58e1

    2.Make sure you are using a recent version of Windows 10/11. If needed update to the latest version. (No earlier than Windows 10, Version 1903, Build 18362)

    2)Install WSL and Ubuntu

    1.Open Terminal > Use the command -

    wsl --install

    2.Open the Microsoft Store > Find - Ubuntu. (Ubuntu which doesn't show the version in a name is the latest)

    3.Install Ubuntu

    4.Open Ubuntu

    5.Create profile > For example:

    Username - User

    Password - User

    3)Install Kohya_SS on WSL 2 Ubuntu

    :: Prepare

    sudo apt update
    sudo apt install software-properties-common -y
    sudo add-apt-repository ppa:deadsnakes/ppa
    sudo apt update
    sudo apt install python3.10 python3.10-venv python3.10-dev -y
    sudo apt update -y && sudo apt install -y python3-tk
    sudo apt install python3.10-tk
    sudo apt install git -y

    :: NVIDIA CUDA Toolkit

    wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-keyring_1.1-1_all.deb
    sudo dpkg -i cuda-keyring_1.1-1_all.deb
    sudo apt-get update
    sudo apt-get -y install cuda-toolkit-12-9
    export PATH=/usr/local/cuda-12.9/bin${PATH:+:${PATH}}
    export LD_LIBRARY_PATH=/usr/local/cuda-12.9/lib64\${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

    :: CuDNN*

    wget https://developer.download.nvidia.com/compute/cudnn/9.10.2/local_installers/cudnn-local-repo-ubuntu2404-9.10.2_1.0-1_amd64.deb
    sudo dpkg -i cudnn-local-repo-ubuntu2404-9.10.2_1.0-1_amd64.deb
    sudo cp /var/cudnn-local-repo-ubuntu2404-9.10.2/cudnn-*-keyring.gpg /usr/share/keyrings/
    sudo apt-get update
    sudo apt-get -y install cudnn
    sudo apt-get -y install cudnn-cuda-12

    :: Reboot

    sudo reboot

    :: Kohya_ss install

    cd ~
    git clone --recursive https://github.com/bmaltais/kohya_ss.git
    cd kohya_ss
    ./setup.sh

    git checkout sd3-sd3.5-flux

    :: Configuration settings

    source venv/bin/activate
    accelerate config

    >This machine

    >No distributed training



    >No

    >No

    >No

    >All

    >Yes

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

    4)Update PyTorch for Kohya_SS (xFormers might not works. Only SDPA.)

    Open a

    Replace a requirements_linux.txt

    torch==2.7.1+cu128

    4)Run Kohya_SS on WSL 2 Ubuntu

    cd kohya_ss
    source venv/bin/activate
    ./gui.sh

    Notes:

    To find Kohya_ss folder use \\wsl.localhost\Ubuntu\home\user in Explorer. You can move there a model to train and dataset.

    Additional commands for Windows Terminal:

    Shutdown -

    wsl --shutdown

    Uninstall or reset Ubuntu -

    wsl --unregister Ubuntu