Skip to main content
XsiSec.com
HomeReposBlogProjectsPortfolio
© 2026 XsiSec.com
Security rules |security.txt
Updated 2026-08-22 · v1.0.0+2026-08-22.8585a7b · 8585a7b
← Back to overview
Security article

AI - Stable diffussion with dreambooth

AI - Stable diffussion with dreambooth: CUDA 11.8 on Xubuntu (GCC 12) — My DreamBooth Prep Notes • Knowledge • cuda, dreambooth

2023-05-192 tags
Tags

CUDA 11.8 on Xubuntu (GCC 12) — My DreamBooth Prep Notes

I’ve spent a lot of time getting a local Linux box ready to train image models of me. Cloud (Drive + rented GPUs) works, but I wanted it running on my own metal. The catch: tons of moving pieces that must play nicely together — GCC, CUDA toolkit, kernel/NVIDIA drivers, etc. The “latest and greatest” combo didn’t behave for me, so I pinned a known-good stack: CUDA 11.8 on Xubuntu 22.04 with GCC 12.


1) NVIDIA driver (clean slate → 525)

On a fresh Xubuntu 22.04 install I wiped any old NVIDIA bits and installed nvidia-driver-525:

bash
sudo apt update    # optional but recommended
sudo apt upgrade   # optional but recommended
sudo apt install nvidia-driver-525

Reboot after installing the driver.


2) Install CUDA 11.8 (runfile)

Grab the CUDA 11.8 runfile installer and run it:

bash
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run
sudo sh cuda_11.8.0_520.61.05_linux.run

Quick sanity check:

bash
nvidia-smi

You should see your GPUs and a driver line (e.g., Driver Version: 525.xx, CUDA Version: 12.0).


3) Add CUDA to your environment

Append to ~/.bashrc:

bash
export PATH="/usr/local/cuda/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH"

Reload the shell:

bash
source ~/.bashrc

Register the library path with the dynamic loader:

bash
sudo bash -c "echo /usr/local/cuda/lib64 > /etc/ld.so.conf"
sudo ldconfig

Confirm it’s visible:

bash
ldconfig -p | grep cuda

4) Verify your CUDA version

bash
cat /usr/local/cuda/version.json | grep version -B 2
# Expect something like:
# "cuda" : { "name" : "CUDA SDK", "version" : "11.8.20220929" },

5) Build CUDA Samples (optional but reassuring)

Samples moved to GitHub:

bash
git clone https://github.com/NVIDIA/cuda-samples.git
cd cuda-samples/
git checkout v11.8

Install a required dependency:

bash
sudo apt install libfreeimage-dev

Compile using all cores and tail the log:

bash
make -j"$(nproc)" > compile.log 2>&1 &
tail -f compile.log

You’ll get warnings for older GPUs — ignore them. When the log ends with Finished building CUDA samples, try a couple examples:

bash
# CUBLAS matrix multiply
cd Samples/4_CUDA_Libraries/matrixMulCUBLAS
./matrixMulCUBLAS

# (Optional) P2P bandwidth/latency if you have multiple GPUs
cd ~/cuda-samples/Samples/5_Domain_Specific/p2pBandwidthLatencyTest
./p2pBandwidthLatencyTest

NVLink matrix (if applicable):

bash
nvidia-smi nvlink -s

Clean up if you like:

bash
rm -rf ~/cuda_11.8.0_520.61.05_linux.run ~/cuda-samples

6) Python env + Diffusers / DreamBooth deps

You can use Anaconda or plain venv. If you prefer Anaconda (example version — grab the latest from their site):

bash
wget https://repo.anaconda.com/archive/Anaconda3-2022.05-Linux-x86_64.sh
chmod +x ./Anaconda3-2022.05-Linux-x86_64.sh
./Anaconda3-2022.05-Linux-x86_64.sh

Clone the DreamBooth-ready Diffusers fork and install pieces:

bash
# Fork with DreamBooth examples
git clone https://github.com/ShivamShrirao/diffusers
cd diffusers

# CUDA-enabled PyTorch (11.7 wheels play well with a 11.8 toolkit install)
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117

# DreamBooth example requirements
cd examples/dreambooth
pip install -r requirements.txt

# Back to repo root to install diffusers in editable/standard mode
cd ../..
pip install .

# Extra performance libs
pip install -U --pre triton
pip install ninja bitsandbytes

# xFormers (specific commit used)
pip install git+https://github.com/facebookresearch/xformers@51dd119#egg=xformers

Configure accelerate (I set all device indices to 0 and chose FP16):

bash
accelerate config

Authenticate with Hugging Face:

bash
huggingface-cli login

Convert a Diffusers model to an original Stable Diffusion checkpoint (example):

bash
python convert_diffusers_to_original_stable_diffusion.py   --model_path /home/MODEL-TO-CONVERT   --checkpoint_path /OUTPUT_PATH

That’s all. This combo (Xubuntu 22.04 + driver 525 + CUDA 11.8 + GCC 12) was the first setup that behaved consistently for me and didn’t fight my DreamBooth runs.

Comments

Comments

Loading comments…

Navigate

In this post

  1. 01CUDA 11.8 on Xubuntu (GCC 12) — My DreamBooth Prep Notes
  2. 021) NVIDIA driver (clean slate → 525)
  3. 032) Install CUDA 11.8 (runfile)
  4. 043) Add CUDA to your environment
  5. 054) Verify your CUDA version
  6. 065) Build CUDA Samples (optional but reassuring)
  7. 076) Python env + Diffusers / DreamBooth deps
Search
Explore

Popular tags

Browse all 30 tags