Prerequisites
Before you install sd-scripts, make sure your system meets the following requirements:- Python 3.10.x — Python 3.11.x and 3.12.x may work but are not officially tested.
- Git — Required to clone the repository and pull updates.
- NVIDIA GPU with CUDA support — A CUDA 12.4-capable GPU is recommended. The default PyTorch install targets CUDA 12.4.
Install
- Windows
- Linux / WSL2
Windows required dependencies
Download and install the following before proceeding:- Python 3.10.x: Windows installer (64-bit)
- Git: git-scm.com/download/win
A when prompted, then close the administrator window.Installation steps
Open a regular PowerShell terminal and run each command in order:1
Clone the repository
2
Create and activate a virtual environment
python is not recognized, try py -m venv venv instead.3
Install PyTorch with CUDA support
cu121.4
Install requirements
5
Configure accelerate
bf16 to the last question if you want to use bfloat16 mixed precision. If you see ValueError: fp16 mixed precision requires a GPU, answer 0 for the GPU selection question to explicitly select GPU 0.About requirements.txt and PyTorch
requirements.txt does not include PyTorch. The correct PyTorch version depends on your GPU architecture and CUDA version, so you must install it separately before running pip install -r requirements.txt.
PyTorch 2.6.0 or later is required. The scripts are tested with PyTorch 2.6.0.
For RTX 50 series GPUs, use PyTorch 2.8.0 with CUDA 12.8 or 12.9. The existing requirements.txt is compatible with that version.
Key packages installed by requirements.txt include:
accelerate— Distributed training and mixed precision launchertransformers,diffusers— Model loading and inferencebitsandbytes— 8-bit optimizers for reduced VRAM usagesafetensors— Safe model serialization formatprodigyopt,lion-pytorch— Alternative optimizerstensorboard— Training metrics visualization
Upgrading
When a new release is available, pull the latest code and reinstall requirements:- Windows
- Linux / WSL2
Upgrading PyTorch
To upgrade PyTorch independently, run the samepip install torch==... command from the installation steps above with your target version.
