An Environment Setup Guide
- to Train ZIT/SDXL/IL/(maybe FLUX) LoRAs
- on AMD RDNA 4 GPUs (RX 9070/XT)
- via WSL2
- with ROCm 7.2
- using Ostris' ai-toolkit
Valid on: Feb 3, 2026
My setup: AMD RX 9070 (gfx1201), Windows 11
Disclaimer: I'm not an AI researcher nor a Linux wizard. I'm a normal user who wants to train on Windows with an AMD GPU because, much like you, I love pain. This guide is the result of trial-and-error, fighting with HSA Exceptions, memory leaks, and arguing with an AI.
If you know better, your corrections and suggestions are welcome! π
π οΈ Phase 1: Windows Prep
Get the latest AMD Drivers
You need Adrenalin 26.1.1 or newer. Download here.
Install WSL2
Make sure the functionality is enabled: press Windows key + R, type optionalfeatures, Enter. Look for "Windows Subsystem for Linux", check the box, OK, restart.
Open PowerShell
wsl --install Ubuntu-22.04Create a username/password.
Press
Win + R, type%UserProfile%, enter, create a text file named.wslconfig, paste this inside and save:[wsl2] memory=20GB # If you have 32GB total, give WSL 20-24. If you have more than 32GB RAM, and you bought it before the shortage, I don't want to talk to you. swap=32GB # For when memory runs out.
π§ Phase 2: Ubuntu Prep
Copy/paste time!
In the PS terminal, start wsl
wslUpdate everything ritual
sudo apt update && sudo apt upgrade -yAll the necessary crap important stuff
Python
sudo apt install python3 python3-venv python3-pip -y
pip3 install --upgrade pip wheelKate because VI is scary and we like GUIs
sudo apt install kate -yNode.js (for the fancy ai-toolkit interface that we won't be able to use fully π’)
Official doc here
sudo apt-get install curl -y
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
# Close and re-open your terminal, then
wsl # Duh
nvm install --ltsRadeon software with β¨ROCm 7.2β¨
Official doc here
wget https://repo.radeon.com/amdgpu-install/7.2/ubuntu/jammy/amdgpu-install_7.2.70200-1_all.deb
sudo apt install ./amdgpu-install_7.2.70200-1_all.deb
amdgpu-install -y --usecase=wsl,rocm,hip --no-dkms
# I don't know why I added hipSanity Check: Type rocminfo. If you see a wall of text with "gfx1201" somewhere, you're golden.
π Phase 3: AI-Toolkit & PyTorch
AI-Toolkit
# Clone the repo
git clone https://github.com/ostris/ai-toolkit.git
cd ai-toolkit
# Create and activate the venv
python3 -m venv venv
source venv/bin/activateDon't install requirements yet.
PyTorch
At the moment we need the AMD wheels
Official doc here
wget https://repo.radeon.com/rocm/manylinux/rocm-rel-7.2/torch-2.9.1%2Brocm7.2.0.lw.git7e1940d4-cp310-cp310-linux_x86_64.whl
wget https://repo.radeon.com/rocm/manylinux/rocm-rel-7.2/torchvision-0.24.0%2Brocm7.2.0.gitb919bd0c-cp310-cp310-linux_x86_64.whl
wget https://repo.radeon.com/rocm/manylinux/rocm-rel-7.2/triton-3.5.1%2Brocm7.2.0.gita272dfa8-cp310-cp310-linux_x86_64.whl
wget https://repo.radeon.com/rocm/manylinux/rocm-rel-7.2/torchaudio-2.9.0%2Brocm7.2.0.gite3c6ee2b-cp310-cp310-linux_x86_64.whl
pip3 uninstall torch torchvision triton torchaudio
pip3 install torch-2.9.1+rocm7.2.0.lw.git7e1940d4-cp310-cp310-linux_x86_64.whl torchvision-0.24.0+rocm7.2.0.gitb919bd0c-cp310-cp310-linux_x86_64.whl torchaudio-2.9.0+rocm7.2.0.gite3c6ee2b-cp310-cp310-linux_x86_64.whl triton-3.5.1+rocm7.2.0.gita272dfa8-cp310-cp310-linux_x86_64.whlAMD suggest you then "update to WSL compatible runtime lib". I didn't need to but here goes
location=$(pip show torch | grep Location | awk -F ": " '{print $2}')
cd ${location}/torch/lib/
rm libhsa-runtime64.so*Verify
python3 -c 'import torch' 2> /dev/null && echo 'Success' || echo 'Failure'
python3 -c 'import torch; print(torch.cuda.is_available())'
python3 -c "import torch; print(f'device name [0]:', torch.cuda.get_device_name(0))"
python3 -m torch.utils.collect_envRequirements
pip3 install -r requirements.txtβοΈ Phase 4: Compiling Bitsandbytes (β―β΅β‘β²)β―οΈ΅β»ββ»
The pip-installed
bitsandbytesjust won't cut it. For the moment (0.49.2.dev) we have to compile it ourselves like Neanderthals.
Official doc here
# Yeet the broken version
pip uninstall bitsandbytes -y
# Clone the repo
git clone https://github.com/bitsandbytes-foundation/bitsandbytes.git
cd bitsandbytes
# Install build tools & update CMake (important!)
sudo apt-get install -y build-essential cmake
pip install cmake --upgrade
hash -r
# Compile targeting our card (gfx1201, replace with your own arch if you aren't using a 9070/XT)
cmake -DCOMPUTE_BACKEND=hip -DBNB_ROCM_ARCH="gfx1201" -S .
make -j$(nproc)
pip install .
# Go back home
cd ..π₯οΈ Phase 5: Actually Train Sh*t
Configure a job
First we need to build the GUI, cause we like GUIs, remember?
cd ui
npm run build_and_startGo to the address it returns (should be http://localhost:8675)
The interface yells at you something like nvidia-smi is no good yada yada. We dgaf π
Use the UI to upload your dataset and tune your config; this guide does not go into details how to do that. Suggest you check Ostris' Youtube channel. Ostris is great and he smells good, we like Ostris.
I'd still suggest to keep batch size and gradient accumulation both set to 1 - I'm having issues with any other value, even with free vram.Once you're set, in "new job", click"advanced" and copy the YAML text.
In terminal: Ctrl+C, then
cd ..
kate
# Paste and save to ai-toolkit/config/my_job.yamlStart the training
cd ~/ai-toolkit
python run.py config/my_job.yamlNext time
Open the terminal, type
# Start WSL and activate the venv
wsl
cd ~/ai-toolkit
source venv/bin/activate
# Start the UI if you want, to create datasets / configs
cd ~/ai-toolkit/ui
npm run build_and_start
# save your config to YAML
kate
# Paste and save to ai-toolkit/config/my_job.yaml
# Run
cd ~/ai-toolkit
python run.py config/my_job.yamlIf this guide helped you in any way, I would love for you to leave a short comment!
If you don't want to that's OK, I wrote this on company time.
Take care and have fun β€οΈ
SGtW



![Train LoRAs on AMD GPU via WSL2 with ROCm 7.2 - [Setup guide - Feb26]](https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/edc0583e-37b4-4b25-8eb4-999b59e9bd1d/width=1600/setup_guide_title.jpeg)