How install Kohya_SS to Ubuntu WSL under Windows 11


Updated:

How to install Kohya_SS to Ubuntu WSL 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 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.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda
export PATH=/usr/local/cuda-12.6/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-12.6/lib64\${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

:: Reboot

sudo reboot

:: Kohya_ss install

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

:: 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 series video card choose >bf16. If don't have choose >fp16.

4)Run Kohya_SS on WSL Ubuntu

cd kohya_ss
./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
2
0

Comments